PrgmrArduino is an Arduino library written in C++ that provides the foundation for implementing an NMRA DCC programmer. PrgmrArduino presents classes and methods for configuring a locomotive’s address, direction of travel, lights and sounds, and so on. PrgmrArduino translates these commands into DCC packets. An interrupt service routine attached to Timer2 takes these packets and generates a precision DCC waveform generated on digital pin 11 and digital pin 3. This signal is suitable for amplification with a small h-bridge circuit. Please note that the Arduino outputs are not themselves capable of driving trains directly.
To read configuration data, PrgmrArduino requires some way of measuring the current draw from the h-bridge or booster. You may use any suitable means at hand; a current-sense resistor and cheap op-amp will usually do the trick. I will post sample schematics at a later time. The output of the current-sense circuitry must be an analog voltage in the range 0-5VDC, and wired to the Arduino’s analog pin 3 (configurable in software).
More detailed documentation is currently pending, although the code does include an example sketch to demonstrate usage.
You can download PrgmrArduino from github; bug reports, contributions of code are welcome. Please do leave a note if you use PrgmrArduino in your project.
Please note that at this time PrgmrArduino is beta software, and is not feature complete.
PrgmrArduino is the perfect complement for Io:duino, and Arduini-compatible DIY DCC and OpenLCB development board.