Skip to main content

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

schematic_1

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).

Time_domain_response

 

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

 

Attachments

Images (2)
  • schematic_1
  • Time_domain_response
Videos (1)
Sensor_progress2
Last edited by Adrian!
Original Post

Replies sorted oldest to newest

Adrian! posted:
...

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....

In 3-rail which you apparently have, that "internal connection" is each steel wheel axle! 

One issue with using current sensing for occupancy detection (e.g., for signals) are non-powered cars like freight or unlighted passenger cars.  Also, with LED passenger cars the current draw per car can be as low as 10 mA.  So in HO the wheels are electrically isolated so to use the current-sensing scheme you install special wheel axles with an embedded resistor to draw current between the outer rails.  I am not aware of anyone who makes such a wheel axle for 3-rail O-gauge.  Adding powered trucks with center-rail roller pickups on every unpowered car to install an internal load resistor would not win you points at the club.

One approach is to make each current-sensing block longer than the longest consist and then insure that you have a powered device on each end - say engine and lighted caboose.  This also might not go over well with the club since running just an engine would tie up the entire long block no matter where it was on the block.

Don't get me wrong, the ACS712 is an interesting device  But to your point about 180mV/A, note that this works fine for engines but lighted passenger cars with LEDs can draw less than 10 mA so now we're talking 1.8 mV which gets to be tricky given typical DC-offset errors in any DC-biased output device.

Have you taken a look at the so-called inductance-to-digital converters introduced by T.I. about 5 years ago?  So rather than detecting power consumption (as a proxy for occupancy) these devices detect changes in inductance - or basically like those loops that detect your car at a traffic signal.  I'd think a coil of wire about the length of 1 track section and placed under the track section could be used with one of these inductance sensor chips and would sense the presence of the steel trucks on engines and cars whether powered or unpowered.  And of course this would be agnostic to the type of track power used - including battery-powered engines.

http://www.ti.com/lsds/ti/sens...ensing-overview.page

Inductance sensing of course is nothing new but these chips make it easy to apply.  Likewise, Hall sensing devices have been around for a long time; the ACS712 makes it easy to apply.

BTW, as has been discussed in other OGR threads (about making a track-current meter), you can get ACS712 modules on eBay for $1-2 (free shipping from Asia).  In that case it's the galvanic isolation of the ACS712 module which is a key benefit of Hall sensing.

stan2004 posted:
Adrian! posted:
...

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....

In 3-rail which you apparently have, that "internal connection" is each steel wheel axle! 

One issue with using current sensing for occupancy detection (e.g., for signals) are non-powered cars like freight or unlighted passenger cars.  Also, with LED passenger cars the current draw per car can be as low as 10 mA.  So in HO the wheels are electrically isolated so to use the current-sensing scheme you install special wheel axles with an embedded resistor to draw current between the outer rails.  I am not aware of anyone who makes such a wheel axle for 3-rail O-gauge.  Adding powered trucks with center-rail roller pickups on every unpowered car to install an internal load resistor would not win you points at the club.

One approach is to make each current-sensing block longer than the longest consist and then insure that you have a powered device on each end - say engine and lighted caboose.  This also might not go over well with the club since running just an engine would tie up the entire long block no matter where it was on the block.

Don't get me wrong, the ACS712 is an interesting device  But to your point about 180mV/A, note that this works fine for engines but lighted passenger cars with LEDs can draw less than 10 mA so now we're talking 1.8 mV which gets to be tricky given typical DC-offset errors in any DC-biased output device.

Have you taken a look at the so-called inductance-to-digital converters introduced by T.I. about 5 years ago?  So rather than detecting power consumption (as a proxy for occupancy) these devices detect changes in inductance - or basically like those loops that detect your car at a traffic signal.  I'd think a coil of wire about the length of 1 track section and placed under the track section could be used with one of these inductance sensor chips and would sense the presence of the steel trucks on engines and cars whether powered or unpowered.  And of course this would be agnostic to the type of track power used - including battery-powered engines.

http://www.ti.com/lsds/ti/sens...ensing-overview.page

Inductance sensing of course is nothing new but these chips make it easy to apply.  Likewise, Hall sensing devices have been around for a long time; the ACS712 makes it easy to apply.

BTW, as has been discussed in other OGR threads (about making a track-current meter), you can get ACS712 modules on eBay for $1-2 (free shipping from Asia).  In that case it's the galvanic isolation of the ACS712 module which is a key benefit of Hall sensing.

That TI sensor is interesting too... I guess the core advantage of current sensing is the track is already there and wires are already running to it, whereas with a touch sensor (inductive or electrostatic) you can detect current free cars but at the added cost of running cables and drilling holes.The other thing to think about is... with the long block the control is simple, but when you put point sensors, now you need to either put a lot of them (like every car's length or so)... and have an army of decoding and I/O... or you put them in sections and start thinking about keeping track of entrances and exits. It can of course be done, but I'm looking for simple.

I don't think 180mV/A is not a big issue, the RMS noise for 10KHz BW is around 1mV so maybe i'll just leverage the other side of that dual-op-amp with 40dB ish closed-loop gain. That puts you at 18mV/mA which is certainly enough for lit cars. The opamp has 2mV input offset, so that's like a 100uA error at the comparator stage.

 

 

 

Adrian! posted:
...

I don't think 180mV/A is not a big issue, the RMS noise for 10KHz BW is around 1mV so maybe i'll just leverage the other side of that dual-op-amp with 40dB ish closed-loop gain. That puts you at 18mV/mA which is certainly enough for lit cars. The opamp has 2mV input offset, so that's like a 100uA error at the comparator stage.

Where did that 1mV RMS noise come from?  Low noise is not a highlight of Hall sensing.  Using some numbers from the ACS712 datasheet suggests you might have issues resolving 10 mA or whatever from a low-power load.

hall noise

As for DC offsets, as you state 2mV is the input offset voltage.  I may be mis-understanding your topology but input offset voltage is multiplied by your closed-loop gain noise-bandwidth (40 dB) of the amplifier before your comparator.  Also, if trying to resolve a few mV of DC the forward-voltage variations of your diode-detector at the ACS712 output with temperature, time, whatever will be an issue.

As to the original problem of noise/stuttering of the isolated-rail detection you are presently using, how about simple R-C filtering on the relay coils?

 

Attachments

Images (1)
  • hall noise
Last edited by stan2004

Let's consider a PIC as a detector. In it's simplest form it only needs 2 resistors and maybe a half dozen lines of code to make it an on-off isolated rail detector. Its good for up to 1000 volts input and needs only up to 50 micro-amps of detection current. As far as any interference the Atlas signalling system using a PIC for detection has been installed in quite a few club layouts without any operational problems. And as far as cost they start around 50 cents.

But the big advantage? Add a couple more lines of code and you get two color signalling. Add a couple more lines for three color operation. And a few more lines to get filtering for flicker free operation.

Last edited by Gary E
stan2004 posted:
Adrian! posted:
...

I don't think 180mV/A is not a big issue, the RMS noise for 10KHz BW is around 1mV so maybe i'll just leverage the other side of that dual-op-amp with 40dB ish closed-loop gain. That puts you at 18mV/mA which is certainly enough for lit cars. The opamp has 2mV input offset, so that's like a 100uA error at the comparator stage.

Where did that 1mV RMS noise come from?  Low noise is not a highlight of Hall sensing.  Using some numbers from the ACS712 datasheet suggests you might have issues resolving 10 mA or whatever from a low-power load.

hall noise

As for DC offsets, as you state 2mV is the input offset voltage.  I may be mis-understanding your topology but input offset voltage is multiplied by your closed-loop gain noise-bandwidth (40 dB) of the amplifier before your comparator.  Also, if trying to resolve a few mV of DC the forward-voltage variations of your diode-detector at the ACS712 output with temperature, time, whatever will be an issue.

As to the original problem of noise/stuttering of the isolated-rail detection you are presently using, how about simple R-C filtering on the relay coils?

 

Hey,

Well the datasheet is provides numbers for a different noise bandwidth (2KHz) than the ~100ms time constant in the circuit I drew (sorry meant 10Hz there not 10KHz... its the 100ms RC constant) so you need to scale the integrated noise by the bandwidth.  The sensor noise is like Vn=4KT(R_th) per Hz ... supposedly additive white Gaussian (it says thermal and shot and doesn't mention flicker?).

The input offset I was referring to is the comparator itself making the decisions. The amp stage input offset can be dealt with by offsetting the reference side of the comparator. Its on the order of 200mV output referred (40dB X 2mV) which is well within the 5V VCC that already needs to be there.

I'm thinking the gain block is going in front of the detector so you would suppress the variation in saturation current, mobility and device dimensions by the preceding gain stage. Since we only do AC tracks, I may couple AC off the sensor to avoid needing to worry on the DC common mode going into the OPamp.

 

 

 

 

Well, if you continue to add circuitry to deal with offset, noise, etc. why not a synchronous demodulator/detector to pull the signal from the noise.  Although the loads are not purely resistive you have the in-phase source signal via the 60 Hz voltage

Still curious if you guys tried to simply filter the relay coil voltage on the existing isolated-rail detectors to deal with the flakey/stuttering wheel-to-track contact.

I'm not sure what would be gained with a solid state version.  This one offers totally isolated contacts and reliable operation.  Using the 10ma relay coil, it draws very little power as well.  If you use the Axicom (TE Connectivity) relays, the size is very small for the whole package.  In any case, size usually isn't a huge issue for this kind of application.

gunrunnerjohn posted:

I'm not sure what would be gained with a solid state version.  This one offers totally isolated contacts and reliable operation.  Using the 10ma relay coil, it draws very little power as well.  If you use the Axicom (TE Connectivity) relays, the size is very small for the whole package.  In any case, size usually isn't a huge issue for this kind of application.

Thanks for your suggestions. Very helpful... I'm from JPL so i have a instinctive aversion to using moving parts ... that's all. 

I just bought a couple of Hall Effect Current sensors from MPJA.

5 Amp :  http://www.mpja.com/Hall-Effec...productinfo/31584+MP

20 Amp : http://www.mpja.com/Hall-Effec...productinfo/31944+MP

$4.79 each. For a standalone implementation, you would have to add some relay support. I'm thinking of using the analog inputs of an Arduino. The 5 amp module has a transimpedance  of 185 mv/A and the 20 amp is 66 mv/A.

Using eBay parts, I can assemble this for a little over $3.  I made it thru-hole for ease of assembly.  It has a DPDT relay with 2A contacts, so you have plenty of circuits for any signaling.

The board is the most expensive part by far from OSH Park, 2 layer board of 1.86x0.89 inches, $8.20 for three, or $2.75  each.

The relays are 46 cents each.

The capacitors are 5 cents each.

The diodes are less than 2 cents each.

The resistors are under a penny each.

The 22uh chokes are 4 cents each.

The 6 position terminal blocks are 20 cents each.

Total parts are 3.07, including shipping.

Track Presence Sensor Schematic

Track Presence Sensor PCBTrack Presence Sensor 3D View

 

Attachments

Images (3)
  • Track Presence Sensor Schematic
  • Track Presence Sensor PCB
  • Track Presence Sensor 3D View

Add Reply

Post
×
×
×
×
Link copied to your clipboard.
×
×