Arduino Projects

Arduino Voltage Sensor Module: Measure Battery Level Voltage

Hello dear reader , in this tutorial we will be talking about the Arduino Voltage Sensor Module: Measure Battery Level Voltage with. The Arduino Voltage Sensor Module is a voltage sensing module that can be interfaced with an Arduino for measuring DC voltages within 2V – 25V. To read more about the technical details, go to shop.

The voltage sensor

Components Used for Project Tutorial:

In this practical, we will be using the Following Component.

All these components can be bought on our online store. Alternatively, if you can’t find them, leave us a message on WhatsApp or Telegram group for assistance or in the comment section way down below.

Arduino Voltage Sensor Module: The Principle of Operation

Arduino Voltage sensor module pinout

The Voltage sensors are made up of  the following input pinouts (VCC and GND) socket – (which can take in Maximum Voltage of 25v). These pinouts are used for measuring the voltage. On the other side, it has 3 pins which contains (VCC, GND and S where S is the Analog pin that can be connected to Arduino).

The internal circuit of the voltage sensor

The Arduino Sensor Module contains 2 Resistors 30kΩ and 7.5kΩ that uses the principle voltage divider rule. This is given in the Equation as:

Read up more on this this link. Let us proceed to how to hook this up to an Arduino Uno board and use it to measure DC voltage, rechargeable battery and Solar panel up to 24V DC.

Arduino Voltage Sensor Module Measure battery voltage level

The Circuit Diagram for 3V Battery Measurement

3V Battery measurement

To use the Arduino Voltage Sensor Module with Arduino Uno board, the 3 pins of the Voltage sensors are connected to Arduino Uno as shown above. In which, the VCC is connected to 5V. The GND is also connected to the GND of the Arduino. The “S” which is the Analog pins slot is connected to the Analog part on the Arduino board, which could be connected to (A0, A1, A2, A3 and …). For this project we used the A1 analog pin on the Arduino Uno board. To read the battery level for a 3V battery, the above circuit was used.

The Source Code (Arduino Sketch)

float PVr1 = 30000.0;
float PVr2 = 7500.0;
float batteryVoltSensor, vinBattery;
const int voltagePinBattery = A0;

void setup() {
  Serial.begin(9600);
   dht.begin();
Serial.println("Now in Setup");
Serial.println("Now exiting Setup function");
}

void loop(){ 
Serial.println("Now in loop function");

  //now doing calculations
  batteryVoltSensor = analogRead(voltagePinBattery);
 batteryVoltSensor = (batteryVoltSensor * 5.0)/1023.0;
 vinBattery = batteryVoltSensor/(PVr2/(PVr1+PVr2));

Serial.println(vinBattery);

Serial.println("Now exiting loop function");
 delay(1000);
}

Results

Digital Multimeter and Serial monitor comparism

The Circuit Diagram for 5V Battery Measurement

5V Battery measurement

The Source Code (Arduino Sketch)

float PVr1 = 30000.0;
float PVr2 = 7500.0;
float batteryVoltSensor, vinBattery;
const int voltagePinBattery = A0;

void setup() {
  Serial.begin(9600);
   dht.begin();
Serial.println("Now in Setup");
Serial.println("Now exiting Setup function");
}

void loop(){ 
Serial.println("Now in loop function");

  //now doing calculations
  batteryVoltSensor = analogRead(voltagePinBattery);
 batteryVoltSensor = (batteryVoltSensor * 5.0)/1023.0;
 vinBattery = batteryVoltSensor/(PVr2/(PVr1+PVr2));

Serial.println(vinBattery);

Serial.println("Now exiting loop function");
 delay(1000);
}

Results for 5V Battery Level on Arduino Voltage Sensor Module: Measure Battery Level Voltage

Digital Multimeter and Serial monitor comparism

The Circuit Diagram for 9V Battery Measurement

Measuring 9V battery level

The Source Code (Arduino Sketch)

float PVr1 = 30000.0;
float PVr2 = 7500.0;
float batteryVoltSensor, vinBattery;
const int voltagePinBattery = A0;

void setup() {
  Serial.begin(9600);
   dht.begin();
Serial.println("Now in Setup");
Serial.println("Now exiting Setup function");
}

void loop(){ 
Serial.println("Now in loop function");

  //now doing calculations
  batteryVoltSensor = analogRead(voltagePinBattery);
 batteryVoltSensor = (batteryVoltSensor * 5.0)/1023.0;
 vinBattery = batteryVoltSensor/(PVr2/(PVr1+PVr2));

Serial.println(vinBattery);

Serial.println("Now exiting loop function");
 delay(1000);
}

Results for 9V Battery Level on Arduino Voltage Sensor Module: Measure Battery Level Voltage Project

Serial Monitor Print

The Circuit Diagram for 12V Battery Measurement

12V Battery Level Measurement

The Source Code (Arduino Sketch)

float PVr1 = 30000.0;
float PVr2 = 7500.0;
float batteryVoltSensor, vinBattery;
const int voltagePinBattery = A0;

void setup() {
  Serial.begin(9600);
   dht.begin();
Serial.println("Now in Setup");
Serial.println("Now exiting Setup function");
}

void loop(){ 
Serial.println("Now in loop function");

  //now doing calculations
  batteryVoltSensor = analogRead(voltagePinBattery);
 batteryVoltSensor = (batteryVoltSensor * 5.0)/1023.0;
 vinBattery = batteryVoltSensor/(PVr2/(PVr1+PVr2));

Serial.println(vinBattery);

Serial.println("Now exiting loop function");
 delay(1000);
}

Results

The Circuit Diagram for 24V Battery Measurement

The circuit diagram for 24V connection

The Arduino Sketch

float PVr1 = 30000.0;
float PVr2 = 7500.0;
float batteryVoltSensor, vinBattery;
const int voltagePinBattery = A0;

void setup() {
  Serial.begin(9600);
   dht.begin();
Serial.println("Now in Setup");
Serial.println("Now exiting Setup function");
}

void loop(){ 
Serial.println("Now in loop function");

  //now doing calculations
  batteryVoltSensor = analogRead(voltagePinBattery);
 batteryVoltSensor = (batteryVoltSensor * 5.0)/1023.0;
 vinBattery = batteryVoltSensor/(PVr2/(PVr1+PVr2));

Serial.println(vinBattery);

Serial.println("Now exiting loop function");
 delay(1000);
}

Result for 24V Battery Level on Arduino Voltage Sensor Module: Measure Battery Level Voltage Project

24V Battery measurement

Explanation of Circuit Diagram

The circuit diagram for 3.3V, 5V, 9V, 12V and 24V uses the same source code (Arduino Sketch) given below. The battery level can be increased from 3.3V to 24V. and connected as shown above. Once this was done, connect the Arduino Uno board to the Personal Computer (PC), power up the Arduino IDE and copy the sketch given below.

Conclusion

The serial monitor printing show that we can measure or take the reading of various DC voltage levels of batteries ranging from 3V to 24V via the Analog pins on the Arduino, using the Serial Monitor on the Arduino IDE.

So what do you think about this tutorial? Can you reproduce this? or make further modifications to it? Let us know if you tired it and built you in the comment section below.
Thank you.

smartechlabs

Recent Posts

Read The Alpha’s Warlock Ebook Here

The Alpha's Warlock In "The Alpha's Warlock," the narrative centers around two main characters: Alpha Kael,…

11 hours ago

Embracing Imperfections: The Path to a Happier Life

embracing imperfections  Let’s talk about something that touches each of our lives in one way…

22 hours ago

History of The Cold War: A Tense Standoff

The Cold War: A Tense Standoff Introduction The Cold War was not just a period…

1 day ago

The Birth of Bitcoin: A Digital Revolution

The Birth of Bitcoin Introduction In a world where traditional finance often feels cumbersome and…

1 day ago

Read The Broken Mute’s Revenge Ebook Here

The Broken Mute’s Revenge In "The Broken Mute's Revenge," the story revolves around a young…

1 day ago

Fostering Student Autonomy: Self-Directed Learning Strategies for Success

Introduction Imagine a classroom where students take the reins of their own education, setting their…

3 days ago

This website uses cookies.