0% found this document useful (0 votes)
8 views14 pages

ExperimentNo2

The document describes how to create a digital voltmeter using an Arduino Uno, interfacing the built-in ADC with an LCD display. It explains the ADC's specifications, the logic for measuring voltage, and how to connect an I2C LCD for easier data transfer. Sample code is provided to display the measured voltage on the LCD and serial monitor.

Uploaded by

amit24082004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views14 pages

ExperimentNo2

The document describes how to create a digital voltmeter using an Arduino Uno, interfacing the built-in ADC with an LCD display. It explains the ADC's specifications, the logic for measuring voltage, and how to connect an I2C LCD for easier data transfer. Sample code is provided to display the measured voltage on the LCD and serial monitor.

Uploaded by

amit24082004
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Digital Voltmeter using

Arduino Uno
Introduction
• A simple digital Voltmeter can be made by connecting the input voltage
to ADC and its output to a digital Display.
• Here the built in ADC of Arduino can be interfaced with an LCD display
• Simple code is to be written to format the ADC output to the desired style.
ADC unit on Arduino Board
• 10 bit successive approximation ADC
• Maximum of 15kSPS sampling rate
• Conversion time from 65 micro seconds
• Resolution of 1 LSB
• Voltage range 0-Vcc
• several multiplexed input pins for the analog voltage input.
Logic behind the voltmeter.
• The voltage to be measured can be given at any analog pin
• ADC will convert it to a 10 bit count (minimum 0 maximum 1023)
• Need to calculate the resolution of the ADC.
• The function analogRead() will give the digital count of the input quantity.
• The digital count shall be converted into its corresponding voltage.
• The converted value shall be displayed onto LCD as well as on the serial
monitor.
Interfacing an I2C LCD display
• Normally available LCD display is 16 x 2 display screen with 16 pins.
• To make the connections easier, we can use an LCD with in built I2C
module.
• I2C module makes it possible to transfer data between Arduino board and
display unit by using 4 wires. ( Two lines for Vcc and GND, third for clock
and 4th for serial data)
I2C Module
• Module that helps to transfer data from Arduino board to any peripheral
by using a specific serial communication protocol
• I2C stands for inter integrated communication
• It is a protocol by which communication between multiple masters and
multiple slaves are possible.
• Each master or slave is identified with the help of the device address.
I2C protocol

8
Message Frame

Master wants to read from or write into theAcknowledgement


slave from the slave

9
I2C module available in the lab
Working
• PCF8254 chip does the serial to parallel conversion
• The address of the device depends on the manufacturing company and
the value of A2, A1 and A0

Texas Instruments NXP Semiconductors

For TI chip, address can be varied from 0x20 to 0x27


For NXP chip, address can be 0x38 to 0x3F
Interfacing an LCD display
 To interface the LCD we need to include the header file or library
 #include <LiquidCrystal_I2C.h>
 We need to create an instance of the class LiquidCrystal_I2C
 Within the setup() function we need to initialize the LCD device using the code
 lcd1.begin(address, 16,2);
 Any data ( an output variable or a constant text) can be displayed onto the
LCD by using the code lcd1.print();
 The cursor of the LCD device can be moved to the beginning of the second
line by using the code lcd1.setCursor(0,1);

column row
Connection Diagram
Sample code for the voltmeter
#include <LiquidCrystal_I2C.h> void loop()

LiquidCrystal_I2C lcd(0x3F,16,2); // I2C module {


address is set as 0x3F and LCD has 16 chars and int digcount=analogRead(A3);
2 line display float Vout=digcount*5.0/1023;
lcd.clear();
void setup() { lcd.setCursor(0,0);
lcd.init(); lcd.print("Voltage is");
lcd.clear(); lcd.setCursor(0,1);
lcd.backlight(); // Make sure backlight is on lcd.print(Vout);
delay(5000);
// Print a message. }
lcd.setCursor(4,0); //Set cursor to character 4
on line 0
lcd.print("Hello world!");

You might also like