I am trying to interface lionel switches with an Uno to display LED lites on my control panel. I'm using a 12 VDC power supply for the Lionel track switches and tried using a voltage divider with R1=15K and R2 using 10K. This gives me 4.9 VDC for the UNO's inputs. I connected the commons of the 12 VDC supply and the UNO together. However, when the momentary toggle switch to operate the Lonel track switch is closed to change tracks, I get the 4.9V, but when I release the switch, somehow the voltage climbs to 12 V at the center of the divider.(to the UNO Input), which smoked my input terminal)... Perhaps the solenoid in the Lionel switch is affecting my divider? I measured 9.8 ohms from + 12V to the "straight" terminal and the same for the "curve" terminal. I tried attaching a pdf showing my connections, but the site will not allow me to attach.
Any comments would be greatly appreciated.
My next step would be to use relays, but I thought this would be effective and cheaper. Brindude
IIRC Lionel ran everything on AC from the transformer. Using 12VDC should be okay. The switch tracks use solenoids to actuate the mechanics. You need reverse polarity protection diodes on the control circuits to protect the UNO inputs.
Please read and use this link: How to get the best out of this forum - Development Tools / IDE 1.x - Arduino Forum
Search the forum for other posts re model RR setups.
Hello brindude
Welcome to best Aruino forum ever ![]()
Use an optocoupler device to electrically decouple the two systems, simply.
Hi, @brindude
Welcome to the forum.
Can you post a diagram of the power supply, switch, and potential divider and how you connected your UNO.
A picture of a hand drawn circuit in jpg, png?
Hand drawn and photographed is perfectly acceptable.
Please include ALL hardware, power supplies, component names and pin labels.
How, the only connection to the centre of the potential divider should be the UNO input?
Thanks... Tom....
![]()
This is inductive flyback. An inductive load such as a solenoid essentially stores energy in the magnetic field, when disconnected the magnetic field collapses and generates a voltage in the opposite direction. This voltage spike can be significant.
In general, never connect an inductive load directly to a digital circuit, use a switching device such as MOSFET or transistor. Even better, use an opto-isolator to isolate your digital circuit from "noisy" components like solenoids, motors etc.
If you are monitoring a voltage, you need to ensure the voltage never exceeds a limit. A zener diode would help, but more sophisticated circuit may be necessary. There are also specialized ICs available for voltage sensing which are designed to be robust and safe to connect to digital circuits.
Thank you for responding to my post. Makes sense.
brindude
Thanks for your response to my post, I’ll try that.
Brindude
Hi, @brindude
Please study this part of your schematic.
Look at connection 3, with the turnout switch closed, con 3 is grounded, so D3 gets the potential division between con 3 (gnd) and 12V.
With the turnout switch open, con 3 is connected to 12V through the turnout coil, there is no potential division, so D3 has 12V applied to it as well as the back EMF of the turnout coil as the switch opens.
The same for connection 12.
Using an opto-coupler and suppression diodes would be the better way to go.
Tom....
![]()
PS, The other problem I see is what you turn your project on, how does the code know what position the "point" is in, sorry GWR (Gods Wonderful Railway) fan.
TomGeorge,
Thanks for your reply . Yes, I see now what is happening. This will be better if I use a couple of 8 point, opto-isolator relay modules. For the 8 Lionel switches.
As far as the loss of switch positions when powering up, Yes, I am aware. I believe I have a couple of options. 1 – a battery backup, 2 – toggle each switch upon startup, 3 – keep the Arduino on. And toggle switches after a utility power failure. I can live with that.
I just read an article yesterday that uses a 10K resistor in series with a 12V supply connection to the Arduino input. I’m going to try that first by removing the voltage divider and placing a 10K resistor from the Lionel @ point 3 and a 10K from Lionel #@ point 1 to the Arduino input. It may be worth a shot. I’ve already damaged digital point 2 on my Uno, so we’ll see. Do you see a problem trying this?
Thanks again,
Brindude
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.

