Block Detectors – An Epic Tale

The development of ISE’s block detectors has been a fairly long adventure, so much so that the long, drawn-out development cycle through six or seven iterations has become a bit of a running joke between Michael and myself.  It’s served as a bit of a high water mark in terms of design revisions and major overhauls, and every time Michael and I have to rev something, there’s usually a comment of, “well, at least it’s not the !@#$ block detectors again…”

With today’s introduction of the CKT-BD1, I thought it might be interesting to let you all in on how this evolved, and how we arrived where we are today – a rock solid design that I believe in as much as our bulletproof IR sensors.   It’s the sort of thing that no sane manufacturer would do – sort of like running the corporate dirty laundry up the flagpole and waving it around.  But then again, we’re a different sort of electronics company, and Michael’s been arguing for years that I’m not quite sane…

I’ve been working on block detectors for a very long time.  I built my first current transformer detectors for a layout in Denver nearly fifteen years ago, and the designs have evolved continuously ever since.

Round 1 – Diode Drop Detectors

My initial efforts back in high school and college (nearly 20 years ago, very near the dawn of NMRA standard DCC) were with diode drop detectors.  These work because diodes generate a significant voltage drop (~0.6V for silicon) when even the tiniest of currents is pushed through them.  The large voltage drop makes it easy to sense if current is flowing through the diode or not.  Diode detectors have three drawbacks, however:

  • They cause a significant voltage drop (and thus they dissipate significant heat under heavy load)
  • They’re difficult to desensitize to leakage currents, since the diode has a very non-linear response to current.  10mA and 2A both create ~0.65V of drop across the diode.
  • Most importantly, they create an electrical connection between track power and the signal/telemetry system, because there’s not an easy way to do isolation.

That last drawback is huge.  This “back door” electrical connection between the track and signal circuits can conduct heavy track currents around things like DCC circuit breakers that are trying to stop the flow to say a short on the track.  It also can cause dead shorts via the signal wiring if careful attention is not paid to always connecting the same rail through the detectors.  There are ways to make isolated diode-drop detectors, but they almost all introduce more complexity and 2-3x the voltage drop of the most basic versions.

While diode drop detectors can work on both DCC and DC, their drawbacks are significant.   Clearly there has to be a better way…

Round 2 – Enter the Current Transformer

In roughly 2001, I started working on MRBus and a signaling system for a layout I was operating on at the time.  One of the first considerations was block detection, and I started considering what a better block detector might look like.

DCC, being an alternating signal with a nominal 8kHz frequency, presents an interesting alternative – transformers!  Devices called “current transformers” exist that are designed for precision current measurement on AC signals.  If an alternating current is passed through their primary side, it produces a tiny current in the secondary that’s in near perfect proportion to the the primary current.

Because of the ratios typically used (between 100 to 1 and 300 to 1), only a single pass of wire is needed on the primary side.  Often – as on our designs – this is done by just passing the wire being sensed through a hole in the transformer.  Thus, there’s very little voltage drop.  The other key advantage is that because it’s a transformer, there’s complete electrical isolation between track power and the signaling.

My initial current transformer detector schematicMy first attempts back in 2001 essentially combined the two – it used a current transformer to sense current, and then used the current in the secondary to develop a voltage across a pair of diodes.  If you want to sense tiny currents, it works well – too well sometimes.

My first current transfomer detector, from about 2001My first units were all hand-built, and thus had a fair amount of parasitic capacitance in the circuitry.  This helped to damp out the high frequency noise (unknowingly to me), and thus they actually worked pretty well.  I had to add a shunting resistor in parallel with the diodes to desensitize them for some particularly long blocks (the resistor shunted some current away from the diodes so it took more current to overcome the 0.6V conduction threshold), but overall they “just worked”.

Round 3 – Version 1, The First ISE Detectors

One of the first things I started working on after we formed Iowa Scaled Engineering was to re-engineer the block detectors.  All of my versions up to this point had been hand-wired and were a pain to build.  Plus, I was starting on a rebuild of a layout’s signal system I’d designed a decade earlier, and needed a few extra detectors.

The first version of the BD42The initial v1.0 detectors were essentially just “productionized” versions of my hand-built units from years before, with the PIC changed out for an AVR.  I also added variable sensitivity based on shunting a variable amount of current around the diodes using a potentiometer.     The prototype units worked fine… on the bench.  Immediately upon installing them on the layout, weird things started happening.

If you’re interested, the schematic for v1.1 is available here.  (1.1 was just an incremental improvement on 1.0 as we learned more about designing for manufacture.)

Round 4: Version 2, Detecting Current Directly

ISE revision 2 replaced some of the analog front end, based on a misunderstanding of what was really happening.   The idea was that rather than possibly getting ringing and noise triggering the circuit before the diode actually starts conducting, maybe using the current generated by the transformer directly would be more robust.   Rather than measuring the voltage caused by current flowing through the two diodes, I replaced one diode with a bipolar transistor.

Bipolar transistors allow a small current flowing from the base to the emitter terminal to trigger a larger current to flow from the collector to the emitter.  The B-E junction is essentially a diode, so swapping it out for one of the two anti-parallel diodes across the transformer was easy.

While I was at it, I also replaced some of the analog filtering with a 74HC123 one-shot to do the delayed release.

Version 2.0 turned out to have a backwards diode footprint, so v2.1 immediately followed on behind.  Neither was a success, because I really hadn’t yet grasped that the capacitance of the track and wire structure were the real issue, and that accurate current measurement with a solid low-pass filter was what I really needed.

Very few version 2 units were built, and only for my testing purposes.  The schematic for them is available here.

The Real Problem… Sneaky Evil Capacitance

The secret is understanding how an empty block acts.  It turns out that contrary to what many people think, an empty section of DCC-powered track will draw a small (and rather unpredictable) amount of current.  Let’s hook up a scope to an empty 20 foot long block on my CR&NW layout and see what we get…

Voltage and current of an empty track block

The yellow line is just the voltage on the rails.  It’s about 24V peak to peak, which is precisely what I’d expect.  That works out to 12 Vrms, which is exactly how I’ve got the layout set up.  The blue line is the current flow into the empty block, at approximately 50 milliamps per division.  Would you look at that?  There’s a bunch of little spikes.  The current drawn by an empty block isn’t zero.  Where’s this current draw coming from?  Let’s take a closer look at the part of the waveform where the DCC reverses polarity.

There's our capacitive current...

Ballast and wooden ties aren’t perfect insulators – they form a very high resistance connection between the two rails that varies significantly with ambient humidity.   However, that would provide a relatively constant draw, which would manifest as a slight offset in the blue line.  Note how every time the voltage switches polarity, there’s a spike and then decay in current?  That’s caused by the fact that the parallel feeder wires and then the parallel rails form a crude capacitor.  When you change the voltage applied to a capacitor, you get a spike of current flow.  Unfortunately for a DCC system, this happens continuously – approximately a 24-36V swing happening ~8000 times per second.

Further measurements with my LCR meter show that loose Atlas Code 55 flex track has a capacitance of approximately 10pF for a 30″ section.  If you work out the math and add a little capacitance for the feeder wires, those spikes correspond exactly to the spikes you’re seeing on the scope.

My variable threshold on the v1 and v2 detectors worked great for the resistive, static load such as leakage through ballast, but that spike of capacitive current is actually larger than a couple idle locomotives, but for only a few hundred nanoseconds.   By the time you desensitize the detector enough to ignore the spikes (which can be in the 20-50mA range), the result is the inability to detect anything less than a moving locomotive.

Round 5: Success Through Complete Overhaul

To overcome these parasitic effects and complex leakage currents reliably, the trick is to turn the AC waveform coming out of the transformer into a signal actually corresponding to the absolute value of the current.  (Absolute value meaning just the magnitude – I don’t care which direction the current is flowing, only how much current is flowing.)  This allows you to accurately measure the actual current flowing at all times, rather than just getting some arbitrary “is there current or not” signal.

Once you have a precise measurement of the current, it can be fed through a low-pass filter to eliminate all the high-frequency capacitive noise.  From that, any continuous current draw becomes glaringly obvious and very easy to pick out.

How do we do that?  Looking at the schematic for v3.1, you’ll see there’s a resistor across the current transformer leads.  (R9, R10, R21, or R22)  This is called a burden resistor, and provides a voltage that has a direct, linear relationship to the current being pushed.  There are still reverse parallel diodes, but these are for protection against huge current surges only (such as might be caused by a dead short on the track).  Normally the signal level across the resistor is such that the diodes never go into conduction.

So, now we have an alternating voltage that corresponds directly to the current flowing through the primary side of the transformer.   That signal has a 1.2V offset from ground (Vbias on the schematic) so that it never goes below ground or beyond the amplifier’s input range.   That first op-amp in the signal chain turns that signal alternating around Vbias into a DC signal that’s “signal + Vbias offset”.

The second amplifier removes the Vbias offset and amplifies the signal 100x.   It then just goes into a simple RC filter that damps any signals above about 15Hz.    From there, it’s fed directly into the microprocessor.

The setpoint voltage is created by a potentiometer and is also fed through a simple RC filter to eliminate noise.  It gets fed into another of the processor’s ADC inputs.

So why use the processor?  Couldn’t we just compare the two voltages and set the outputs if the signal sensing output was higher than the setpoint?  We could, but adding a digital filtering stage in the middle allows us to add easily programmable detect and drop out delays, and further filter out signal noise.  Plus, as it turns out, the small ATtiny45 parts are actually about as cheap as a comparator and its support passives, and it gives us a lot more flexibility and configuration options.

The result is a block detector that lives up to our expectations for a product.  I’ve been using them all over on my own layout, and I’ve yet to have a false trigger but I still can pick up my finger across the rails.   Likewise, the pre-sales evaluation units we’ve sent out have also generated positive comments about the sensitivity without the false triggers.

This fundamental circuit has become the basis for our whole line of block detectors now.  After nearly a year of testing and design on the current iteration, we’re finally comfortable enough with their performance reliability that we’re ready to start actively promoting them as a product.

So, welcome the CKT-BD1, MRB-BD4X, MRB-BD42, and MSS-CROSSOVER to our line of quality model railroad electronics.  If you’re looking for DCC block detectors, we think we’ve got an excellent range of solutions to meet your needs.  If you’re not sure which one fits your application, drop us a line and we’d be happy to help you out.

Leave a Reply

Your email address will not be published. Required fields are marked *