MRBus MRB-BD4 4 Channel DCC Block Detector

MRBus MRB-BD4 4 Channel DCC Block Detector
4-Channel DCC Block Detector

First, a little credit where it's due. The design was strongly inspired by Rob Paisley's work with current-sensing block detectors. I do say "inspired by" because the circuit is by no means an exact copy, but he did get me looking in the right direction for current transformers, etc. He's taken the design off his own site now, bit he still has a number of other interesting circuits.

Basic Theory of Operation: Basic operating theory: Current from squarewave 8kHz DCC track power is coupled into the secondary, where the current shunts through the diodes. The first comparator in the chain drops its output any time enough voltage is sourced from across the resistor/diodes (approx 0.43V), pulling charge out of the 1uF cap and dropping it to near ground. Otherwise, the 1uF is left to charge through the 750k resistor (providing turn-off delay). The second comparator is just there to provide hysteresis and a clean digital output to feed into the PIC. Since it's DCC, I really only need to sense one side of the waveform. Also, diodes and a current transformer alone form a very sensitive detector - sensing as little as 100-200uA of current in a very simple test. If this is too sensitive, a shunt resistor can be added across the diodes to divert a certain amount of current around them, thus increasing the amount of current needed to reach the 0.43V threshold.

From there, the processor monitors all four inputs. Once per second, it sends out a broadcast 'D' packet (destination 0xFF) containing one byte of actual data - with the four occupancy lines bitmapped on the lower nibble.

As has been mentioned elsewhere, the MRBus system has been developed in C using Pavel Baranov's C2C compiler. It's not free, but it's quite reliable and very reasonably priced for what it does and there is a free trial version available. For those looking for a good quality PIC C compiler on an affordable budget, I recommend it. As a truly free, open-source PIC compiler becomes available and matures (come on, SDCC people, I'm counting on you...), I'll probably migrate over. For those without the compiler, I've included the compiled hex file for use with pretty much any standard PIC programmer.

Documentation and Source Code

Schematics

Version 1.0
Final MRB-BD4 schematic
[jpg]

Firmware

Version 1.2
Finished MRB-BD4 firmware, incorporating the bus-lockup fix
[src] - [hex]
Version 0.99 (Obsolete - Reference Only)
Initial Release
[src]

Photos

Hand-wired Prototype
10-Dec-2002
[960x640]
[2160x1440]
  Questions? Email Nathan Holmes
© NDHolmes, but freely usable under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.
Last modified on January 05, 2006, at 03:53 PM
Edit Page | Page History