Introduction: Tiny 12V Monitor

This instructable is for a tiny car battery monitor that just gives a traffic light indicator of battery health through 3 LEDs.

I wanted one that I could leave permanently attached and had a very low current draw. Reason was that my car had been unused for a while ( 11 weeks - self-isolation) and battery had gone completely flat. This is problematic in my car as normal door opening relies on the battery. I could get into the driver's door via back up manual key but then had to crawl through to the back of the car, attach a back up battery across the 12V battery so I could open up the rest of the car and get the battery out to re-charge. That all went well but I didn't want to repeat the exercise.

So I made this little monitor to warn me before everything packed up. I also established that battery drain was about 30mA normally with all systems off. I think this is door monitoring and alarm system. Doesn't sound a lot but given an extended period of inactivity it will drain the battery. So I was keen not to add too much to this load. It ended up drawing about 4mA average. A large part of the power saving is by flashing the appropriate LED on just for a short period every 5 seconds

The monitor is based on a Digispark type ATTiny85 module which is small, cheap and has a decent ADC input to monitor the voltage and enough GPIO to drive 3 LEDs.

I did use my modified version of this to further lower current low current digispark, but it could be used without this if one is happy with an extra 7mA current. This is described further in the schematic description.

Step 1: Tools and Components

Tools

  • Fine Point soldering iron

Components

  • Digispark ATTiny85 (either normal USB or micro USB
  • prototyping board 6 x 7 holes
  • 3.3V regulator xc6203E332
  • 3 LEDs Red, Yellow, Green
  • Resistors 3 x 47R, 1 x 10K, 1 x 33K
  • Capacitor 10uF
  • Schottky diode
  • Zener diode 7v5
  • 3 pin connector
  • Enclosure - 3D printed box

https://www.thingiverse.com/thing:4458026

Step 2: Schematic

The circuit is very simple. The schottky diode (polarity protection) and a zener feed the low current 3.3V regulator to derive a stable 3.3V power to the ATTiny.

A potential divider drops the 12V battery by 4.3:1 to feed the ADC input on the ATTiny. PB3 / ADC1 is used to avoid any interfernece from the USB components on the board. 3 LEDs are attached to PB0, PB1, and PB5 and use 47R resistors to limit current. PB5 is used again to avoid any interence in USB operation. This does require that PB5 is not fused programmed for reset operation. THis is normal for real digisparks but not necessarily for clones and for these the fuses need to be edited ( see fuse editor )

If you want to avoid the modification to the digispark to lower its current then you can just use the supplied on board 5V regulator. This requires a few modifications.

  • Remove the xc6203 regulator and 7v5 zener and feed the 12V straight into Vin on the Digispark.
  • Change the potential divider to say 18K : 10K
  • Software voltage threshold levels will need to be adjusted a bit. See software section.

Step 3: Construction

I made up the extra circuit on a 6 x 7 piece of prototype board which can sit on top of the digispark with the holes directly lining up with the GPIO and the voltage pins.

This makes for a very compact module which can fit in a very small box. I used a 3 pin connector on the box with the 2 outside pins wired to 0V and the center to 12V. This means the polarity of inserting the connector is unimportant.

Step 4: Software

Software is in the form of an Arduino sketch.

Source is available at https://github.com/roberttidey/tiny12V

It is very simple and just has a simple loop that every 5 seconds measures the voltage via ADC1 and then flashes the appropriate LED.

The levels which determine the thresholds are set by the line

int ledLevels[LED_COUNT] = {907, 888, -1};

An ADC reading greater than first number flashes green. An ADC reading less than this but greater than second flashes Amber. Anything else flashes Red.

For me this gave green > 12.4V, Amber > 12.1V, Red < 12.1V.

You can calibrate by using a variable voltage supply and checking where the LED changes occur. These would need changing if using the default 5V regulator on the Digispark.