Auto Reverse for O Gauge (“Lionel”) Trains in Conventional Mode

by rickkeil in Circuits > Electronics

254 Views, 0 Favorites, 0 Comments

Auto Reverse for O Gauge (“Lionel”) Trains in Conventional Mode

IR sensor.jpg
IMG_5043.JPEG
IMG_5045.JPEG

This Instructable is to create an automated reverse for 3-rail o-gauge toy trains that are run in conventional (non-computer controlled) mode. We will use two infrared sensors (IR sensors) to detect when the train reaches the end of the line, a relay to transmit that information to a timer system, and an automation cycle delay timer that will reverse the train and send it back the other direction after a pre-determined delay. 

You don’t need this - there are multiple better solutions on the market. Bump-n-go trolleys are an easy way to set up an out-and-back system. MTH systems with PS2 or newer will do this using the software built into the trains if you are in DCC (digital command control). If you run conventional mode, the best solution is to buy a reversing unit from Z Stuff for Trains. I’ve used their DZ-1240 Auto Stop & Reverse Module, but I burned it out when a train derailed and shorted the unit out. I was about to buy a new one but then decided to tinker around myself and have some fun figuring it out. Unless you really enjoy tinkering, don’t follow this Instructable. Instead go by the Z Stuff for Trains unit!

None of this Instructable is my idea, I just merged several threads on the OGR Online Forum and figured out the missing pieces myself. Kudos to “Stan2004” who worked all this out way before I tried to implement it. You can find Stan2004’s videos about this topic on Youtube.

Supplies

FXPBBQGLQUXKLEF.jpg

You will need:

  • IR sensors to detect when the train reaches the end of the line. They are about $1 each if you buy on AliExpress (and are patient with shipping from China), or a little more on Amazon. Buy three in case you burn one out while wiring all this up.
  • A wall wart that puts out 6-24 volts DC current. You probably have one of these already.
  • An L7805 voltage regulator that will convert some of the voltage from the wall wart to 5 volts needed for the IR sensors. If you don’t have one, get a pack on Amazon for about $6 or a few from AliExpress.
  • A relay module, about $5 on Amazon but again you have to buy more than one. If you only want one, buy on AliExpress.
  • An automation delay timer, about $14 for two on Amazon.
  • Misc wire in black, red and a third color
  • And optionally, a blank PC circuit board if you have one, and some screw mount terminal blocks and maybe an on-off switch and a LED so you know you have power. 

How To

When the train reaches the end of the line, it needs to be detected, stopped and reversed.

For detection, we could use the classis isolated outer rail approach. When the trains wheels ground that rail, it would trigger the timer. Stan2004’s video shows this approach. This didn’t work reliably for me, I think because the AC current and any imperfections in the track and wheels kept retriggering the timer. I needed something more stable.

Infrared detectors are popular because they can sense when something approaches at distances from a centimeter out to 20-30 cm (quarter inch out to about 10 inches). If nothing is approaching, they pass their 5v signal onward. When something approaches, the sensor drops the voltage to zero.

If we place an IR sensor at the end of the line it can detect when the train arrives. Now we need to transfer the signal to the timer relay. The problem is that the timer we will use needs to “see” a voltage arrive (e.g. the signal needs to rise from zero to something like 3-5V), but the IR sensor turns the voltage off when it senses the train. There are probably lots of ways to solve this problem. I used a relay that accepts a low level input, meaning that the relay will trip when the signal voltage drops, which is what the IR sensor will provide.

Now we send the relay signal to the timer. To do this we will set up the timer so that it isn’t getting a voltage signal to its trigger until the relay grounds the trigger. If that doesn’t make sense, look at the diagram – we are feeding the timer’s trigger with voltage and allowing it to ground when the relay trips.

Now the timer has to do its thing. Specifically, it needs to stop the train by turning off the current for a second or two, then power it up into neutral, then stop it again for a second or two, then start the train up in the other direction. [Note that this Instructable works only if the train has a classic reverse unit in it that cycles between forward, neutral and reverse] 

The automation timer has several settings, you can learn about them by reading the attached instruction sheet (download it below) or watching YouTube videos about them. We will use setting 3.1 and tell the timer to stop the train for 1 or 2 seconds, wait for 5 seconds at the stations, and then repeat. The repeat sets the train off in the return direction.

That’s it really, now you just have to go and wire it up. However, in case you have never used an automation timer before, here is a little help to set it up:

  • Power it up
  • Press the set button for 2-3 seconds until it flashes and lets you set the P mode. Use the up and down buttons to get to setting P3.1 and then press the set button once.
  • Now tell it how many seconds to keep the train off, I use a setting of 1-2 seconds depending on which train I am running. 1 second is a good initial time to try. Then press set again.
  • Now tell it how long to wait at the station. I let the train wait for 5 seconds. Don’t set it for longer than the time it takes the train to go back to the previous station or your timer won’t be ready before the next signal comes in. Press set again.
  • Now tell it how many times to repeat the above 1 and 5 second routine. Set this to two. Press set and hold for 3 seconds. Now it is ready!

Note: if you set the repeat function to infinity, the train will run forward for 5 seconds, wait for 5 seconds, reverse for 5 seconds, wait for 5 seconds, run forward for 5 second ad Infinium.  

The Wiring Diagram

IR reverse unit diagram.jpg

This wiring diagram is the key to everything. Use the NC and COM parts of the relays. NC stands for ‘normally closed.’ If you look closely you will see that the IR sensors and relay are running on 5V, the timer is getting 6-30V and the AC for the trains is isolated.

Thanks for reading. Buy the Z Stuff version and save yourself the tinkering, and happy railroading! Reply here if you have questions.