Diesel Controller Mainboard: Reverse-Engineered and Redesigned
I reverse-engineered the mainboard of a diesel controller and made the schematic, the two-layer PCB and the firmware myself: 24 isolated inputs, 24 outputs, analog inputs, a clock, flash and RS-485 around a PIC18 microcontroller.
Overview
This is the main board (motherboard) of a diesel controller, which I worked on in 2021. The original board was on the market, but I had neither its schematic nor its PCB layout. So I reverse-engineered it: from photos and scans of the board and its chips, and from the datasheets of the parts, I worked out the structure of the circuit. Then I designed the schematic and the PCB from scratch. The result is a new board that does the job of the original one, but the design is my own and not a copy of someone else's drawings. I also wrote the firmware of the board myself.
What the board does
The board sits in the middle of a diesel control system. It takes the signals of the engine and the panel, makes decisions, and switches the loads:
24 digital inputs with optical isolation. Each input has an indicator LED that shows its state on the board.
24 outputs for relays and loads, through latches and transistor drivers.
Analog inputs to measure the voltage and current of two batteries and two chargers, and a temperature sensor on the board.
A real-time clock so events can be time-stamped, and flash memory to keep data.
An RS-485 serial link to connect to the rest of the system.
The diagram below shows how the signals flow.
Main parts of the circuit
Processor: a PIC18LF6720 microcontroller in a 64-pin package.
Inputs: every four inputs are isolated from the outside circuit by a PS2802 optocoupler chip, then pass a 74HC244 buffer to reach the processor. Next to each input there is a zener diode for protection.
Outputs: the processor holds the outputs in 74HC374 latches and ULN2803 drivers supply the current.
Analog: LM6132 amplifiers prepare the signals for the processor. An LM61 sensor reads the temperature.
Power: LM2676 step-down converters bring the input voltage to the voltages the board needs. High-current paths, like the battery and charger inputs, are built with large copper areas.
Communication: an LTC2851 RS-485 transceiver.
Logging and time: a DS1305 clock and two M25P20 flash memories.
PCB design
The board has two layers, and even with its many SMD parts and dense routing, everything fits on those two layers. It has three rows of screw terminals at the bottom for the inputs and outputs, so the wiring in the panel is easy. The terminals, mounting holes and test points are placed so that the board fits the panel and is easy to debug. The layout picture (red is the top layer, blue is the bottom layer) shows the dense routing of the inputs and outputs. The design is RoHS compliant. I blurred company names and logos in the images.
Firmware
I wrote the microcontroller program from scratch. The firmware handles the inputs and outputs, the analog measurement, the clock, the flash memory and the RS-485 communication, and turns the board into a complete controller.
Tools and method
Reverse engineering from photos and scans of the board and the datasheet of every part
Schematic and two-layer PCB design in Altium Designer
Writing the microcontroller firmware
Choosing parts from datasheets
Result
A complete controller with 24 inputs, 24 outputs, communication and data logging, whose schematic, two-layer PCB and firmware I made myself, without any original drawings. Only the pictures and a general description are shown on this site.
Gallery
BLOG
Related posts
Questions about this project?
If you have questions about this project, or a similar one in mind, I would be glad to hear from you.