Trains.com

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

DC turnout-controlled signals

5939 views
23 replies
1 rating 2 rating 3 rating 4 rating 5 rating
  • Member since
    August 2014
  • From: CO
  • 265 posts
DC turnout-controlled signals
Posted by pt714 on Tuesday, September 2, 2014 7:41 AM

Hi all,

I'm planning to run a DC layout and will have manually-thrown, electrified-frog turnouts. I'm thinking about setting up a signal system where the turnout is thrown by hand and the polarity of the frog determines the aspect of the signal. This is easy enough to do with simple reversible red/green LEDs, but I also want to be able to change aspects based on direction, which seems to complicate things...

I have an Arduino that might be good for sending commands to different signals, turning them red, green, yellow or lunar based first on direction from the DC powerpack and then second on input coming from the frogs. But I can't figure out a good way to wire the frogs to the Arduino, since their polarity will keep changing. Do I need something like a pair of opposite-faced diodes in parallel to divert different polarities to input/ground? Has anybody used Arduino to control their signals?

 

Thanks,

P

  • Member since
    January 2007
  • From: Eastern Shore Virginia
  • 3,290 posts
Posted by gandydancer19 on Tuesday, September 2, 2014 9:54 AM

I havn't used or worked with the Arduino system, but isn't it a programable computer chip?  If so, why can't you set up the frog polarity as an input to the chip that will sense the positive or negative voltage?  (If input pin 1 is positive, do this, if not, do that.)

Elmer.

The above is my opinion, from an active and experienced Model Railroader in N scale and HO since 1961.

(Modeling Freelance, Eastern US, HO scale, in 1962, with NCE DCC for locomotive control and a stand alone LocoNet for block detection and signals.) http://waynes-trains.com/ at home, and N scale at the Club.

  • Member since
    August 2014
  • From: CO
  • 265 posts
Posted by pt714 on Tuesday, September 2, 2014 11:12 AM

It is a programmable chip, but the current going in and out of it is DC. The issue is that the digital pins can be programmed either as sink (other end is +) or source (other end is -), but not both at the same time AFAIK. Reverse current in the wrong place could fry the chip. I figured that a diode could be hooked up to prevent one polarity from reaching the pins, and another diode in parallel could direct that flow to ground-- thus the pin would read either voltage or nothing and use that difference to set the signal aspect. If there's a way to take the +12v/-12v range from the frog and change it to +5v/0v, that would work too.

 

P

  • Member since
    August 2014
  • From: CO
  • 265 posts
Posted by pt714 on Tuesday, September 2, 2014 11:23 AM

Edit: I remembered soon after hitting 'Submit' that sourcing/sinking only applies when the pins are in output mode. I'm still unsure, though, whether the pins in input mode can take both positive and negative current, and if so, whether they can differentiate between the two or if it just reads voltage amount.

P

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Tuesday, September 2, 2014 2:16 PM

 If only - it needs a little more work than that. The inputs are either digital, with voltage above a certain threshold indicting a 1, and below it, a 0, or analog, but only in one direction - 0-12 say. If you apply -12, it will either fry the chip or just not work at all.

 You will also need to restrict the voltage to the chip to no more than 5V, so each input will need a voltage divider. Use two pins, each with a diode and voltage divider, each has the diode wired the opposite way. One will turn on if goign forward, the other will turn on if going reverse. You can tap the power anywhere near the turnout for the direction and then use switch machine contacts for the point direction. Now you have your data to compare to activate the approriate signals - you have the direction the turnout is lines, and the directiont he train (should) be going.

 If you don;t understand what a voltage divider is - read up on that, there are mentions on many Aurdino forum posts. Google some of what you are trying to do, someone else has very likely already done something similar with the Aurdino. If you don't understand what a voltage divider is and why you need it, I'm afraid you'll be frying some Aurdino chips. And they are not as tasty as potato chips.

                      --Randy

 


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    August 2014
  • From: CO
  • 265 posts
Posted by pt714 on Thursday, September 4, 2014 8:10 AM

Arrgh... My posts were sent way after I submitted them. When does the trial period end for new members?

Randy, the voltage divider is a good idea-- I'll hunt down some bigger resistors. I think I could get away with just one pin, though, since it will read either voltage or nothing, and the binary logic could then set up two different aspects. That saves me from using too many pins as it's an Arduino Uno and doesn't have as many I/Os as the bigger chips. There would still be a second diode, but the line would then go through a pulldown resistor and then to ground. Does that seem feasible?

P

  • Member since
    January 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Tuesday, September 9, 2014 5:24 PM

Think you're over-complicating things here.  

OK, yes, using an arduino would be fun -- but at near $20 per board, you're gonna be shelling out a lot of cash to wire them all in (unless, ofc, you've only got one turnout).

It's been ages since I've bread-boarded things ... but there's gotta be a simpler way with generic off-the-shelf RadioShack parts that'll end up costing you less per unit than an Arduino.  I'll try throwing something together for you ... 

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    August 2014
  • From: CO
  • 265 posts
Posted by pt714 on Tuesday, September 9, 2014 6:59 PM

Well, the Arduino is already in my possession-- I had it for some other electronic experiments-- so it's not really any extra cost on my part. But if you've got a simpler way to set them up, I'm all ears! 

I figure without the Arduino I could use basic diode logic to switch LEDs on a red/green bi-color (three-lead), or a bridge rectifier to keep the red one on regardless of polarity, if I want yellow instead of green. This is fine since all of my lights will either be red-green or red-yellow, no tri-color ones. But then what happens when you switch direction from the controller? The polarity is already used to change the switches, so what do you use to get the other signal states?

What I need, ultimately, is basically something like this crude diagram where there are four states for the signals: one for each direction and each turnout position. The two left signals face left, the double one on the right faces right, and the arrow indicates train path and direction:

<---R----G/R---

      R

 

      R     /--R/G---

<---R--/

 

  ---G-----R/R--->

      R

 

      R      /-----R/R--->

  ---G---/

 

 

P

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Tuesday, September 9, 2014 7:46 PM

 COuple of tips for driving lots of LEDs with few pins - LEDs are diodes, so you get the diode logic built in. An output pin can be high or low, so unless you want a 'dark' aspect, you cna wire one LED between + and the pin, and one between - and the pin. When the pin is set high, the LED between the pin adn ground comes on, when the pin is low, the one between + and the pin comes on.

 You cna take this MUCH further - look up 'charlieplexing'

 As an example, the Digitrax SE8C can drive 32 signal heads, each with 3 LEDs. 4 heads, 12 LEDs, from each 10 wire cable - and 2 of those pins are + and - voltage.

 Yes, this greatly complicates the code for the Aurdino, but depending on which one you havem you may not have enough pins to make them all discrete connections. And in any case, if you were going to do that, some simple transistor logic would suffice. For that, there have been many circuit published in various sources - there are some in Electronic Projects for Model Railroaders, and I'm sure there are some on Rob Paisley's site. They all work pretty much the same way, a set of inputs determines which outputs turn on to light up the proper signal aspect.

                 --Randy


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Tuesday, September 9, 2014 8:04 PM

there are three parts to your problem:
- providing an electrical signal indicating the turnout position
- driving the red/green signal LEDs
- logic to determine the signal aspect depending on turnout position


with manually controlled turnouts and not having something that routes power to the frogs (like I have), you might have to look at the voltage on the rails to determin the turnout position.  This is complicated by the fact that DC makes both polarities possible.  An opto-isolator with back-to-back diodes NEC ps2506) allowing bi-polar input would work by monitoring the voltage on the frog and stock rail.  In the the one case, both rails have the same voltage.  In the other case there is a voltage difference, but because it's DC it can be either + or -.   An Arduino doesn't help solve thie problem.


i'm not sure what you mean by reversible red/green LED.  I think it means the LEDs are wired opposite one another so that the one LED is lit with one polarity, and the other lit when the polarity is reversed.   Reversing the polarity is not that easy.  Having two separate LEDs would be easier to control since you would be able to apply power to one or the other.  In either case, you would like a circuit where a high or low input signal controls the signal.  There are 3 terminal LEDs having both a red and green LED in the same housing, which can be yellow if both are powered.   Again, an Arduino is no help.

There not much logic needed (where an Arduino could help) assuming you have a turnout detection circuit that outputs a high/low voltage to indicate the turnout position, and a signal circuit that takes a high/low input to control the signal.   The signal logic just needs to drive either the red or green signal LED to match the turnout indication.   And this should also work find with signals in both directions.


an Arduino could be helpful if signal aspect is determined by both turnout position and block occupancy, and further complicated for an yellow signal indicating the following block is red.   But i don't see why a PIC processor couldn't simply be used.    While the processor may be optional, the interface circuitry to the turnout and signals is not.

greg - Philadelphia & Reading / Reading

  • Member since
    January 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Wednesday, September 10, 2014 4:53 AM

pt714

Well, the Arduino is already in my possession-- I had it for some other electronic experiments-- so it's not really any extra cost on my part. But if you've got a simpler way to set them up, I'm all ears! 

 

Right -- you have ONE Arduino.  

Problem is, if you have one turnout over here ... and another one 10 feet over there, things get ugly fast (even with Randy's "connect multiple LEDS to one set of pins" setup).

The other (awful) problem you're going to run into is the variable input voltage caused by the fact you're (as I understand it) trying to drive it off the power leaving the pack (or at least use that as an input) -- which means that you're going to be putting in somewhere between 0 and 12 (or 14?) VDC into the circuit.

 

Now, I've got one that doesn't care about input voltage (at home, apparently forgot to put it on the internet - oops).  I'll put it up later so you can see what I came up with.

 

edit -- nope, I just put them on google:

 

Through Route

Diverging Route

 

The SPDT switch can either be your throw itself (IIRC, Caboose Industries has some like this), or if you're using piano-wire pulls through the facia, then drill a hole through the switch and put your linkage through it.

12VDC is simply your typical lights/accessories bus, and the 1K Ohm resistor is to drop the voltage so you don't blow the LEDs.

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    August 2014
  • From: CO
  • 265 posts
Posted by pt714 on Wednesday, September 10, 2014 10:27 AM

Randy, thanks for the tips and leads. I looked up the signals on Rob Paisley's site-- I'll have to look closer, but the simpler ones seems to show some promise. I've been looking up using shift registers to run multiple LEDs-- with an outside power source to boost current and protect the Arduino, it looks like it could work very well for what I want.

Greg, turnout position will be indicated from the frogs, which will be powered via the Caboose Industries throws Dan just mentioned. I'm confused by your circuits, though-- wouldn't the signal circuit and the turnout circuit have to interact, since both determine together which LED should come on? And I'm still fuzzy about how this works if direction switches, because then turnout polarity is reversed and high/low becomes low/high.

Dan, I'm not sure I understand why I would need multiple Arduinos to run multiple turnouts this way. I should point out that the layout itself will be quite small (6'x9'). There will be just 8 turnouts affecting signals, but a few of them will be positioned such that the polarity of two frogs will determine which signal changes from its default of red (e.g. when two turnouts diverge off the main in quick succession). The Arduino would then get 9 inputs (8 frogs + direction) and a further three pins could be sent to a shift register series to drive the LEDs.

Only one of the LEDs will change at a time, because only one path will be allowed based on the direction/frog polarity variables, so it should be possible to either use the Arduino in 'if-then' logic to sense the direction and turnout inputs and turn on/off the correct signal LED, OR to use diode/transistor logic to do the same thing without the Arduino. I'm new to this stuff and just can't clearly visualize it yet...

You're right, though, about the variable voltage that would be coming into the Arduino-- all 9 inputs would be VDC, and I think that's why I was having such a hard time figuring out how to work in the input. The circuits you provided are great for just the turnouts, but since switching direction will reverse the polarities from the turnout as well, instead of both signals showing red (because the train will be travelling through the turnout in the opposite direction), one or the other will still stay green. There has to be a way to set up a logic circuit that accounts for both direction and frog polarity (or two frog polarities, as I described above.)

P

 

 

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Wednesday, September 10, 2014 11:19 AM

pt714
turnout position will be indicated from the frogs, which will be powered via the Caboose Industries throws Dan just mentioned.   I'm confused by your circuits, though-- wouldn't the signal circuit and the turnout circuit have to interact, since both determine together which LED should come on?   And I'm still fuzzy about how this works if direction switches, because then turnout polarity is reversed and high/low becomes low/high.

Sorry, i forgot that you said this was DC, and yes, a turnout position circuit could directly drive a signal circuit (san Arduino).

I assume you will have a signal circuit that properly drives the LEDs based on a single input (see below).   I assume there are four signals.

it's not obvious how you plan to determine turnout position from the frog.

i tried describing how by comparing the votlage between the frog and either of the stock rails.   there are three possiblities, +/0/-.    0 volts between the frog and stock rail means the frog is at the same voltage and the points are aligned with the other stock rail.   +/- means the points are aligned with that stock rail and the polarity indicates the direction of travel on a DC system.

a single-LED opto-isolator could be used to detect a particular turnout position and direction.  4 opto-isolators (or something equivalent would be needed to all four possibilities.  each would control one signal.  two would be connected oppositely across each stock rail and the frog.

because opto-isolators typically have a simple transistor output, the LED drive circuit can have an input that is pulled high by itself.   The opto can be wired into it to pull the input low which should turn on the green aspect.

there should only be one condition where an opto is active: when ther voltage across the frog and stock rail is not zero and of the correct polarity to match the LED/diode in the opto.   In other words, only one opto is active and only one signal is green.

 

greg - Philadelphia & Reading / Reading

  • Member since
    January 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Wednesday, September 10, 2014 12:19 PM

pt714

Only one of the LEDs will change at a time, because only one path will be allowed based on the direction/frog polarity variables, so it should be possible to either use the Arduino in 'if-then' logic to sense the direction and turnout inputs and turn on/off the correct signal LED, OR to use diode/transistor logic to do the same thing without the Arduino. I'm new to this stuff and just can't clearly visualize it yet...

Thing is, that's making the wiring overly complex, not to mention needing to putz about with programming the arduino in the first place.

Even though the train is running "the other way", you can still have the other LEDs on. Actually, this is closer to how the real railroads do it (you always know the position of the switch from either end (regardless of which direction you happen to be heading).

pt714

The circuits you provided are great for just the turnouts, but since switching direction will reverse the polarities from the turnout as well, instead of both signals showing red (because the train will be travelling through the turnout in the opposite direction), one or the other will still stay green. There has to be a way to set up a logic circuit that accounts for both direction and frog polarity (or two frog polarities, as I described above.)

 

I think you're misunderstanding what I did.

The input power to these circuits is completely disconnected from the track power -- you'd use (for example) a 12v "wall wart" that provides a constant 12vDC to a separate bus that these circuits (or lights in structures, etc.) are attached to -- typically this is called "Accessory Power" (Many DC powerpacks have connectors for this, but using them means you have less power available for locomotives).  

This is LOADS easier than trying to putz about with voltage regulators (and other bits) that you'd need if you were trying to drive these off track power, since you ALWAYS need a static input voltage (e.g. 1.5 or 3.3v for an arduino pin, or 2v for a LED) -- too low, and things won't light.  Too high and you let the smoke out. Not to mention, you've got to get polarity right -- even if a LED (or the Arduino) can handle 3vDC going "the right way" -- it might burn out with as little as 1v going the wrong way.

 

 

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Wednesday, September 10, 2014 7:09 PM

pt714
And I'm still fuzzy about how this works if direction switches, because then turnout polarity is reversed and high/low becomes low/high.

four opto-isolator circuits can detect the turnout position and direction.   This depends on DC power being present, meaning the signal is red when the DC power is insufficient to be detected.   (not sure signal aspect should depend on direction).

I don't know about a circuit to drive the signal LEDs, except to assume that pulling an input low should be adequate.  an NE555 circuit could be used to detect the opto output and drive either of two LEDs.   Of course an Arduino could be used, but would be overkill ($20 vs $1+).    (you need to use the riht tool for the job.   I write embedded RF SW for Qualcomm)

bear in mind that high/low (1/0) typically means Vcc/Gnd, not +/-.   The opto circuit translate a +/- into a 1/0.

greg - Philadelphia & Reading / Reading

  • Member since
    January 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Wednesday, September 10, 2014 8:08 PM
Greg, that looks interesting, how does it handle the variable input voltage? I mean, you're gonna be between 1 and 12vdc (or whatever a dc pack puts out), depending on speed of the train.

Wouldn't that cause some degree of havoc with the circuits you've drawn?

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Wednesday, September 10, 2014 8:57 PM

 That's what the optoisolators are for. Basically electronic switches. The resistors control the current that gets to the optoisolator's LED, once it gets past a certain threshold, it turns the transistor on, lighting up the signal LED. So they probbaly won;t light up if you just crack the thtorrle, but at full throttle it won;t exceed the limit of the optoisolator. Choice of resistors depends on the spec of the chosen optoisolator.

 At this point, it really is MUCH simpler just to use switch machine contacts. If you aren't using switch machines with contacts (ie, Tortoise), just rig a microswitch that contacts the throwbar or some part of the mechanism. If you need more contacts to activate all the LEDs, you can have it trigger a low power relay. But with SPDT contacts and a bipolar power supply (+V, -V, and ground) and some plain diodes, a single SPDT conact can do what you need.

                       --Randy


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    January 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Thursday, September 11, 2014 4:24 AM

Thanks Randy!

 

So essentially, if he's running his signalling off the track power, it won't turn on til (for example) he's hit 5 or 6 volts coming out of his powerpack.

 

On top of that, assuming each circuit burns 1.5V and 100mA (again made up), he's going to see lower top speeds out of his locomotives and/or the powerpack won't be able to power everything that's running... right? (ugh, I really have to brush up on "how DC series and parallel circuits work".)

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Thursday, September 11, 2014 5:02 AM

NeO6874
if he's running his signalling off the track power, it won't turn on til (for example) he's hit 5 or 6 volts coming out of his powerpack.

randy's correct, both with his analogy to a switch and that having a micro-switch tied to the turnout control is probably simply.    (I don't think the signal aspect should depend on direction).

but the signalling doesn't need to be off track power (even if they had a common ground).    Any diode needs at least ~0.7V to conduct.  with the resistor something > that is needed to turn-on the opto transistor.  But that transistor can be connected to an entirely different power system (wall wart) which is not affected by power to the track.

does anyone have a simple circuit that controls 2 LEDs with a single input?

greg - Philadelphia & Reading / Reading

  • Member since
    January 2006
  • From: Northeast OH
  • 2,268 posts
Posted by NeO6874 on Thursday, September 11, 2014 5:45 AM

gregc

does anyone have a simple circuit that controls 2 LEDs with a single input?

 
Something like what I posted before?
 
input is 12VDC (wall-wart, etc), runs through a SPDT switch to light 2 (well, 3) 2-color LEDs based on whichever way the switch is thrown.
 
As drawn, it's manual (e.g. linkage to knobs on the fascia, or Caboose Ind. ground throws with contacts), though I'm sure a switch machine's contacts could be used instead.

-Dan

Builder of Bowser steam! Railimages Site

  • Member since
    February 2002
  • From: Reading, PA
  • 30,002 posts
Posted by rrinker on Thursday, September 11, 2014 6:39 AM

 Back at the beginning he said these are manual throw turnouts, so the microswitch is about the only option. But that is a whole heck of a lot simpler than an Aurdino.

 I need to draw this in somehting I can upload, but if each signal head had 2 LEDs antiparallel, one side connected to the common, the other side to the center of the microswitch, and one side of the microswitch was connected to the + side of a bipolar power supply, and the other side to the -, one LED would light whent he switchw as thrown one way, and the other LED when it was moved tot he other position. So a signal head on the point side would have a green and a yellow LED, green for straight through, yellow for diverging. The signals on the straigh and diverging frog side would have red and green (could use a 2 lead bicolor LED for those) and the side that the turnot was lined for would show green and the other red. Or maybe better on the diverging side, yellow and red.

 About as simple as you get, and all you need are a SPDT microswitch, some LEDs, 3 resistors approriate for the power supply used, and a pair of 9V or so DC wall warts connected in series - the connection point is the common and you get +9 between common and the free + lead, and -9 between the common and free - lead.

                     --Randy


Modeling the Reading Railroad in the 1950's

 

Visit my web site at www.readingeastpenn.com for construction updates, DCC Info, and more.

  • Member since
    July 2009
  • From: lavale, md
  • 4,678 posts
Posted by gregc on Thursday, September 11, 2014 7:13 AM

 

greg - Philadelphia & Reading / Reading

  • Member since
    August 2014
  • From: CO
  • 265 posts
Posted by pt714 on Saturday, September 13, 2014 8:43 AM

Thanks, all, for the answers, schemata, and the lively discussion. :-) I've ordered some opto-isolators and a few other components to tinker around with. I'll try a couple of different circuits out and see what seems to work best.

P

  • Member since
    July 2006
  • From: North Dakota
  • 9,592 posts
Posted by BroadwayLion on Saturday, September 13, 2014 9:16 AM

You have gotten lots of good answers, the likes of which the LION did not read.

There are two kinds of signals on a layout.

1) HOME or interlocking signals. These are controled from the tower, and you may simulate this function by tying them onto a switch, or you may place that signal on a separate lever in the tower. LION does both.

2) BLOCK signals. These are fully automatic, depend on train detection, and indicate how close the train that you are following is. Obviously, if you are on a singal track and a train is approaching you, the HOME signal would not have permitted you to enter the track.

LION has extensive automatic block signals on the layout of him. LIONS do not understand mysterious little black IC chips, nor even vacuum tubes for that matter. LIONS like switches that go CLICK. Therefore him builded the layout of him with RELAYS. More than 100 of them (two for each block), and reed switches embedded in the tracks that respond to magnets on the bottom of the trains.

Here is "motherboard" of LION.

Each block requires five conductors between the mane board and the block to be protected. These are:

1) Detection signal
2) Red Signal
3) Yellow Signal
4) Green Signal
5) Track relay (which isolates the block in the face of a red signal)

I tried to do this broject by mounting the relays along the layout, but I used just as much wire, and it was more difficult to troubleshoot, thus the board above.

What the Heck: It works, did not break the bank, and is withinin the capabilities of the LION.

ROAR

 

The Route of the Broadway Lion The Largest Subway Layout in North Dakota.

Here there be cats.                                LIONS with CAMERAS

Subscriber & Member Login

Login, or register today to interact in our online community, comment on articles, receive our newsletter, manage your account online and more!

Users Online

There are no community member online

Search the Community

ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT
Model Railroader Newsletter See all
Sign up for our FREE e-newsletter and get model railroad news in your inbox!