Kolaf

Just starting with Lego trains

Recommended Posts

traintech1.jpg

Hi,

I am new to Lego trains, I just received the cargo train set for Christmas. I have always wanted to play with robotics, and this has been the perfect opportunity to meet for starting this. Plan is to automate both the track and the train itself. I will use one microcontroller for the track, controlling switches, lights, train crossings etc, and a second microcontroller on the engine to take care of driving. Everything will be controlled by my infrared remote (Logitech Harmony one) and additional sensor input.

This is a long-term project, but I have made a first stab at creating a automatic Lego train switch. A video of the working setup is embedded below. this is of course just a beginning, I need to build a full switching house around this in order to make it look even remotely authentic.

I appreciate feedback/ideas on how to improve the design, it is not yet very stable (the connection between the servo and the switch toggle).

I expect to have further updates as I progress, but don't be impatient. My largest challenge will be to build/modify an engine to house the batteries, sensors, Lego Power functions XL engine, and the microcontroller.

The plan is as follows:

-- automatic switches

-- (automatic) signal lights

-- automatic track crossing with automatic booms, lights, and everything

-- more?

For the engine:

-- build engine to house Power functions XL motor, batteries, a few servos, and the microcontroller

-- control the train motion using my remote control

-- add a forward sensor to stop the train when the track is obstructed

-- add a sensor which can read instructions embedded alongside the track (e.g. increase speed, decrease speed, "train stop in 40 cm" to have a realistic slowdown to a station, etc).

-- The ability to switch between manual and automatic control

-- stop and start automatically on red and green lights, maybe even emergency brake on red lights and obstructed track even in manual mode

-- more?

A self loading/unloading cargo car, the details of this are unclear yet.

I would really appreciate ideas/comments to the above list :)

Merry Christmas to all,

Frank

Edited by TheBrickster

Share this post


Link to post
Share on other sites
A self loading/unloading cargo car, the details of this are unclear yet.

I would really appreciate ideas/comments to the above list :)

Merry Christmas to all,

Frank

Hi Frank,

Thats a great start, I've often mused about adding some electronics to my Lego trains but never gotten around to doing it.

I'm not sure IR is the best choice though as it requires line of sight, is there similar RF remotes available?

How much does the uP board cost? How many points could it potentially control?

The model railroad gear I've seen all use solenoids rather than servos to throw points, depending on which is cheaper this may be worth investigating.

If I were to automate a freight car I'd do either grain or coal, as both these are often emptied into/onto coveyor or elevator systems, and are loaded through chutes. It would allow a completely hands off operation.

Thanks for sharing your efforts, its very interesting so far.

Share this post


Link to post
Share on other sites

Thanks for your reply. The reason for using IR is that it is cheap and easy to implement. I believe RF receivers are more expensive, and I do not have a suitable RF transmitter, but I have a suitable IR transmitter.

The board is quite expensive, about $50. There are cheaper alternatives, the stock Arduino board runs about $25-$30, but the great thing about the Roboduino board is that it is designed for easy connecting servos and sensors without having to have an additional breadboard or something.

Using solenoids is a great tip, they seem to require less space allowing a more compact design, I just have to figure out what they are called in Norwegian to find them in a Norwegian store :)

The challenge with the Lego trains switches is that the power required to switch between the two positions is quite high. If it were possible to modify this to remove the "threshold" you have to overcome to move to switch it would be easier to design a small actuator to control it.

For the cargo I was thinking about building a container car and have some sort of rail on top to move a crane to and fro. Your suggestion is obviously easier to implement, and would probably look more realistic.

Edited by Kolaf

Share this post


Link to post
Share on other sites
Using solenoids is a great tip, they seem to require less space allowing a more compact design, I just have to figure out what they are called in Norwegian to find them in a Norwegian store :)

The challenge with the Lego trains switches is that the power required to switch between the two positions is quite high. If it were possible to modify this to remove the "threshold" you have to overcome to move to switch it would be easier to design a small actuator to control it.

For the cargo I was thinking about building a container car and have some sort of rail on top to move a crane to and fro. Your suggestion is obviously easier to implement, and would probably look more realistic.

Have you considered using model railway point motors? They're quite easy to wire up, and are quite small, provided you choose the right ones.

Cargo wise, you'll have to build your hopper carefully for the operating mechanism. Another alternative is to 'revolve' the freight truck 180 degrees to a waiting storage bin - it has been done before, and is easy to hide if the unloading section is done as a large building, as most coal etc. unloading facilities are.

Share this post


Link to post
Share on other sites

Hi Kolaf,

have you taken your Train project already to the next level? I have an Arduino + LEGO robot now. Maybe adding an IR receiver / transmittor to it would be a nice idea.

Greetings Johan

Share this post


Link to post
Share on other sites
Hi Kolaf,

have you taken your Train project already to the next level? I have an Arduino + LEGO robot now. Maybe adding an IR receiver / transmittor to it would be a nice idea.

Greetings Johan

What kind of robot have you made?

Yes, I have started on a prototype engine. I have hooked a power functions XL motor through an ESC, together with an IR receiver and a distance sensor. I am able to control the train with my regular TV remote control, and the train slows down automatically when approaching obstacles across the track. When the obstacle is less than 5 cm away the train stops completely :)

I am working on refining the software, and also adding additional sensors to allow for more autonomous operation. Will get back with pictures and video later.

Edited by Kolaf

Share this post


Link to post
Share on other sites
What kind of robot have you made?

Yes, I have started on a prototype engine. I have hooked a power functions XL motor through an ESC, together with an IR receiver and a distance sensor. I am able to control the train with my regular TV remote control, and the train slows down automatically when approaching obstacles across the track. When the obstacle is less than 5 cm away the train stops completely :)

I am working on refining the software, and also adding additional sensors to allow for more autonomous operation. Will get back with pictures and video later.

A bit late, but better late than never... I made a line follower for educational purposes. It is almost fully functional now. But do you manage to detect signals from a LEGO IR sender? I used the train version. It seems to be not reliable using an IRM38BL ir receiver...

Share this post


Link to post
Share on other sites
A bit late, but better late than never... I made a line follower for educational purposes. It is almost fully functional now. But do you manage to detect signals from a LEGO IR sender? I used the train version. It seems to be not reliable using an IRM38BL ir receiver...

I used a regular TV remote control (a harmony 1 from Logitech). I haven't tried it with the Lego train transmitter, but I guess the same principles would work. I just used a simple ardunio IR library floating around on the web.

Share this post


Link to post
Share on other sites

Hi,

I have to try and complete my train control idea at some stage. I have one train built which uses a microcontroller onboard the train to control the motors and lights etc. I use RF modules for communications, they are basically wireless com ports all the addressing etc is controlled by software so there is no real limit to the amount of trains you can have. The track is powered can be powered up to about 36V but i keep it to 12V but i want to use 24V soon. The onboard regulators produce the 5V for logic and 9V for the motor. It works quite well, but havnt had the time to finish it and make smaller pcbs for the electronics.

For the 9V train motor i have separated the pickups from the front and rear axles and also separated the motor power, so i have 6 wires coming out of the motor. I have the pickups separate so then they are fed into separate bridge rectifiers then into the regulators, this way i can make reverse loops etc easily, just have to isolate the 2 sections of track so one set of wheels does not short them out.

I played around with DCC for a while but decided to go to RF, this way i can use my train on other 9V layouts and still have full control. Also the reason to go to RF was so i could have full 2 way communications between the train and the base. I havnt done so yet but i would like to add a speed sensor, temp sensor (inside the motor) etc, so the train can send this information back to the base. Also the range is much better with RF than IR, for a start you can use RF through walls if you wish, the modules i use have a range of 300m LoS, so its more than sufficient.

Its good seeing that others are trying different electronics with their trains, i know its not a lego solution, but i dont care. It makes it more fun.

Mike

Edited by skaako

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.