Arduino Projects

# Arduino Voltage Sensor which measures up to 25V DC

## Learn how to interface 0-25V DC voltage detection sensor with Arduino to measure DC voltages up to 25 Volts.

Table of Contents

## Overview:

In this Arduino Project, you will learn how to build an Arduino voltage sensor which can measure the DC voltages ranging from 0 to 25 Volts. This works as a DC voltmeter with maximum 25V.

As you all know Arduino and few other microcontroller can measure up to 5V directly from the analog pins, but if you want to measure the voltage beyond 5V, it is not possible and even if you connect more than 5V the chip may get damaged or burnt. So, with the help of this Voltage sensor we can measure up to 25V from Arduino Analog pins.

So, in this article we teach you, the principle of this voltage sensing module, how it works and how to interface it with Arduino and display the voltage values on 16X2 LCD display with I2C adapter and where it is useful.

## Required components:

• Arduino Microcontroller
• Voltage sensor module
• 16X2 LCD display with I2C
• Few connecting wires

## Voltage Detection sensor Module overview:

This Voltage sensor is small and low cost module whose principle is based on Resistive voltage divider circuit. With the help of it the voltage is divided by 5. Which makes the voltage 5 times smaller, 25/5=5 thus with this we can measure up to 25V.

Arduino AVR chips have 10-bit ADC, so this module simulates a resolution of 0.00488V (5V/1024), so the minimum voltage of input voltage detection module is 0.00488Vx5(for 25v)=0.02440V.

• For 5V systems the input voltage should not be greater than 25V
• For 3.3V system the input voltage should not be greater than 16.5v as 3.3X5=16.5.

### Technical specifications:

• Voltage input range: DC 0-25V
• Voltage detection range: DC 0.02440V-25V
• Output signal type: Analog
• Voltage Analog Resolution: 0.00489V

### Voltage sensor module pinout:

From the above pinout diagram we can notice there are 5 pins to voltage sensor module. 3 pins are male head connectors which are to be connected to Arduino and other 2 pins has a plastic screw pin terminals where the voltage to be measured is connected.

• VCC: Positive terminal for the external voltage source (0-25v)
• GND:Â Negative terminal for the external voltage source (0-25v)
• S: signal pin or Analog output pin
• +: Not connected
• -: Ground pin

### Build Own voltage sensor using below Schematic diagram:

As we already discussed this sensor works with the principle of voltage divider circuit. we can even build the circuit by our own with a very few components as 2 resistors 7.5KÎ© and 30KÎ©. This circuit reduces the voltage by 5 times. Follow the below schematic diagram to build own voltage sensor with range 0-25V DC.

As you can see from the above 2 resistors are connected in series and signal pin is connected between them.

## Circuit Diagram to interface voltage sensor with Arduino

Connect all the required components according to the below circuit diagram.

As you can see from the above circuit diagram the voltage detection sensor module signal pin S is connected to Analog pin A0 of Arduino. The – pin of sensor is connected to GND pin of Arduino. On the other side the voltage to be measured whose +ve and -ve pins are connected to VCC and GND respectively.

The LCD display has 4 pins 2 pins for power and 2 pins for communication. The power pins VCC and GND of LCD display are connected to 5V and GND of Arduino. The communication pins SDA and SCL are connected to A4 and A5 of Arduino respectively.

Not only Arduino UNO microcontroller but also you can use Arduino NANO, etc.,

Thats it for connection, If you want to interface this with LCD display with out I2C adapter refer this article:Â Interfacing LCD Display with Arduino in detail.

If you want to display the output on the OLED display refer this article:Â Interfacing SSD1306 OLED display with Arduino.

Now its time to upload the code

## Program code for Arduino Voltage sensor

Now its time to upload the code. connect Arduino to a PC where Arduino IDE is installed. Choose the board asÂ Arduino UNOÂ or which ever you use and select the correct port from the Tools menu. Install required libraries from the built in Library manager or you can download the latest version from the below links

### Required Libraries:

• Download LiquidCrystal_I2C â€“Â Link

Next copy the below code and paste it in IDE workspace and press upload button. Thatâ€™s it the code will be uploaded.

After uploading the code open serial monitor to check the values. The LCD display also shows the voltage values connected to the sensor.

## Measuring Battery voltage using Voltage sensor with Arduino:

As an experiment lets connect a 12 volts battery from a bike and check the voltage of it. The voltage value is displayed on LCD display so this device can be portable.

## Measuring Solar panel voltage using Voltage sensor with Arduino:

As an experiment lets connect a 12 volts battery from a bike and check the voltage of it.

If you like this project please subscribe to ourÂ YouTube Channel â€œCircuit Schoolsâ€œÂ to encourage us to publish more interesting projects. If you have any doubts write to us from below comment section.

### CircuitSchools Staff

We at CircuitSchools publish on basics of electronics and electric components and everything related to evolution of electrical technology with complete analysis of development boards and modules along with latest projects with innovative ideas.

### 2 Comments

1. Angelina says:

I really liked your tutorial, thank you for all the details which you mentioned. I used this to measure analog reading from a sensor which has output up to 9v.

2. MasterCATZ says:

How do you do Multiple Batteries in a bank ?

I just tried and blew everything up when I connected to the second battery

I have 4x 12v batteries in series and 4x voltage dividers , I had all the Ground pins on the sensor side going to a common Ground and all the Sensor pins going to their own adc pins , connected first 12v battery it showed exactly /5th the voltage , awsome , connected the second voltage divider to the next battery magic smoke everywhere

Divider1- \ -+/ Divider1+ ___ Divider2- \ -+/ Divider2+___ Divider3- \ -+/ Divider3+ ___ Divider4- \ -+/ Divider4+

Check Also
Close