▷ How to make a DC digital voltmeter using Arduino?

Contents

A voltmeter is a voltage measuring device used to measure the voltage at certain points in an electrical circuit. Voltage is the potential difference that is created between two points in an electrical circuit. There are two types of voltmeters. Some voltmeters are designed to measure the voltage of DC circuits and other voltmeters are designed to measure the voltage in AC circuits.. These voltmeters are further characterized into two categories. One is the digital voltmeter that shows the measurements on a digital screen and the other is an analog voltmeter that uses a needle to point on the scale to show us the exact reading.

1-2-25-3533003Digital voltmeter

In this project, let's make a voltmeter using Arduino Uno. We will explain two settings of a digital voltmeter in this article. In the first configuration, the microcontroller will be able to measure the voltage in the range of 0 – 5V. In the second configuration, the microcontroller will be able to measure the voltage in the range of 0 – 50V.

How to make a digital voltmeter?

As we know, there are two types of voltmeters, the analog voltmeter and the digital voltmeter. There are other types of analog voltmeters that are based on the construction of the device. Some of these types include permanent magnet moving coil voltmeter, rectifier type voltmeter, moving iron type voltmeter, etc. The main objective of the introduction of the digital voltmeter in the market was due to the greater probability of errors in analog voltmeters. Unlike the analog voltmeter, using a needle and a scale, digital voltmeter displays readings directly in digits on the display. This eliminates the possibility of zero error. The percentage of error is reduced from 5% to 1% when we have gone from the analog voltmeter to the digital voltmeter.

Now that we know the summary of this project, let's gather more information and start making a digital voltmeter using Arduino Uno.

Paso 1: compilation of components

The best approach to starting any project is to make a list of components and do a short survey of these components because no one will want to be left in the middle of a project just because a component is missing.. Here is a list of components that we will use in this project:

Paso 2: study the components

Arduino UNO is a microcontroller board that consists of an ATMega 328P microchip and is developed by Arduino.cc. This board has a set of digital and analog data pins that can be interconnected with other expansion boards or circuits. This board has 14 digital pins, 6 analog pins and is programmable with Arduino IDE (Integrated development environment) via USB type B cable. Requires 5V to turn on and a C code to work.

arduino-1-3889126Arduino uno

LCD screens are seen in all electronic devices that have to display some text or digit or any image to users. An LCD screen is a display module in which liquid crystal is used to produce a visible image or text. An LCD screen of 16 × 2 it is a very simple electronic module that shows 16 characters per line and a total of two lines on your screen at a time. A pixel array of 5 × 7 to display a character on these LCD displays.

lcd-4440262LCD screen 16 × 2

A breadboard is a solderless device. Used to make and test temporary prototypes of electronic circuits and designs. Most electronic components are simply connected to a breadboard by simply inserting its pins into the breadboard.. A strip of metal is placed in the holes of the breadboard and the holes are connected in a specific way. The hole connections are shown in the following diagram:

breadboard-03-1-7386078Bulletin board

Paso 3: circuit diagram

The first circuit whose measurement range is 0 a 5 V is shown below:

1-1-1-4203689Voltmeter for 0-5 V

The second circuit, whose measuring range is 0 a 50 V, shown below:

1-2-5917588Voltmeter 0-50V

Paso 4: Operating principle

The operation of this Arduino based digital DC voltmeter project is explained here. On the digital voltmeter, the voltage being measured in analog form will be converted to its corresponding digital value using an analog to digital converter.

In the first circuit whose measuring range is 0 a 5 V, the input will be taken on the pin 0 analogical. The analog plug will read any value between 0 Y 1024. Later, this analog value will be converted to digital by multiplying it by the total voltage, which is 5V and dividing it by the total resolution, What is it 1024.

In the second circuit, since the range must be increased from 5 V a 50 V, a voltage divider setting must be performed. The voltage divider circuit is made using a resistor of 10 kohms and a resistance of 100 kohmios. This voltage divider setting helps us bring the input voltage into the range of the Arduino Uno's analog input.

All mathematical calculations are done in Arduino Uno programming.

Paso 5: assemble the components

The connection of the LCD module to the Arduino Uno board is the same in both circuits. The only difference is that in the first circuit, input range is low, so it is sent directly to the Arduino's analog pin. In the second circuit, a voltage divider configuration is used on the input side of the microcontroller board.

  1. Connect the Vss and Vdd pin of the LCD module to the ground and 5V of the Arduino board respectively. The Vee pin is the pin that is used to adjust the screen constraints. It is connected to the potentiometer whose pin is connected to 5V and the other to ground.

  2. Connect the RS and E pin of the LCD module to pin2 and pin3 of the Arduino board respectively. LCD display RW pin is grounded.

  3. Since we will use the LCD module in data mode of 4 bits, its four pins D4 to D7 are used. Pins D4-D7 of the LCD module are connected to pin 4-pin7 of the microcontroller board.

  4. In the first circuit, there are no additional circuits on the input side because the maximum voltage to be measured is 5V. In the second circuit, since the measuring range is 0-50 V, A voltage divider configuration is made using a resistor of 10 kohms and a resistance of 100 kohmios. Note that all ground connections are common.

Paso 6: start with Arduino

If you are not familiar with the Arduino IDE before, don't worry because below you can see the clear steps to write the code to the microcontroller board using the Arduino IDE. You can download the latest version of Arduino IDE from here and follow the steps mentioned below:

  1. When the Arduino board is connected to your PC, open the “Control Panel” and click “Hardware and sound”. Then click “Devices and printers”. Find the name of the port your Arduino board is connected to. In my case it is “COM14” but it may be different on your PC.receiver-circuit-diagram-of-arduino-based-blind-stick-project-1-7-5406361Find the port

  2. We will have to include a library to use the LCD module. The library is attached below in the download link along with the code. Go to Sketch> Include library> Add .ZIP library.include-library-1-8269228Inclusion Library

  3. Now open the Arduino IDE. From Tools, set the arduino board to arduino / Genuine UNO.sdf-2-1-9931556Configuration table

  4. In the same tools menu, set the port number you saw in the control panel.setting-port-4-4474746Configuration port

  5. Download the attached code and copy it to your IDE. To load the code, click upload button.jk-3-7-3846163Increase

You can download the code by clicking here.

Paso 7: Code

The code is quite simple and well commented. But still, something is explained below.

1. At first, the library is used so that we can connect the LCD module with the Arduino Uno board and program it accordingly. Later, the pins of the Arduino board that will be used to connect to the LCD module are initialized. Later, different variables are initialized to store values ​​at run time to be used later in calculations.

#include "LiquidCrystal.h"           // include the library to interface the LCD module with the Arduino board
LiquidCrystal lcd(2, 3, 4, 5, 6, 7); // LCD module pins to use
float voltage = 0.0;
temp. float = 0.0; // variable to store the digital value of the input
int analog_value; // variable to store the analog value at the input

2. void setup () It is a one-time function when the device is started or the activation button is pressed. Here we have initialized the LCD screen to boot. When the LCD screen is turned on, the text “Arduino-based digital voltmeter” will appear. Baud rate is also set in this function. Baud rate is the rate in bits per second that the Arduino communicates with external devices.

avoid setup()
{
lcd.begin(16, 2); // start communication with LCD
lcd.setCursor (0,0); // start the cursor from the beginning
lcd.print(" Based on Arduino "); // Print the text on the first line
lcd.setCursor(0,1); // Move the cursor to the next line
lcd.print("Digital voltmeter"); // second line print text
delay (2000); // wait two seconds
}

3. void loop () is a function that runs continuously in a loop. Here the analog value is read on the input side. This analog value is then converted to digital format. A condition is applied and the final measurements are displayed on the LCD..

avoid the loop()
{
analog_value = analogRead(A0); // Analog value reading
temp = (analog_value * 5.0) / 1024.0; // convert analog value to digital
voltage = temp /(0.0909);
and (voltage < 0.1)
{
voltage = 0.0;
}
lcd.clear(); // Clear any text on the LCD
lcd.setCursor(0, 0); // Move the cursor to the starting position
lcd.print("Voltage= "); // Print Voltgae=
lcd.print(voltage); // Print final digital value of voltage
lcd.setCursor(13,1); // move the cursor
lcd.print("V"); // print the voltage unit
delay(30); // waiting 0,3 seconds
}

Applications

Some of its applications for a digital voltmeter include:

  1. The circuit made above can be used to measure different ranges of voltages with high precision in any electrical circuit.

  2. If we make small changes in the circuit, the microcontroller will also be able to measure the voltage in AC circuits.

Subscribe to our Newsletter

We will not send you SPAM mail. We hate it as much as you.