DCC and DCC++

I've implemented a quad dcc driver module and H-bridge set that work with the dcc++ arduino software. Here I've written a quick description and links to the kicad files for pc boards. I've run both the DCC++ code and Club N Caldes loco-net (sic) code in the arduino with these circuits and it works very well. I have a haywired copy of the Club N Caldes dcc++ loco-net interface that hangs off the 2560 connector.

These versions of the circuit design and kicad files (quad dcc buffer, LM311 H-bridge, dcc brake sled) are copyright (C) 2018, 2019 by gnu@wraith.sf.ca.us and placed into the public domain. I designed and built the H-bridge driver based upon the National Semiconductor lm311 "typical application" for a switching power amplifier as seen on page 8-39 of the NS Jan, 1974 Digital Integrated Circuits catalog.

There is also a drawing of this circuit in the T.I. data sheets for their LM311 clone. It seems to differ from the National drawing, where the .22 capacitor is between the 510 ohm and 39k ohm junction in the National but the T.I. has one leg of the .22 going to the 510 ohm/300k ohm junction. The T.I. drawing like this goes back at least to the 1980 Linear Control Circuits Data Book of theirs. The T.I. LM311 data sheet I just downloaded says "slcs007k september 1973" (crossed eyes) (noticed/documented April, 2019).

RIP National Semiconductor....

The boards I have were fabricated by jlcpcb. I uploaded the kicad zip files for the projects and they went through fabbing with no problems. The only thing out of the ordinary was to specify 2oz cu for the thor board since it is a power circuit.

I made pdf's of the schematics:

1. quad dcc buffer 2. thor H-bridge 3. brakesled 4. external darlington

Quad DCC Buffer

The quad dcc driver module plugs right into the arduino mega 2560. It is useable with the arduino uno with one trace cut and two jumpers. The quad driver has outputs for a primary track "booster" and the programming track. In addition, two other buffers are available for a multiple booster power block arrangement. The board also buffers the current sense output of the H-bridge circuits so that the overcurrent sensing works properly. The buffer board is designed to work with the various modules available on amazon/ebay etc., of assorted power levels. The prototype used an AMD 930959 dual 4in mux as the driver. The PDP-10 clone "MAXC" built at Xerox PARC also used the 930959 on the CPU board. Living in Palo Alto in the 70s I could place a local call and get a 300baud connection to maxc. Tenex let you do a lot from that dot.

The quad dcc buffer kicad zip file.

"THOR" LM311 H-Bridge Booster

Thor is the pcb I designed for the DCC++ LM311 H-bridge application. The H-bridge driver is pretty flexible. I've used 2n5192/2n5195 output transistors and it makes a fine programming track driver. Ditto with a set of 2n4918/2n4921 Q's.

Desiring higher output, I installed a set of 2n6041/2n6044 power darlington transistors with large heatsinks (here is the prototype) and easily obtained 5 amps track power capability (I've tested to 3 amps).

This was fun. So, I searched my salvage box and old parts cabinet and found a set of Motorola MJ2840/MJ2940 TO-3 power transistors along with tip29/tip30 plastic devices, and formed them into a darlington configuration. More fun. I made up the darlington with 215 ohm base drain resistors. The lm311 output resistor chain uses 260 ohms (replacing 620 ohms).

So I tried another set, 2n6675/2n3791 with tip31/tip32 drivers. A full ten amp rating for this set. I've tested this "external" darlington arrangement to 5 amps or so (briefly).

The board arrangement for the external darlington is simple. The TIP drivers and the TO-3 power devices are all "haywired" on the back.

All power transistors must be insulated from each other. I had a pair of heatsinks that I could use for the two driver pairs, so I chose to insulate the P channel devices and let the N channel sit on the metal. The N channel device has a greater voltage drop and wants the better heatsinking. Ergo.

When selecting transistors, the PNP pair should be of the same part number, and if possible, same mfg/date code. Likewise the NPN pair. The sets ideally would be selected out of the catalog, of those devices designed for "complementary" use. I've gotten away with PNP pairs (like the 2n3791's) and not so well matched NPN pairs (like the 2n6675's). I try to make the NPN's power rating equal/better than the PNP's. ??

Producing a twelve volt signal swing while pushing multiple amperes at eight kilohertz is a brutal job. Even when "only" running with a few hundred milliamps the transistors work hard. Audio amplifiers have a similar frequency and power range but are rarely worked the way an H-bridge is routinely expected to. Here's what Professor Leach says about his audio amplifier design:

I chose a slew rate of about 60 volts per microsecond. 

This is much higher than required. It is high enough to give a large-signal 
bandwidth of around 220 kHz. 

However, I never recommend anyone to test the 
amplifier at full power above 20 kHz. 

The output transistors are put under 
severe thermal stress during such tests, and they can fail. 

I know someone 
who used a Low TIM amplifier to drive an ultrasonic shaker table at 
full power at a frequency of 40 kHz. He said it worked, 
but I don't recommend such applications.

Ten Amps is a pretty bold claim. Note how I carefully state the transistors are capable of ten amps. Um I tested to five, briefly. I have a set of the bgmicro "Audio Output Pair" transistors installed and they slug it out...

I've hacked things a bit and have a THOR circuit that uses 2n3725's to drive a set of TIP32's and 2sc4242's as output devices (apropos they were in my parts tomb). They heat up just as much as you would expect looking at the pictures and seeing the inadequate heatsinks. Eight Kilohertz is a serious pounding. The only thing those heatsinks do is prevent quick thermal destruction of the driver transistors. An operational THOR setup should have a fan and must have much larger heatsinks.

The current sense resistor is called out as .1 (one tenth) ohm. This is suitable for programming track use. Higher power setups should use a .025 (a quarter of a tenth) ohm. I've shorted the track accidently and jmri did power down the track -- the current sensing does work. The "base 1.2.1" software will turn the power off immediately when using the thor power blocks -- a simple fix for the software and its no problem.

In CurrentMonitor.h:

#define  CURRENT_SAMPLE_MAX         999

I have been trying a prerelease of jmri using a ten amp power block/quad driver in service with a brake sled for testing. This 10 amp block had a quarter watt resistor lead as the current sense resistor. I noticed that dcc++ was sending useable readings off the resistor lead as the sense point. With a 2 amp brake sled load, jmri was reading 15/1024 out of dcc++ with the quad dcc buffer and the ten amp power unit. The dcc++ code was modified as above to support the ten amps of track power available with this version of the THOR power block.

The c101/102 take a beating in the thor circuit. They should be low ESR aluminum electrolytic of 2000 microfarad, 25 volts, 105C rating. The 85C rating will "work" I suppose. I used the 47uF/35v solid tantalum in the '6041/44 darlington and they got warm. At first I had 22uF tantalum in there, and they got quite hot. Finally I piggybacked some 2200uF/25V low ESR aluminums in there and that made the power circuit purr. BTW I powered it up with *no* capacitors there, and all the decoders laughed out loud. Literally, they all blinked their headlights.

As for the diodes, a set of 1n5403's worked for me. I also used mr851's. These are so-called "freewheeling" diodes, with a peak forward current surge of 100 amps. Use of 1n400x devices is not recommended.

The Thor LM311 H-bridge schematic and pcb kicad zip file.

N Scale

I was testing with a modest N scale setup using an old loop of track. I've had four N DCC units under power with these circuits and all the power block variations worked well. I could have a unit running around the loop and use the DCC Brake Sled to dump a two amp load on/off the booster and the unit never stuttered or glitched. My power supply was 15 volts/10 amps. A 12 volt power supply will "work" but you will suffer voltage drop at the ends of your track. 15 volts should be the minimum for power darlington DCC boosters.

The brake sled works instantly and well with jmri. Click on the button for the brake sled in the jmri control panel, and "CLANK" goes the two amp load on the H-bridge. Likewise, click the button that controls the led on the arduino nano, and "blink" you get. When I had trouble, I traced it to the optoisolator circuit garbling the DCC signal.

DCC Brake Sled

I have a prototype DCC " Brake Sled " that uses the NMRA DCC library code to implement a decoder using an arduino nano. As currently implemented, the device can operate the nano's led, a fan, and the "Brake Sled." The brake sled is nothing more than a relay that dumps a 1 or 2 amp (jumper selectable) load onto the tracks. The fan can be controlled via the throttle on jmri. I wanted to use something a bit more "expendable" when building/testing the H-bridge drivers, as it made me nervous to test my circuits with $100 worth of N scale locomotive. So I designed this and it is really handy.

I used a copy of the "NMRA Multifunction" library code. The file worked for 2 digit adressing but needed a fix for 4 digit addresses (included in the version below). Control via JMRI involves setting up a roster entry, where the info such as decoder type ("NMRA Standard CV definition"), decoder address, and the other things you/JMRI consider significant are mapped out. The usual constraints of microcontroller life of course apply, such as the DCC input generated by the optocoupler must be applied to the pin on the microcontroller that supports the hardware used by the software to read the DCC packets off the track. Likewise, the PWM signal used for fan control is available on certain pins and not others. My test article code assumes the arduino nano clones I found for cheap. Cosmetic rejects actually, as the boards were sheared apart too close to the plate-through holes on one side. Cheap boards. Really cheap. Thank you!

I've created a kicad schematic for the dcc brake sled (March 2019). The actual "brake sled" is nothing more than a relay that dumps a 2 amp load across the rails. I'll be creating a separate file for the relay and load. That is simple enough to haywire I've left it off so I could rush out this schematic.

DCCpp NMRA Multifunction decoder example arduino code.