Arduino battery level monitor using 15 leds (1.5V or 1.2v battery)

I am here with new project call battery level monitor, Project is Arduino compatible and display battery level using 15  LED’s bars, Arduino code is return to test the 1.5V battery however 1.2V alkaline battery also can be check. The circuit provides 0.1V resolution , means each LED’s display 0.1V.  Project required 5V supply.

Note : This Arduino compatible project required boot loader burning and Arduino programing , Connector CN1  provided for boot-loader burning and Arduino programing.

Arduino Code Programing ( CN1) Connector

You need a USB-to-serial converter or Arduino UNO without Atmega 328 to program this board. There are pin outs on the board for programming the Atmega328P. You need to connect RX, TX, 5V and GND. Then upload the code to the board with the Arduino software.


Arduino Code

* 15 LED’s Bargraph Battery Level Indicator
*visit https// for code, schematic, PCB layout


// these constants won’t change:
const int analogPin = A3; // the pin that the potentiometer is attached to
const int ledCount = 15; // the number of LEDs in the bar graph

int ledPins[] = {
3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, A0, A1, 0, 2
}; // an array of pin numbers to which LEDs are attached

void setup() {
// loop over the pin array and set them all to output:
for (int thisLed = 0; thisLed < ledCount; thisLed++) {
pinMode(ledPins[thisLed], OUTPUT);

void loop() {
// read the potentiometer:
int sensorReading = analogRead(analogPin);
// map the result to a range from 0 to the number of LEDs:
int ledLevel = map(sensorReading, 0, 306, 0, ledCount);

// loop over the LED array:
for (int thisLed = 0; thisLed < ledCount; thisLed++) {
// if the array element’s index is less than ledLevel,
// turn the pin for this element on:
if (thisLed < ledLevel) {
digitalWrite(ledPins[thisLed], HIGH);
// turn off all pins higher than the ledLevel:
else {
digitalWrite(ledPins[thisLed], LOW);

Leave a Reply

Your email address will not be published. Required fields are marked *