Whilst there are many commercially reversible speed controllers available, most are designed for high performance model cars or boats, and therefore are large and expensive. I wanted a lightweight ESC for fitting into a small scale boat or submarine.
Source Code, Hex file for 12F675, Eagle PCB layout file
I designed this circuit to replace the DCC controller in a G gauge (garden railway) model locomotive. Rather than being controlled via track power, the loco is powered by an on-board 10 cell 1950mAh NiMH battery, and operated with a 27MHz AM RC transmitter.
The lamp drivers consist of P channel MOSFETs (Q7, Q8) 'piggybacked' on top of the high-side FETs. Depending on which direction the ESC is going in, either the forward or reverse lamp driver FET is turned on. These outputs can drive either incandescent (filament) lamps or LEDs. A series resistor (R15, R16) limits inrush current to the lamp, or sets the operating current of the LED.
I also included a schottky diode to prevent damage due to reverse battery polarity, and a Polyfuse to limit current if the motor is stalled or any output is shorted.