ExperimentNo2
ExperimentNo2
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
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
column row
Connection Diagram
Sample code for the voltmeter
#include <LiquidCrystal_I2C.h> void loop()