Model train crossing signals

I’m building a new O scale railroad for the Little Buckeye Children’s Museum. Most O scale railroads, including ours, use 3 rail track. For several reasons, and without going into a long explanation, I am deviating from normal practice and putting DC on the rails. One way of actuating flashers at a road crossing is to use an isolated section of rail, a separate power supply, and a relay (see the diagram below).

The manufacturer of the crossing signals sells a flasher unit for about $120, but I can make one much cheaper with an Arduino and a very simple program. What I am curious/concerned about is whether it would be safe to connect the Arduino ground to the track power supply ground (in place of the accessory power supply in the diagram) and a digital pin to the isolated section of track. The alternative would be to use the relay circuit as shown and connect a relay contact to the Arduino.

My gut says don’t connect the Arduino directly to the track, but I’m curious what others think.

You do know the Arduino GND is connected to earth ground when you use a PC USB connector ?

Yes you can connect the Arduino GND to the track power supply GND (which is DC).

I suggest you use either an NPN transistor CE switch to the third track OR an optoisolator then to the Arduino input.

Looks like fun !

I agree with @LarryD

Know that this way of running trains is a bit more dirt sensitive as one rail is not supporting the powering.

I run Marklin trains on K tracks and a signaling like Yours. I've used stuff from Littfinski Daten Technik. Unfortunately it looks like the old knowing owners sold their business to cashier only knowing people.
To the point. Their train indicating system uses opto couplers but sometimes extra pullups are needed. Don't underestimate how track length, length of the section, affects noise levels etc.

Make a principal drawing of the train presence detection You intend.

Did not know, hadn’t thought about, the Arduino ground being connected to earth ground. Probably would not connect it to the track while powering from the USB port though.

Although I’m a ham and pretty good with electronics, I spent a career doing motor control with relays. Sometimes I forget about using electronic parts like transistors and opto isolators instead, thanks for the reminder.

I am aware of the dirt problem. Our current layout is AC powered, but only on 2 rails (not my doing). I have built a couple of HO layouts for me and those only have 2 rails, so I think it will be okay if we keep the rails clean.

Good advice.

If it was me, I would remove the relay, use the LED in the opto .
Connect the opto transistor to the Arduino input.

Make sure you have bounce suppression, either hardware or software or both.

I've got 3 cleaning wagons that are pulled around to clean. One has a vacuum cleaner(!) and 2 polish the rails. German stuff, some 250 USD each.... Can't get the name out of my mind right now. Good company, yellow cars...

Relays ought to work, use more current but are likely less noise sensitive. I've got 150 sections... Using 100 mA per section would be heavy..

Be careful! Know that a missing contact with the "AC GND" will affect the detection circuitry! Even very short missing contacts can be bad!

Reply #6 is my preferred way to go, with added ‘debounce’ awareness, that will be the simplest, and easiest way to ignore track dirt.

One Arduino could service multiple track sections)

(It could be even simpler, using a ‘retriggerable one-shot’ driving the accessory, Your choice)

The $120 isn’t much in real world terms, but if you include your time & labour cost, it’s probably going to cost about the same in the end.

The choices are yours.

After you mentioned opto isolators earlier, I already decided to go that way, 4N36 probably.

Looking at CMX Clean Machine. Good reviews.

You’re probably right about the cost, but I’m a volunteer, somI don’t get paid!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.