Post Top Ad

Saturday, January 27, 2024

12 Volt Battery Level Indicator Circuit


 12 Volt Battery Level Indicator Circuit

With the use of 12V batteries becoming more popular (typically the 7Ah sealed lead acid), I have been requested several times to build a state of charge (SOC) meter displaying the voltage on the LEDs. However, each person wants something a little different. The biggest difference is the required minimum and maximum voltage to be displayed.


If a low level warning is also required, this will then result in three voltage levels to be monitored. Using pots for adjustments, is the normal method used. However, adding a second or third warning, this can become a problem.


Lastly, the current drawn by circuits I have tested, ranged between 45mA and 150mA. With a standard LM3914 battery monitor, the battery monitor itself will drain a 7Ah battery in about 46 hours.


The aim was then to design a battery indicator with the following specifications:

- LED Display

- Adjustable maximum voltage level

- Adjustable minimum voltage level

- 3 Adjustable alarms (typically 50%, 30%, 20%)

- Alarms to be non-irritating, and have a mute function

- Minimum buttons

- Low power consumption


For my design, I opted for the AtMega328P micro.

The LED display was designed to be simple and easy to interpret. There are 6 LEDs, indicating the voltage level in a LED BAR method:


Led 6 - 100%

LED 5 - 80%

Led 4 - 60%

Led 3 - 40%

Led 2 - 20%

Led 1 - 0%


The 0% LED is to be linked to the programmed minimum voltage level

The 100% LED is to be linked to the programmed maximum voltage level.


The scaling between 0% and 100% is linear. For 0%, only Led 1 will be on, and for 100%, all Leds will be on.


For power saving, the LED display does not stay on. To turn on the display, a button needs to be pressed, and the display will turn off after 30 seconds.

To be able to measure the voltage, the battery voltage needs to be down scaled. Using a resistor divider, the voltage is scaled down to 1.1V with a 1M and 82K resistor. With the A/D converter set to the internal 1.1V reference, this means that the maximum measured voltage will be around 14.45V, high enough for the design.


There are 5 voltage levels that need to be monitored:


- maximum voltage level

-minimum voltage level

- Alarm 1 voltage level

- Alarm 2 voltage level

- Alarm 3 voltage level


Instead of using trimpots, I decided to go for a more unconventional way. Via a programming procedure, apply the specific voltage levels in turn, and save the various A/D results in EEPROM.


The LEDs are used to indicate the programming sequence, and the same button used for the display, is used for programming.

A normal piezo buzzer is used for the alarm. as this should be load enough. Provision for three alarms were made, with the following properties:


- Alarm 1, to beep once every few seconds. Should be able to silence this alarm

- Alarm 2, to beep twice every few seconds. Should be able to silence this alarm

- Alarm 3, to beep three times every few seconds. This alarm cannot be silenced.


Once an alarm is silenced, I needed an automatic reset function to enable the alarms again if the battery has been charged. I included a reset function that will enable all alarms again if the battery voltage exceeds 60% again.


To silence the alarms, the same button used for the display is used.


I tested these alarm sounds in my house, without any complaints from my wife and son, so I am sure it will not be irritating in the outdoors world.

All functions are done using a single button.


Display


To turn on the display, press the button. The LED dislpay will come on, and turn off automatically after 30 seconds.


Alarms


Alarm 1 and Alarm 2 are silenced by pressing the buttom.


Programming


To enter programming mode, press and hold the button while powering up the unit. Keep the button pressed for 5 seconds.

There are several ways to reduce the overall power used by the circuit. I used the following methods:


Display


By pressing the button, the LED display is turned on, and automatically turns off the LEDs after 30 seconds. This results in a saving of 120mA.


MCU Voltage


Running the AtMega328P at 5V, uses more power than running at 3.3V. I opted for a 3.3V low drop out regulator.


Voltage Regulator


A standard 7805 regulator has a current current of around 20mA. Using a 78L05, this is reduced to 3.5mA. But, by using a low drop out regulator like the LP2950 3.3V, this can be dropped to as low as 0.1mA.


NOTE:

If you do not require the power saving, you can use a 78L05

Oscillator speed and selection


From the datasheets, the AtMega328P current can be dropped from around 10mA to 1mA by selecting the internal 8MHz oscillator, as compared to the external 16MHz crystal.


I opted to use the internal oscillator running at 8MHz for the design, as it gives the best speed/power performance. However, the drawback is that the AtMega328P config registers needs to be programmed using AVRDude. I make use of this site (http://www.engbedded.com/cgi-bin/fcx.cgi?P_PREV=&P... to get the correct er configs.


NOTE:

If you do not want to change the config fuses, the MCU must run on an external 16MHz oscillator. Please change any delay() and Millis() values to actual ms values.


Sleep


By placing the AtMega328P in SLEEP mode, one can further reduce the power. In SLEEP mode, most of the MCU interfaces are turned off. In this mode, the MCU can draw as little as 0.001mA. However, the MCU is no longer running, or in this case, measuring the voltage.


A watchdog time is used to wake the MCU from SLEEP. Setting up the watchdog timer to wake up the MCU every 8 seconds, will ensure that the power used is even less.

Results of power saving


By using the above power saving techniques, I was able to reduce the current of the circuit down from 80mA to as low as 0.12mA when the device is in SLEEP mode. Overall, the circuit uses about 0.28mA.


Thus, before power saving the circuit will drain a 7Ah battery in about 2.8 days.


After power saving, it will take around 3.5 years for the circuit to drain the same battery.

I used the free version of Eagle to design the PCB. All components, except the push button, are mounted onto the PCB. Assembly is easy, with the exception of soldering the LEDs. Ensure all LEDs are the same height. I used 20mm spacer to mount the unit, and used this as reference for the LED height.


Because my design uses a 3.3V regulator, some standard 5V piezo buzzers do not work. The buzzer in the design is connected across 12V, and switched with a transistor. Play around with the value of R6 to get a decent sound out of the buzzer, without destroying it. Apart from this, there is no other tricks in building the circuit.


 12 Volt Battery Level Indicator Circuit

With the use of 12V batteries becoming more popular (typically the 7Ah sealed lead acid), I have been requested several times to build a state of charge (SOC) meter displaying the voltage on the LEDs. However, each person wants something a little different. The biggest difference is the required minimum and maximum voltage to be displayed.


If a low level warning is also required, this will then result in three voltage levels to be monitored. Using pots for adjustments, is the normal method used. However, adding a second or third warning, this can become a problem.


Lastly, the current drawn by circuits I have tested, ranged between 45mA and 150mA. With a standard LM3914 battery monitor, the battery monitor itself will drain a 7Ah battery in about 46 hours.


The aim was then to design a battery indicator with the following specifications:

- LED Display

- Adjustable maximum voltage level

- Adjustable minimum voltage level

- 3 Adjustable alarms (typically 50%, 30%, 20%)

- Alarms to be non-irritating, and have a mute function

- Minimum buttons

- Low power consumption


For my design, I opted for the AtMega328P micro.

The LED display was designed to be simple and easy to interpret. There are 6 LEDs, indicating the voltage level in a LED BAR method:


Led 6 - 100%

LED 5 - 80%

Led 4 - 60%

Led 3 - 40%

Led 2 - 20%

Led 1 - 0%


The 0% LED is to be linked to the programmed minimum voltage level

The 100% LED is to be linked to the programmed maximum voltage level.


The scaling between 0% and 100% is linear. For 0%, only Led 1 will be on, and for 100%, all Leds will be on.


For power saving, the LED display does not stay on. To turn on the display, a button needs to be pressed, and the display will turn off after 30 seconds.

To be able to measure the voltage, the battery voltage needs to be down scaled. Using a resistor divider, the voltage is scaled down to 1.1V with a 1M and 82K resistor. With the A/D converter set to the internal 1.1V reference, this means that the maximum measured voltage will be around 14.45V, high enough for the design.


There are 5 voltage levels that need to be monitored:


- maximum voltage level

-minimum voltage level

- Alarm 1 voltage level

- Alarm 2 voltage level

- Alarm 3 voltage level


Instead of using trimpots, I decided to go for a more unconventional way. Via a programming procedure, apply the specific voltage levels in turn, and save the various A/D results in EEPROM.


The LEDs are used to indicate the programming sequence, and the same button used for the display, is used for programming.

A normal piezo buzzer is used for the alarm. as this should be load enough. Provision for three alarms were made, with the following properties:


- Alarm 1, to beep once every few seconds. Should be able to silence this alarm

- Alarm 2, to beep twice every few seconds. Should be able to silence this alarm

- Alarm 3, to beep three times every few seconds. This alarm cannot be silenced.


Once an alarm is silenced, I needed an automatic reset function to enable the alarms again if the battery has been charged. I included a reset function that will enable all alarms again if the battery voltage exceeds 60% again.


To silence the alarms, the same button used for the display is used.


I tested these alarm sounds in my house, without any complaints from my wife and son, so I am sure it will not be irritating in the outdoors world.

All functions are done using a single button.


Display


To turn on the display, press the button. The LED dislpay will come on, and turn off automatically after 30 seconds.


Alarms


Alarm 1 and Alarm 2 are silenced by pressing the buttom.


Programming


To enter programming mode, press and hold the button while powering up the unit. Keep the button pressed for 5 seconds.

There are several ways to reduce the overall power used by the circuit. I used the following methods:


Display


By pressing the button, the LED display is turned on, and automatically turns off the LEDs after 30 seconds. This results in a saving of 120mA.


MCU Voltage


Running the AtMega328P at 5V, uses more power than running at 3.3V. I opted for a 3.3V low drop out regulator.


Voltage Regulator


A standard 7805 regulator has a current current of around 20mA. Using a 78L05, this is reduced to 3.5mA. But, by using a low drop out regulator like the LP2950 3.3V, this can be dropped to as low as 0.1mA.


NOTE:

If you do not require the power saving, you can use a 78L05

Oscillator speed and selection


From the datasheets, the AtMega328P current can be dropped from around 10mA to 1mA by selecting the internal 8MHz oscillator, as compared to the external 16MHz crystal.


I opted to use the internal oscillator running at 8MHz for the design, as it gives the best speed/power performance. However, the drawback is that the AtMega328P config registers needs to be programmed using AVRDude. I make use of this site (http://www.engbedded.com/cgi-bin/fcx.cgi?P_PREV=&P... to get the correct er configs.


NOTE:

If you do not want to change the config fuses, the MCU must run on an external 16MHz oscillator. Please change any delay() and Millis() values to actual ms values.


Sleep


By placing the AtMega328P in SLEEP mode, one can further reduce the power. In SLEEP mode, most of the MCU interfaces are turned off. In this mode, the MCU can draw as little as 0.001mA. However, the MCU is no longer running, or in this case, measuring the voltage.


A watchdog time is used to wake the MCU from SLEEP. Setting up the watchdog timer to wake up the MCU every 8 seconds, will ensure that the power used is even less.

Results of power saving


By using the above power saving techniques, I was able to reduce the current of the circuit down from 80mA to as low as 0.12mA when the device is in SLEEP mode. Overall, the circuit uses about 0.28mA.


Thus, before power saving the circuit will drain a 7Ah battery in about 2.8 days.


After power saving, it will take around 3.5 years for the circuit to drain the same battery.

I used the free version of Eagle to design the PCB. All components, except the push button, are mounted onto the PCB. Assembly is easy, with the exception of soldering the LEDs. Ensure all LEDs are the same height. I used 20mm spacer to mount the unit, and used this as reference for the LED height.


Because my design uses a 3.3V regulator, some standard 5V piezo buzzers do not work. The buzzer in the design is connected across 12V, and switched with a transistor. Play around with the value of R6 to get a decent sound out of the buzzer, without destroying it. Apart from this, there is no other tricks in building the circuit.

No comments:

Post a Comment

Post Top Ad

Pages