Take the 2-minute tour ×
LEGO® Answers is a question and answer site for LEGO® and building block enthusiasts. It's 100% free, no registration required.

How would you tackle the automation of a lego rails set. I am looking for a solution that can be achieved with available parts.

From the answer I will chose either to invest into lego rail sets for my son or into digital H0 sets.

What I am looking for:

  • start given engine and run to given destination, stop.
  • when approaching a rails crossing stop if segment busy.
  • change switches for engine to send to destination.
  • run multiple engines independently and concurrently.

Optionally:

  • if multiple routes are available sent train to free route.
  • if train is running low on power send to service station.

I am not interested in setting timings. I want to be able to simply run the different engines each on their own. This requires detectors which are able to return the ID of the engine entering and leaving the different segments.

I'm pretty good at programming and I would appreciate a doable solution running from a computer.

share|improve this question
    
You might also want to check out our question on cost comparison too - although I've seen a video of a very impressive Mindstorms controlled LEGO train set, if it's really an automated train set you're after I'd probably have to recommend a DCC or similar HO set - they're certainly going to be simpler to set up and configure. –  Zhaph - Ben Duguid Jan 7 '13 at 1:04

3 Answers 3

LDCC provides a lego solution if you are willing to look for 9V track and modify the motors. There are an endless number of things you can do combining DCC and Mindstorms NXT amoung other things. It really has a lot to do with how much time you personally want to invest. It doesn't matter if it is HO or L(LEGO) scale, they both require a large investment of time to get good results. I have both HO and L scale experience. The LEGO train club I am part of has all kinds of lighting, sound, and action in the exhibits, including light rail that stops at platforms and multiple trains on the same track.

The long and short of it is that LEGO will require more initial investment, but it can do the same things as HO except it is infinitely more reusable. I use LEGO my father used as a child, I am sure my daughter will play with mine when she is old enough. Once something is made in HO, it is very hard to unmake it, but LEGO can be a new creation every day.

share|improve this answer

I've wanted to do something similar since I took part in a public event last year and we had trains running continuously on separate little ovals. My ambition was to have two stations, each with some switches, and run one train at a time between them and switch it to an empty track where it would stop.

Since I already had two RCXs, my solution was to place one at either station with light sensors to detect incoming and outgoing trains. I motorized the switches (using a modified version of instructions I found online - I could make some instructions if you wish), and wrote a program that allows the RCXs to communicate with each other about the state of the trains and the switches.

There were two tricky parts: one is that although you can send PF commands from an RCX, there is no feedback from the PF receiver so you'll have to resend the command several times and hope for the best. The other is that the communication between the RCXs is affected by the PF commands. When you send a PF command, the receiver in the RCX will end up in a state where the next serial byte is lost, and although there is collision detection for the communication between the RCXs, there is nothing similar for the PF commands (the sending of which requires the disabling of all interrupts on the RCX).

My solution was to design a protocol for communication between the two RCXs such that they, in effect, negotiate whose turn it is to send PF commands and stay silent when the other RCX is sending. This worked very well in my living room, where the trains would happily run and stop and be handed back and forth between the two RCXs (since you can't easily ID the trains, you have to know where they are). I then tried to set this up at an event, but unfortunately the room was anything but compatible with PF. Possibly because of the fluorescent lights, the PF IR range was severely limited and the trains would not receive the signals from the RCXs.

A solution based on NXT (or EV3) could probably be a lot more powerful and reliable, especially since you'll have much better ways of detecting the trains. Even so, I suspect they'd run into the same problems in some showrooms as my RCX solution.

share|improve this answer
    
I found that places with white walls work better for IR communication. The fluorescent lights can in some instances completely mess-up with the IR networks, but most of the time when there is no line of sight the signal is transmitted by reflection from the walls and ceiling. A solution a friend uses now is to setup a white ceiling over his installations in large open spaces. The ideal solution would be mirrors, but they are expensive and cumbersome. His preferred solution for shows remains a white waxed fabric. I hope this will help you for your future installations. –  Coyote May 2 '13 at 10:27

LEGO trains are primarily toys, and the recent ones aren't even using metallic rails.

As such, they're usually considered ill-suited for automation purposes. That doesn't mean it's impossible, but it'll prove challenging. In any case, you'll definitely need some computing, so it's good that it's OK with you.

For trains themselves, sticking to available parts will be an issue. PF trains are supposed to be remote controlled via RC and have no awareness of the track of or anything at all. The problem you'll have here si to make sure that whatever signal you send, the train will receive it. Some your RC emitters need to be very well placed, and the bigger your layout, the more this is going to be a problem. Forget about tunnels. And your number of trains is limited, too.

You'll probably need to use a Mindstorms Kit and an IR Link Sensor; the NXT itself can be programmed directly or easily controlled by a computer.

Since you'll be using Mindstorms, sensing trains shouldn't be too much of a problem, either with available sensors (not sure which one would be best though) or by making your own (a reed sensor on the track usually detects LEGO train magnets if there are 2 or more of them together); but you'll be limited by the number of sensors you can plug on a NXT. You can of course use several, or grab some sensor multiplexers. When using Reed sensors, you'll probably hav enough with touch sensor multiplexers.

So far, you see using only standard material (and admitting HiTechnics or other third-party vendors as such) is already becoming a complex solution - feasible, certainly, but not cheap either. And we haven't touched switches yet - not that it's complicated to motorize, but if using NXT motors, it's going to take some place.

In the past, some people have had some success transforming 9V trains for DCC, but I wouldn't consider 9V trains as available any more, and this solution does also require a lot of work and good understanding of DCC and whatnot. I have none of this, so I won't talk much more about it, except to say that this usually doesn't address the problem of switches either, and that you'll need a lot of non-LEGO stuff to make it all work.

In short, I think you can do a lot of fun automation even with current trains, but if you want a complete solution right from the start, LEGO may not be the best suited for that. On the other hand, the challenge of making it work may be a greater experience for you and your son, so I'd advise trying anyway. You can start with simple things, keeping the most complicated things (switches) for later.

One other thing you can do to simplify is make sure that the layout itself is simple. For instance, you can have a single track with a train going back and forth (mimicking the good old 4,5V system shouldn't be hard with a PF Polarity Switch, and that by itself adds a lot of movement to an existing layout, without actually requiring any automation at all.

share|improve this answer
1  
Thank you for the detailed answer. It brings material to explore and ponder over before making a choice. I will take the time to explore the options. Have you noticed the headphones hat makes your avatar looks like a demon? –  Coyote Jan 3 '13 at 9:31
    
Now that you mention it, indeed. I guess I should take the time to make a correct avatar though before worrying about what putting an hat on does to it :-) –  Joubarc Jan 3 '13 at 13:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.