N5ESE Programmable Voltage Monitor for Batteries (2023)

Under Construction
(click on any picture to see larger version)

I needed a quick-and-easy add-on monitor for the input voltage on my 5V UPS project and this mini-board fit the bill.

It utilized a bicolor (Red/Grn) LED as the indicator, and ran from the very power it was monitoring.
The LED performs as follows:

    - Green Steady = Good (within expected input range 14.5-15.5V)
    - Green Flashing = Good low/high, but allowable: >13.45 & < 17V)
    - Red Steady = Low (below allowable minimum input voltage < 13.4V)
    - Red Fast Flashing = High (above allowable input voltage > 17V - TURN IT DOWN!)


(click on any picture to see larger version)

This circuit uses an ATTiny85 8-pin MCU as the programmable element. We used a high-initial-accuracy
voltage reference LT6654A (at 3.3V +/-0.1%) that could source up to 10 mA to power the MCU, and
in this way we didn't have to calibrate the circuit nor add another voltage reference. The
circuit, then, ends up having very few parts and occupying a very small perf board. Layout is shown
on the expanded schematic, and the perf-board grid is on 0.1-inch centers.The shape of the board
was based on the available space on a very crowded rear panel, but could easily be made into some
other (more conventional) shape.

To minimize the footprint, we placed the ATTiny85 8-pin MCU in a socket, and we did not add the 6-pin connector
that would be required for in-circuit programming. So the MCU gets programmed on another board,
and afterwards the chip gets installed in the socket on this board.

This one ended up installed in the 5V UPS mounted on a single short standoff between two existing
connectors; here's a picture of that rather crowded installation:

Software (Firmware) for the Voltage Monitor

To keep the board minimally sized, we left off things like pushbutton switches and connectors.
And without a pushbutoon (or other user-input method), the firmware has no need for software to
interact with the outside world. But this also means that "programmable" (in this case) really means
"pre-programmed" via the firmware installation process. So a voltage monitor for 12V can
certainly be made, but the compiled firmware file will be different than the one for, say, 15V.

So the firmware for this device becomes very simple. We code #define values to match what voltage
we are monitoring, and the values we want that govern the behavior. Then, after initialization,
the main loop does the same thing over and over, continuously. It reads an A/D converter, and
evaluates the current value (representing the monitored voltage) to determine what the states of the
two LED's (Green and Red) should be. Some averaging is done to reduce susceptibility to noise and
spikes. And finally drives the LEDs to "make it so". Oh - and continues as long as power is applied.

An Arduino sketch (.ino) file can be found - here -.
With the #defines shown, it performs for 15V (as outlined above).

I generally use a Tiny AVR Programmer to program this 8-pin MCU chip.

Monty N5ESE

dit dididit dit

Return to N5ESE home page
Overseer: Monty Northrup ... n5ese@n5ese.com ... leave e-mail ...