Hello there,
I've been doing some light design work for the signal lights at my club (AGHR in San Pedro), and thought I'd share design thoughts and results (so far anyways).
Right so we have 3 rail track and basically my understanding of what we have now is one of the two outer rails is isolated into sections and used to control the signal lights. The concept of operation is when the train comes, the locomotive (or lighted cars) have some internal connection between the two outer rails, and so the isolated rail becomes grounded, providing the return for the lights or control relay or whatever.
It seems in some locomotives this cross rail connection is not so wonderful and the train stutters and such. There are of course mechanical solutions, but having both rails grounded would be a big plus for reliable operation. Some people have suggested use of a non-invasive sensor like the BD20 which is magnetic based. It's a good approach, but there are some reservations about its ferrite core, which acts as a low pass filter. The sensor works on induction, detecting the magnetic field of the current passed through it. The catch is the core is magnetic, so it sort of has issues passing broadband signals (like DCS), though narrow-band ones like TMCC or DCC are probably okay-ish for short wiring. "Ferrite" is iron oxide and it has an upper cutoff frequency in the low MHz range (example from AD on this). Anyways our club has long sections and runs DCS, so was asking me to look into alternatives. One cute one I found was the AC712 (breakout available from sparkfun for 7$: here ACBB which is a sensor that works on the Hall effect.
Without getting into semiconductor physics derivation..., the hall effect basically says that when you run a current through a semiconductor the majority charge carriers experience local Lorenz forces and all shift to one side creating a potential across the cross-section of the semiconductor. Here's a relatively simple explanation Hall Effect. While its functionality is not terribly different than the BD20 or other magnetic sensors, one property I really do like is that it doesn't have a frequency response. The probe side of the sensor is essentially just a wire with no magnetic core, so fancy signals like DCS, DCC, TMCC.... will totally totally not be affected at all no matter how many sensor sections you put on the track.
So I'm not a salesman for Allegro who make the sensor, but I have to say it does work well. The sensor only has a transimpedance of about 180mV per Ampre of current, and it's a true linear transducer meaning DC current in gives voltage DC out and AC current in (like our club) gives AC voltage out, so you need some glue circuitry to drive a relay or the signal lights directly. This is where the light circuit design work comes in.
Adrian's Schematic version 1.0
Here is the basic schematic in ADS. So for simulation purposes I've modeled the sensor as a CCVS (current controlled voltage source), and the train is complicated so for now I've just modeled it with a resistor so that the the current is a few amps. One of the cool things about the AC712 sensor is it has a DC bias on the output, so even though the transimpedance is only like 180mV/A, it's biased ontop of a 1V common mode, so you can go into an envelope detector directly. (Normally you need like 0.6-0.7V to turn on a diode in a detector).
So what I did was go with a basic envelope detector circuit. 1N4002 diode for the rectifier, and then just a the filter R1/C1 which sets the time constant. By playing with R1 and C1 you can put a delay where the the output won't change instantly but takes 1 time delay (R x C) before the signal light toggles. This is helpful becasue if the train momentarily looses contact with the rails it won't cause the signal light state to flip. Sometimes if you use a relay control for the lights you can hear the relay chattering as the train loses momentary contact. if you use a solid state control element for the signal light... it can flicker if contact is lost. By adding this time constant (47K X 6.3us in this case) the signal won't change until the train is disconnected for a good 200-300ms, meaning the signal lights wont flicker (momentary disconnects I've measured are on the order of 10-100ms... which is how I picked the time constant).
Then to derive the control signal we just use a comparator against a fixed value set by voltage division of R2 and R3. You probably want this to be a trimpot so you can adjust it. (its a 100K trim in my prototype). Setting it lower or higher changes the current at which the signal trips (and is also related to the delay of course). Any time you generate a reference voltage it's good practice to band-limit it for noise reasons, which is the role of C2. For the opamp itself I went with the LM358 which is a fairly mature BJT opamp, Darlington input, miller compensated... usual stuff. It's able to run off a single supply so that makes life easier. It's output then just drives a 2N2222 that switches the relay (or your signal light directly if the current is low) on and off. Of course you don't want the 2N2222 to go into beta-collapse so you need base limiting (thats what R4=330 does).
So you can either run 5VDC around the layout to power these, or you can rectify & regulate the 5V off track power like everyone does when they put LED lighting in the passenger cars if you want less wires under the table.If you run lots of different track voltages that external 5V is probably better of course. If your layout is like ours and 18VAC 24/7 365 days a year, then rectification and regulation is probably okay. The sensor and opamp draw about 10mA total, so you don't need much of a heatsink on whatever regulator you use.
Right so here is a video of the first test showing both rails are grounded, that the switch ignores momentary disconnects... as well as that the frequency response is not offensively terrible to digital control (IE that high frequencies aren't filtered by the sensor creating problems for DCS-like control). Remember that even though the DCS signal goes down the center rail, the return for it is the other two rails, so they still have to support the bandwidth of the signal... My train wasn't available so I used a 20 ohm resistor for a first test (the locomotive is simulated at 1A draw)
In conclusion, lots of people have already figured out how to do signal light control, but I do have to say hall-effect sensors are probably the most non-invasive thing that could ever be used. Unlike magnetic approaches they don't impose a bandwidth limit so they are transparent to control signals, they have offset so they work with trains regardless if they draw large or small current, they have a very low series resistance (Again it's basally just a 0.1" inch wire in series) so they don't get hot, and they don't cost much. The module in the video is about $18 and 9 of that is the prototyping board.
Happy New Year!
~Adrian