digital voltmeter by using arduino by · 1-to design digital voltmeter by using arduino. 2-measure...

53
DIGITAL VOLTMETER BY USING ARDUINO BY HAWRAA AMIN ABDUL AL-HUSSIEN SARAH MHAWI HUNDULL GHADEER MOHAMMED SHAHAM A project report submitted to the Department of Electrical Engineering College of Engineering / Maysan University In partial fulfillment of the requirement for the award of the degree of Bachelor of Electrical Engineering 2018 Maysan University College of Engineering Electrical Engineering Department

Upload: others

Post on 25-Mar-2020

109 views

Category:

Documents


10 download

TRANSCRIPT

Page 1: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

DIGITAL VOLTMETER BY USING

ARDUINO BY

HAWRAA AMIN ABDUL AL-HUSSIEN

SARAH MHAWI HUNDULL

GHADEER MOHAMMED SHAHAM

A project report submitted to the

Department of Electrical Engineering

College of Engineering / Maysan University

In partial fulfillment of the requirement for the award of the

degree of Bachelor of Electrical Engineering

2018

Maysan University

College of Engineering

Electrical Engineering Department

Page 2: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

APPROVAL FOR SUBMISSION

I certify that this project report entitle "DIGITAL VOLTMETER

BY USING ARDUINO" was prepared by (HAWRAA AMIN ABDUL-

ALHUSSIEN , SARAH MHAWI HUNDULL , GHADEER MOHAMMED

SHAHM) has met the required standard for submission in partial

fulfillment of the requirements for the award of Bachelor of

Electrical Engineering at University of Misan.

Approved by:

Signature:

Supervisor:

Date:

Page 3: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

Certificate of Examiners

We certify , as an examining committee , that we have read this

project report entitled " DIGITAL VOLTMETER BY USING

ARDUINO " examined the students (HAWRAA AMIN ABDUL-

ALHUSSIEN ,SARAH MHAWI HANDULL, GHADEER MOHAMMED

SHAHAM) in its contents and found the project meets the

standard for degree of B.Sc. in Electrical Engineering.

Signature: Signature:

Name: Name

Date: Date:

Signature: Signature:

Name: Name:

Date: Date:

Page 4: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

ACKNOWLEDGEMENTS

I would like to thank everyone who contributed to the successful

completion of this project. I would like to express my gratitude to my

research supervisor, SADIQ FARHAN for his invaluable advice,

guidance and his enormous patience throughout the development of

the research.

Page 5: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

ACKNOWLEDGEMENTS

Days of our life we started a step and here we are. Today, pick

the fruits of the march of years, our goal was clear and we sought

every day to achieve it and reach him no matter how difficult.

Today, we stand before you and here we are, with a torch of

knowledge, and we will be very careful not to shut down. We

thank god first and foremost for helping us to do so. Then we

thank the loving heart of those who were beside us in all the

stages that have passed from pleasure to suffering, and his

candle was burning to illuminate our path to our granular

mothers. And to whom we know to stand and how to start a

thousand miles to our right hand to our knowledge of the

ascension and his eyes watching us …. Dad. For those who hold

our hands and teach us characters. Character. We will dedication

him our success today to those who supported us. To those who

have the merit of guiding us to the path of knowledge and

knowledge to our distinguished professors, how proud we are of

you. Our friends and loved ones and who watched with us in our

scientific journey to those who stretched out their white hands

in the darkness of the night. They were helpful to us. Beautiful

days we spent now live a moment … At a moment and feel like a

bar passes through our imagination again a year and a day … and

a days. We will not forget you. We will not forget this place

where we gathered with its seats and doors up to its interior to

every part.

Page 6: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

Abstract

It's easy to make a simple digital voltmeter using an Arduino

and 16x2 liquid crystal display (LCD). It's relatively simple to

use an Arduino to measure voltages. The Arduino has several

analog input pins that connect to an analog-to-digital converter

(ADC) inside the Arduino. The Arduino ADC is a ten-bit

converter, meaning that the output value will range from 0 to

1023. We will obtain this value by using the analogRead()

function. If you know the reference voltage--in this case we will

use 5 V--you can easily calculate the voltage present at the

analog input.

To display the measured voltage, we will use a liquid crystal

display (LCD) that has two lines of 16characters. LCDs are widely

used to display data by devices and it has a lot of electrical

appliances.

This project will also show you how to measure voltages above

the reference voltage by using a voltage divider.

i

Page 7: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

TABLE OF CONTENTS

Abstract-------------------------------------------------------------------------i

Table of contents--------------------------------------------------------------ii

List of table---------------------------------------------------------------------iv

List of Abbreviations---------------------------------------------------------v

List of Figures-----------------------------------------------------------------vii

Chapter One: General Introduction---------------------------------------1

1.1 Introduction------------------------------------------------------2

1.2 Objectives--------------------------------------------------------3

1.3 Literature review---------------------------------------------------------3

1.4 Voltage measurement---------------------------------------------------4

1.5 Digital Voltmeter--------------------------------------------------------5

1.6 Scope of report------------------------------------------------------------6

Chapter two: Implementation of Digital Voltmeter using Arduino-7

2.1 Introdution--------------------------------------------------------------9

ii

Page 8: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

2.2 Digital Voltmeter ------------------------------------------------10

2.3 Component of Digital Voltmeter ---------------------------11

2.3.1 Arduino -------------------------------------------------------11

2.3 .2 LCD-------------------------------------------------------------19

2.3.3 Potentiometer-------------------------------------------------------21

Chapter three: Design and Implementation--------------------------22

3.1 Circuit Diagram---------------------------------------------------------23

3.2 Circuit Design------------------------------------------------------------24

3.3 Circuit Working---------------------------------------------------------26

3.4 Problems------------------------------------------------------------------27

3.5 Programming------------------------------------------------------------28

3.6 Flow Chart of pro--------------------------------------------------------32

3.7 Examples of Voltage----------------------------------------------------33

Chapter Four: Conclusion and Future Work--------------------------35

4.1 Conclusion----------------------------------------------------------------36

4.2 Future Work--------------------------------------------------------------37

REFERENCES------------------------------------------------------------------38

iii

Page 9: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

List of Table

Table (2-1) Features of Arduino Uno 328p---------------------------12

iv

Page 10: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

List of AbbreviationS

DVM Digital Voltmeter

ADC Analog to Digital Conversion

LCD Liquid Crystal Display

LED Light Emitting Diode

PWM Pulse Width Modulation

GND Ground

USB Universal Serial Bus

SRAM Static Random Access Memory

POT Potentiometer

AREF Analog Reference

I/O Input/Output

SPI Serial Peripheral Interface

RS Register Select

TX Transmitter

RX Receiver

v

Page 11: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

VI Input Voltage

VO Output Voltage

VSS Source Voltage

VDD Drain Voltage

RW Read/Write

TTL Time To Live

SDA Stands for Serial Data

SCL Serial Clock

TWI Two Wire Interface

vi

Page 12: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

List of Figure

Figure (1-1) Basic DVM block diagram----------------------------------2

Figure (2-1) Arduino Uno 328p-----------------------------------------13

Figure (2-2) Usb and Dc input -------------------------------------------14

Figure (2-3) Digital pins---------------------------------------------------15

Figure (2-4) Analog pins--------------------------------------------------16

Figure (2-5) Power pins---------------------------------------------------17

Figure (2-6) LCD -------------------------------------------------------------20

Figure (2-7) Potentiometer-----------------------------------------------21

Figure (3-1) Circuit diagram----------------------------------------------23

Figure (3-2) Circuit design------------------------------------------------25

Figure (3-3) Examples of voltages--------------------------------------33

Figure (3-4) Examples of voltages---------------------------------------34

Figure (4-1) Digital multimeter device--------------------------------37

vii

Page 13: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER ONE GENERAL LNTRODUCTION

Chapter One

General Introduction

1-1 Introduction

1-2 Objective

1-3 Literature review

1-4 Voltage Measurment

1-5 Digital Voltmeter

1-6 Scope of report

1

Page 14: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER ONE GENERAL LNTRODUCTION

1-1 Introduction

A digital voltmeter (DVM) attains the required measurement by

converting the analog input signal into digital and when necessary by

discrete-time processing of the converted values. The measurement

result is presented in a digital form that can be coded as a decimal BCD

code or a binary code the main factors that characterize DVMs are

speed automatic operation and programmability in particular they

presently offer the best combination of speed and accuracy lf

compared with other available voltage-measuring instruments

moreover capability of automatic operations and program-mability

make DVMs very useful in application where flexibility high speed and

computer controllability are requied A typical application field is

therefore that of automatically operated systems when a DVM is

directly interfaced to a digital signal processing (DSP) and used to

convert the analog input voltage into a sequence of sampled values it is

usually called an analog-to-digital converter (ADC)

Figure (1-1)basic DVM diagram

2

Page 15: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER ONE GENERAL LNTRODUCTION

1-2 Objec ve

1-To design digital voltmeter by using arduino.

2-Measure the input voltage range between 0 to 50 by using

voltage divider.

3-Know how arduino works and how easy it is to use it.

1-3 Literature review

In this section the work related to the digital voltmeter is

expressed. There are many projects implemented for digital

voltmeter design. One of these projects used arduino Nano,

resistor 10k ohm, resistor 1k ohm and also used Liquid Crystal

Display (LCD) to display the voltage. But not use the

potentiometer. The analog sensor on the Nano board senses the

voltage on the analog pin and converts it into a digital format

that can be processed by the microcontroller. Here, the input

voltage is routed to an analog pin through a simple passive

voltage divider, and with the values shown it can measure dc

voltage in 0v to 55v range.[3]

Figure (1-2) circuit digital voltmeter uno 3

Page 16: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER ONE GENERAL LNTRODUCTION

1-4 Voltage measurement

Is one of the most basic measurements in the electronic measurement. Generally, an electronic measuring instrument is classified roughly by voltage measurement, current (or charge) measurement, and measurement of both (electric power and impedance). For example, the oscilloscope is a measuring instrument that displays the voltage value sensed by the tip of the probe on the screen as a time waveform, and it can be called a voltmeter in a broad sense because the physical value of the target measurement is the voltage. However, at present this is a measuring device focused on the high-speed response and sampling rate exceeding several GHz or more, and generally the precision and resolution of the voltage measurement is not high. The digital multi meter is the most basic ammeter and voltmeter, and various lineups like the hand-held type, bench top type etc. are available. It is most widely used for general voltage measurement because high accuracy and high resolution voltage measurement devices are available, though it does not match the oscilloscope with respect to speed. The electrometer has the function of current and voltage measurement similar to the digital multi meter. When focusing attention on the voltage measurement, it can be positioned with the voltmeter characterized by the high input resistance at the measuring terminal by comparing with the digital multi meter. The advantage of the voltage measurement using the electrometer is described in this document.

4

Page 17: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER ONE GENERAL LNTRODUCTION

1-5 Digital Voltmeter

A digital voltmeter (DVM) attains the required

measurement by converting the analog input signal into digital and

when necessary by discrete-time processing of the converted values.

The measurement result is presented in a digital form that can be

coded as a decimal BCD code or a binary code the main factors that

characterize DVMs are speed automatic operation and

programmability in particular they presently offer the best

combination of speed and accuracy lf compared with other available

voltage-measuring instruments moreover capability of automatic

operations and programmability make DVMs very useful in application

where flexibility high speed and computer controllability are required

A typical application field is therefore that of automatically operated

systems when a DVM is directly interfaced to a digital signal processing

(DSP) and used to convert the analog input voltage into a sequence of

sampled values it is usually called an analog-to-digital converter (ADC)

5

Page 18: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER ONE GENERAL LNTRODUCTION

1-6 Scope of report

This project consists of four chapters.

In chapter one,

Explanation introduction in general, and explain the digital voltmeter, and clarify the objectives of the project, and literature reviews that have relation with this project.

Chapter two,

Contains components of project these are explained through main components include arduino uno 328p, Liquid crystal display (LCD) and other components.

Chapter three,

Illustrates circuit diagram, design circuit, working circuit, the problems, program for project, flow chart of project and examples of voltages.

Chapter four,

Will discuss contains conclusion and future work.

6

Page 19: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER TWO LMPLEMENTATION of DIGITAL VOLTMETER

Chapter Two

Implementation of Digital Voltmeter using Arduino

2.1 Introduction

2.2 Digital Voltmeter

2.3 Component of Digital Voltmeter

2.3.1 Arduino

2.3 .2 LCD

2.3.3 Potentiometer

7

Page 20: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER TWO LMPLEMENTATION of DIGITAL VOLTMETER

2-3 Component of Digital Voltmeter

1-Arduino Uno 328p

2-LCD display (2*16)

3-100K Resistor

4-10k Resistor

5-5k potentiometer

6-Some jumper wires

7-Breadboard

8

Page 21: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER TWO LMPLEMENTATION of DIGITAL VOLTMETER

2.1 Introduction

A digital voltmeter, abbreviated as DVM, is a measuring

instrument that displays the value of an AC and DC voltage directly in

decimal numbers instead of a pointer deflection on a continuous scale.

The data output from a digital voltmeter may be fed directly into

memory devices for further computation and storage. DVM is an

accurate and versatile instrument used in many laboratory

applica ons.[1]

In this project we can use arduino's analog to digital converter (ADC)

pins to convert analog voltage values into number representation that

you can work with. The accuracy of an ADC is determined by the

resolution. In the case of the arduino uno, there is a 10-bit ADC for

doing your analog conversions. 10-bit means that the ADC can

subdivide (or quan ze) analog signal into 2^10 different values. If you

do the math, you'll find that 2^10 = 1024. Hence, the arduino can assign

a value from to 1023 for any analog value that you give it. Although it is

possible to change the reference voltage, you'll be using the default 5v

reference for the analog work. The reference voltage determines the

max voltage that you are expecting, and therefore, the value that will

be mapped to 1023. So, with a 5v reference voltage, pu ng 0v on an

ADC pin returns a value of 2.5v returns a value of 512(half of 1023) ,and

5v returns a value of 1023. [2]

9

Page 22: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER TWO LMPLEMENTATION of DIGITAL VOLTMETER

2.2 Digital voltmeter

A digital voltmeter (DVM) attains the required measurement by

converting the analog input signal into digital and when necessary by

discrete-time processing of the converted values. The measurement

result is presented in a digital form that can be coded as a decimal BCD

code or a binary code the main factors that characterize DVMs are

speed automatic operation and programmability in particular they

presently offer the best combination of speed and accuracy lf

compared with other available voltage-measuring instruments

moreover capability of automatic operations and program-mability

make DVMs very useful in application where flexibility high speed and

computer controllability are requied A typical application field is

therefore that of automatically operated systems when a DVM is

directly interfaced to a digital signal processing (DSP) and used to

convert the analog input voltage into a sequence of sampled values it is

usually called an analog-to-digital converter (ADC)

10

Page 23: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER TWO LMPLEMENTATION of DIGITAL VOLTMETER

2.3 Component of Digital voltmeter

2.3.1 Arduino Uno 328p

The Arduino Uno is a microcontroller board based on the

ATmega328 (datasheet). It has 14 digital input/output pins (of

which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz

ceramic resonator, a USB connection, a power jack, an ICSP

header, and a reset button. Shown in [4]

11

Page 24: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER TWO LMPLEMENTATION of DIGITAL VOLTMETER

Table 2-1 Features of Arduino Uno 328p.[5]

ATmega328p Microcontroller

5V Operating Voltage

7-12V Input Voltage

(recommended)

6-20V Input Voltage (limit)

14 (of which 6 provide PWM

output)

Digital I/O Pins

6 PWM Digital I/O Pins

6 Analog Input Pins

20 mA DC Current per I/O Pins

50 mA DC Current for 3.3V Pin

32 KB (ATmega328P) of which 0.5

KB used by boot loader

Flash Memory

2 KB (ATmega328P) SRAM

1 KB (ATmega328P) EEPROM

Page 25: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER TWO LMPLEMENTATION of DIGITAL VOLTMETER

16 MHZ Clock Speed

13 LED-BUILTIN

68.6 mm Length

53.4 mm Width

25 g Weight

It contains everything needed to support the microcontroller

shown in igure (2-1); simply connect it to a computer with a USB

cable or power it with an AC-to-DC adapter or battery to get

started.[6]

Figure (2-1) Arduino Uno 328p

13

Page 26: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER TWO LMPLEMENTATION of DIGITAL VOLTMETER

The Uno 328p can be powered vin the USB connection or with

an DC supply of 6 to 20 volts.

Figure (2-2) USB and DC input

If supplied with less than 7V however, the 5V pin may supply

less than five volts and the board may become unstable. If using

more than 12V, the voltage regulator may overheat and damage

the board. The recommended range is 7 to 12 volts.[6]

The digital pins are as follows:

Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX)

TTL serial data. On the Arduino Diecimila, these pins are

connected to the corresponding pins of the FTDI USB-to-TTL

Serial chip. On the Arduino BT, they are connected to the

corresponding pins of the WT11 Bluetooth module. On the

Arduino Mini and LilyPad Arduino, they are intended for use

with an external TTL serial module (e.g. the Mini-USB Adapter ) .

14

Page 27: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER TWO LMPLEMENTATION of DIGITAL VOLTMETER

External Interrupts: 2 and 3. These pins can be con igured to

trigger an interrupt on a low value, a rising or falling edge, or a

change in value. See the attach Interrupt() function for details.

PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the

analog Write() function. On boards with an ATmega8, PWM

output is available only on pins 9, 10, and 11.

BT Reset: 7. (Arduino BT-only) Connected to the reset line of the

bluetooth module.

SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins

support SPI communication, which, although provided by the

underlying hardware, is not currently included in the Arduino

language.

LED: 13. On the Diecimila and LilyPad, there is a built-in LED

connected to digital pin 13. When the pin is HIGH value, the LED

is on, when the pin is LOW, it's off.[7]

Figure (2-3) digital pins

15

Page 28: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER TWO LMPLEMENTATION of DIGITAL VOLTMETER

Analog Pins

In addition to the specific functions listed below, the analog

input pins support 10-bit analog-to-digital conversion (ADC)

using the analog Read() function. Most of the analog inputs can

also be used as digital pins: analog input 0 as digital pin 14

through analog input 5 as digital pin 19. Analog inputs 6 and 7

(present on the Mini and BT) cannot be used as digital pins.

I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI)

communication using the Wire library (documentation on the

Wiring website.[7]

Figure (2-4) analog pins

Power Pins

16

Page 29: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER TWO LMPLEMENTATION of DIGITAL VOLTMETER

VIN (sometimes labelled "9V"). The input voltage to the Arduino

board when it's using an external power source (as opposed to 5

volts from the USB connection or other regulated power source).

You can supply voltage through this pin, or, if supplying voltage

via the power jack, access it through this pin. Note that different

boards accept different input voltages ranges, please see the

documentation for your board. Also note that the LilyPad has no

VIN pin and accepts only a regulated input.

The regulated power supply used to power the

microcontroller 5V and other components on the board. This can

come either from VIN via an on-board regulator, or be supplied

by USB or another regulated 5V supply.

V3: (Diecimila-only) A 3.3 volt supply generated by the on-

board FTDI chip.

GND: Ground pins.[7]

Figure (2-5) power pins

17

Page 30: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER TWO LMPLEMENTATION of DIGITAL VOLTMETER

Other Pins:

AREF: Reference voltage for the analog inputs. Used with

analog Reference.

Reset: (Diecimila-only) Bring this line LOW to reset the

microcontroller. Typically used to add a reset button to shields

which block the one on the board.[7]

18

Page 31: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER TWO LMPLEMENTATION of DIGITAL VOLTMETER

2.3.2 Liquid Crystal Display (LCD)

LCD (Liquid Crystal Display) screen is an electronic display

module and ind a wide range of application. A 16x2 LCD display

is very basic module and is very commonly used in various

devices and circuits. These modules are preferred over seven

segments and other multi segment LEDs. The reasons being:

LCDs are economical; easily programmable; have no limitation

of displaying special & even custom characters (unlike in seven

segments), animations and so on.

A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers, namely, command and Data shown in igure (2-6).

The LCDs have a parallel interface, meaning that the microcontroller has to manipulate several interface pins at once to control the display. The interface consists of the following pins:

A register select (RS) pin that controls where in the LCD's memory you're writing data to. You can select either the data register, which holds what goes on the screen, or an instruction register, which is where the LCD's controller looks for instructions on what to do next.

A read/write R/W pin that select reading mode or writing mode.

An Enable pin that enables writing to the register

19

Page 32: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER TWO LMPLEMENTATION of DIGITAL VOLTMETER

8data pins (D0 -D7). The states of these pins (high or low) are the bits that you're writing to a register when you write, or the values you're reading when you read.

There's also a display constrast pin (Vo), power supply pins (+5V and Gnd) and LED Backlight (Bklt+ and BKlt-) pins that you can use to power the LCD, control the display contrast, and turn on and off the LED backlight, respectively.

Figure (2-6) LCD

The process of controlling the display involves putting the

data that form the image of what you want to display into the

data registers, then putting instructions in the instruction

register. The LiquidCrystal Library simplifies this for you so you

don't need to know the low-level instructions.[8]

20

Page 33: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER TWO LMPLEMENTATION of DIGITAL VOLTMETER

2.3.3 Potentiometer

A potentiometer is a manually adjustable variable resistor

with 3 terminals. Two terminals are connected to both ends of a

resistive element, and the third terminal connects to a sliding

contact, called a wiper, moving over the resistive element. The

position of the wiper determines the output voltage of the

potentiometer. The potentiometer essentially functions as a

variable voltage divider. The resistive element can be seen as

two resistors in series(potentiometer resistance), where the

wiper position determines the resistance ratio of the first

resistor to the second resistor

A potentiometer is also commonly known as a potmeter or

pot most common form of potmeter is the single turn rotary

potmeter. This type of pot is often used in audio volume control

(logarithmic taper) as well as many other applications. Different

materials are used to construct potentiometers, including

carbon composition, cermet, wirewound, conductive plastic or

metal film.[9]

Figure (2-7) potentiometer 21

Page 34: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER THREE DESIGN AND IMPLEMEMENTATION

Chapter Three

Design and implementation

3.1 Circuit diagram

3.2 Circuit design

3.3 Circuit working

3.4 Problems

3.5 Programming

3.6 Flow chart of project

3.7 Examples of voltages

22

Page 35: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER THREE DESIGN AND IMPLEMEMENTATION

3-1 Circuit diagram

The circuit diagram is shown in igure (3-1)

Figure (3-1) circuit diagram

23

uno

Page 36: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER THREE DESIGN AND IMPLEMEMENTATION

3-2 Circuit design

In this project we implement an arduino for digital voltmeter

using a related technology. For measuring voltage less than or

equal to 50.

Pin 1 and 2 (Vss and Vdd) of the LCD power supply pins for

display. They are connected to ground and +5V supply

respectively. Pin 3 (Vee) of the LCD is the contrast adjust pin of

the display. It is connected to the wiper terminal of the 5KΩ POT

while the other terminals of the POT are connected to +5V

supply and ground respectively.

The next three pins of the LCD are control pins. Pins 4 and 6 (RS

and E) of the LCD are connected to digital input/output pins 8

and 9 of Arduino respectively. Pin 5 (RW) of the LCD is

connected to ground.

The next connections are with respect to data pins. The LCD is

used in 4-bit data mode and hence data pins D4 to D7 are used.

Connect pins 11 to 14 (D4 to D7) of the LCD are connected to

digital input/output pins 4 to 7 of the Arduino. Pins 15 and 16

are the supply pins of the backlight LEDs. Pin 15 (LED+) of the

LCD is connected to +5V supply . Pin 16 (LED-) of the LCD is

connected to ground.

24

Page 37: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER THREE DESIGN AND IMPLEMEMENTATION

The output of the voltage divider circuit consisting of 100KΩ

resistor and 10KΩ resistor is connected to the analog input pin

A0 of the Arduino UNO with other end of the 100KΩ resistor

connected to the voltage to be measured and the other end of the

10KΩ resistor connected to the ground.

The ground terminal of the input voltage to be measured and

Arduino UNO must be common.[10]

Figure (3-2) circuit design 25

Page 38: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER THREE DESIGN AND IMPLEMEMENTATION

3-3 Circuit working

The working of the project is explained here:

In a digital voltmeter, the voltages to be measured, which are

in analog form, are converted to digital form with the help of

Analog to Digital Converters (ADC). Hence, the ADC feature of the

Arduino UNO is utilized in this project.

In the circuit, which is used to measure a maximum voltage of

50V, the input voltage is given to the analog input pin of the

Arduino. The reference voltage of the ADC is 5V. The ADC in

Arduino UNO is of 10-bit resolution. Hence, the input voltage is

calculated by multiplying the analog value at the analog pin with

5 and dividing the value with 1024.

The range of voltages for Arduino UNOs analog input is 0V to

5V. Hence, in order to increase this range, a voltage divider

circuit must be used.

The range of the analog input of Arduino UNO is increased up

to 50V by using a voltage divider consisting of 100KΩ resistor

and 10KΩ resistor. With the help of the voltage divider circuit,

the input voltage being measured is brought down to the range

of Arduino UNOs analog input.

The rest of the calculations are made in the programming part of

the Arduino UNO.[10] 26

Page 39: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER THREE DESIGN AND IMPLEMEMENTATION

3-4 Probleme

In this project we encountered many problems building the

project of most of these problems.

1-The difficulty of using caustic welding for the first time.

2-The difficulty of the work and write the code compiler because

of us doesn't have knowingly about processing of program.

3-We encountered some difficulty in programming the LCD

display.

4-There is a small difference in measured volvulity and this is

due to the use of voltage divider.

5- The battery connected to arduino is low on power and not

discharge.

27

Page 40: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER THREE DESIGN AND IMPLEMEMENTATION

3-5 Programming

Programming code LCD with arduino:

Include<Liquidcrystal . h>#

Liquidcrystal lcd (7,8,9,10,11,12) ;

Void setup()

{

Lcd. Begin(16,2) ;

Lcd. Print ("Hello world") ;

}

Void loop()

{

Lcd. Setcursor(0,1) ;

Lcd. Print(millisc)/1000) ;

}

28

Page 41: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER THREE DESIGN AND IMPLEMEMENTATION

Programming code main circuit with arduino:

:include the library code//

include <LiquidCrystal.h>#

initialize the library by associating any needed LCD interface pin//

with the arduino pin number it is connected to//

const int rs = 2, en = 3, d4 = 4, d5 = 5, d6 = 6, d7 = 7;

LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

int analogInput = 2;

loat Vout = 0.00;

loat Vin = 0.00;

loat R1 = 100000.00;

loat R2 = 10000.00;

int val = 0;

void setup()

29

Page 42: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER THREE DESIGN AND IMPLEMEMENTATION

pinMode(analogInput, INPUT);

Serial.begin(9600); //BaudRate

;)lcd.begin(16, 2

lcd.print("DIGITAL VOLTMETER");

}

void loop() {

val = analogRead(analogInput);//reads the analog input

Vout = (val * 4.99) / 1024.00; // formula for calculating voltage out i.e. V+, here 5.00

Vin = Vout / (R2 / (R1 + R2)); // formula for calculating voltage in i.e. GND

if (Vin < 0.1) //condition

{

!Vin = 0.00; //statement to quash undesired reading

}

30

Page 43: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER THREE DESIGN AND IMPLEMEMENTATION

;=" ) Serial.print("\t Voltage of the given source

;) Serial.println(Vi

lcd.setCursor(0, 1);

;) " = lcd.print("Voltage

; ) lcd.print(Vin

delay(100);

delay(1000); //for maintaining the speed of the output in serial moniter

}

31

Page 44: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER THREE DESIGN AND IMPLEMEMENTATION

3-6 Flow chart for project

نممننن

32

Start

Assemble the tools that need in project and connect together

We made a box for the circuit

Fix the control tools on the box

Program the arduino and build the circuit

Program the LCD by arduino

End

Page 45: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER THREE DESIGN AND IMPLEMEMENTATION

3-7 Examples of voltages

Figure (3-3) examples of voltages

28

Figure (3-3) example of voltage

33

Page 46: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER THREE DESIGN AND IMPLEMEMENTATION

Figure (3-4) examples of voltages

34

Page 47: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER FOUR CONCLUSION AND FUTURE WORK

Chapter Four

Conclusion and Future Work

4-1 Conclusion

4-2 Future Work

35

Page 48: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER FOUR CONCLUSION AND FUTURE WORK

4-1 Conclusion

The versatility, accuracy, precision, robustness of digital

electronic devices. Can not be matched with that of analog

devices as the former ones are far more superior. Digital

voltmeter is a very simple example of a digital electronic

device.

The disadvantage of using voltage divider based voltmeter is

the error of measurement hence, we need multiple ranges of

voltmeter. In order to reduce the error , the ratio of R1 and R2 in

the voltage divider must be minimum. We choose R1 as

100kohm and R2 10kohm then it is possible to measure the

voltages up to 50v .

36

Page 49: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER FOUR CONCLUSION AND FUTURE WORK

4-2 Future Work

The circuit can be extended to measure even Ac voltages with slight

modification circuit and code. Now a days digital voltmeter are also

replaced by digital miltimeters due to its multitasking feature i.e. It can

be used for measuring current, voltage and resistance. But still there are

some fields where separated digital voltmeters are being used.

Figure (4-1) digital multimeter device

37

Page 50: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

CHAPTER FOUR CONCLUSION AND FUTURE WORK

References

[1] Book electronic instrumentation and measurement. Page 142

[2] Book exploring arduino : tools and techniques for engineering wizardy,2013,Jeremy blum, page 170.

-digital -nano projects / -www.codrey.com/arduino [3] https:// voltmeter.

rev3. –uno –. Arduino.cc/usa/ arduino https://store[4]

. Arduino. cc/en/products/compare.https://www[5]

. Arduino .cc/en/main/arduinoboarduno 328p.https://www[6]

. Arduino .cc/en/reference/board.https://www[7]

. Arduino .cc/en/tutorial/hello world.https://www[8]

.www.resistorguide.com/potentiometer/[9]

–arduino –. Electronics hub.org/digital https://www[10] voltmeter/.

[11] h p:\\WWW.Keysight.Com Voltage Measurements

[12] h p:\\WWW.engnetbase.Com

38

Page 51: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino

Abstract

It's easy to make a simple digital voltmeter using an Arduino and 16x2 liquid crystal display (LCD). It's relatively simple to use an Arduino to measure voltages. The Arduino has several analog input pins that connect to an analog-to-digital converter (ADC) inside the Arduino. The Arduino ADC is a ten-bit converter, meaning that the output value will range from 0 to 1023. We will obtain this value by using the analog Read() function. If you know the reference voltage--in this case we will use 5 V--you can easily calculate the voltage present at the analog input.

To display the measured voltage, we will use a liquid crystal display (LCD) that has two lines of 16characters. LCDs are widely used to display data by devices and it has a lot of electrical appliances

This project will also show you how to measure voltages above the reference voltage by using a voltage divider.

Page 52: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino
Page 53: DIGITAL VOLTMETER BY USING ARDUINO BY · 1-To design digital voltmeter by using arduino. 2-Measure the input voltage range between 0 to 50 by using voltage divider. 3-Know how arduino