Jump to content
THIS IS THE TEST SITE OF EUROBRICKS!
THIS IS THE TEST SITE OF EUROBRICKS!

Featured Replies

I don't mean to spam, but all my Arduino for Lego train videos are available here: https://www.youtube.com/channel/UCyvLxhkuFuukFxgYQx2eB9g

The Junctions tutorial (#6) explains how to create a state machine, and tutorial #2 shows how to use photoresistors in a really simple way (no auto-level sensing code). All the code is shown in each video if you need help.

The tutorial I'm making at the moment shows how to make an IR sensor to detect trains, which can fit inside a 32000 Technic brick, and should be online in a week or two.

It is very doable: use an IR LED in one hole and an IR transistor in the other and voila you have your sensor :)

B.t.w. posting a link that is an addition to the discussion is always very welcomed!

One advance of using an IR sensor is that it could also be used to send IR commands. I have also ones done some experiments with putting IR SMD leds beneath the tracks. If one would put an IR receiver underneath the train, it can be used as a signal (LED's on -> train stops e.g.).

  • Author

Very nice work! Brick-on dr_spock! If you position the reed sensor very well it works every time, again and again as you can well see :)

Thanks. :classic:

It has been a long time, but I had a few wayside bits controlled by RCX and homebrew sensors. I found that reed switches between the rails responded 90% of the time to the magnets too... and I was stumbling around. Someone with actual experience would likely to do better.

So far I have good results at home with reed switches. I guess I won't know for sure until I try them at an event. Then they'll probably be all wonky like with my GBC machine when it leaves the house :laugh:

I don't mean to spam, but all my Arduino for Lego train videos are available here: https://www.youtube....FuukFxgYQx2eB9g

The Junctions tutorial (#6) explains how to create a state machine, and tutorial #2 shows how to use photoresistors in a really simple way (no auto-level sensing code). All the code is shown in each video if you need help.

The tutorial I'm making at the moment shows how to make an IR sensor to detect trains, which can fit inside a 32000 Technic brick, and should be online in a week or two.

SPAM is good ham. Thanks, I'll have to check out your code. :classic:

It is very doable: use an IR LED in one hole and an IR transistor in the other and voila you have your sensor :

One advance of using an IR sensor is that it could also be used to send IR commands. I have also ones done some experiments with putting IR SMD leds beneath the tracks. If one would put an IR receiver underneath the train, it can be used as a signal (LED's on -> train stops e.g.).

Something like this?

irdetector_zpsojsnpp0p.jpg

I like the idea of using it to send commands too. That can be useful inside tunnels.

Something like this?

Yes, that's exactly how I've built mine:

KBERKAz.png

It's ok to file/sand/grind down the sides of the LEDs so that they fit into the technic brick - just don't damage the end of the LED.

Edited by Richfilth

  • Author

After a month, I received the HC-05 Bluetooth module in the mail. Time for a quick test, I connected it to my Arduino. I installed free Roboremo on my Android phone and setup some button controls. I paired the two Bluetooth devices and it is touch screen train fun. :classic: I think it probably makes more sense to do this for 9V trains so you don't have to be tied to the 9V train controller.

bluetooth.jpg

STOP MAKING COOL THINGS LIKE THIS! I already have way too many things on my wish list. (grin) Though beyond the pain of envy for which you cause me I must say great job!

  • 1 month later...
  • Author

I cloned the PF Train Speed Control functions in Roboremo on my Android phone. The sliders emulate the knobs on the train controler. It has 7 forward and 7 reverse plus stop if you get the slider in the middle. I also have stop buttons for the blue and red channels on the user interface. I find stop buttons useful the way I drive a train. :classic:

Screenshot_2015-09-28-15-16-48_zpszebvmpqf.png

Here is controling the servo motor in the Volvo loader for proportional steering. The phone talks via bluetooth to the Arduino. The Arduino then sends the correct LEGO IR command to the IR receiver in the Technic model. I tested it outside at a picnic the other weekend but I didn't record it. :blush:

STOP MAKING COOL THINGS LIKE THIS! I already have way too many things on my wish list. (grin) Though beyond the pain of envy for which you cause me I must say great job!

Thanks. Sbrick is too pricey to equipe every train and I want to be able to run any PF train sets or MOCs people may bring to our LUG events. PF IR is the easy way to go. My next step is making signal towers or windmills or cell towers to hide IR LEDs in strategic locations to control the PF trains. Being outside picnics I pretty much have to beam down to the IR receiver. I'm thinking of letting kids drive the trains with the PF train controler (or some simple control connected to an Arduino) and have the Arduino be the positive train control to emergency brake if they run a red signal or exceed the speed limit. We find that young kids like things that move and hands-on :classic:

  • 2 weeks later...

This would be perfect for a single line tram on a city layout going from one station to another and then back again on a continual basis.... Just what I need!

Coming to this late but I did this four years ago. https://www.flickr.com/photos/snapshot-jh/5792251575

I had two trains pausing to pass each-other at a central station at this year's STEAM but couldn't get more working as a NXT-G fault on my laptop stopped me getting the motorised points working.

I think we all know what that cat is thinking......

It all looks good to though of course ;)

Edited by Trainmaster247

  • Author

I think we all know what that cat is thinking......

It all looks good to though of course ;)

Thanks. He prefers to steal the LEGO balls out of my Great Ball Contraptions than chasing trains. Then I'm finding balls all over the house. :classic:

So would this be a good starter kit to start to attempt to do some of these amazing things here

http://www.amazon.co...eywords=arduino

Thanks

It's not bad for doing other things with Arduino. It has LEDs you can use for signals but only yellow and red it seems. The servo motor can be use to control a turn out. But to control LEGO PF trains, you'll need a infrared LED in the 980nm range which the start kit doesn't have but they are easy enough to order off Ebay. If you want to detect the train, then you'll need some detection devices like reed switches, photodiodes, etc.

  • 2 months later...
name='dr_spock' timestamp='1433201099' post='2232018']For a quick test, I hooked up an IR LED desoldered from an old DVD player remote to the board and wrote a simple sketch. I made use of a LEGO Power Function library (http://forum.arduino...p?topic=89310.0) Some resources on the Internet say IR LED in the 940nm range works best for Power Function IR receivers.

Sorry for bumping the topic. I see you are using a very simple setup to send code via an ir led to the train.

I tried the same which works fine, however ... I experience that the IR led has difficulties to send a strong signal towards the receiver. I found it was ok in a straight line but only upto aomething liek 20cm.

What is your experience here, it looks in one of your videos that your range is pretty ok.[/s]

My bad, you answered this in another post already.

Edited by aawsum

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.
Sponsored Links