0% found this document useful (0 votes)
128 views5 pages

Lab Report#5 Analog Voltage Reading and Display On 7 Segment

This lab report describes an experiment to read analog voltage values using an Arduino board and display the readings on a 7-segment display. The experiment involves connecting a potentiometer to an Arduino analog pin to vary the input voltage. Arduino code is written to read the analog voltage and display the value on the 7-segment display by turning LED segments on and off. Screenshots of the circuit design in Proteus and code listings are provided.

Uploaded by

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

Lab Report#5 Analog Voltage Reading and Display On 7 Segment

This lab report describes an experiment to read analog voltage values using an Arduino board and display the readings on a 7-segment display. The experiment involves connecting a potentiometer to an Arduino analog pin to vary the input voltage. Arduino code is written to read the analog voltage and display the value on the 7-segment display by turning LED segments on and off. Screenshots of the circuit design in Proteus and code listings are provided.

Uploaded by

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

Lab Report#5

Analog voltage reading and display on 7 segment


Objective:
How to create project on protious.
How to control Arduino and get output

Tools:
Arduino IDE, Proteousetc

Apparatus:
Arduino IDE, Proteus,Resistor, LED

Theory:
Introduction
In order to measure voltage, we need to use an Arduino board analog input.
Usually these are marked separately as "analog in". We are going to use a
potentiometer to adjust the voltage at the analog input.. For this example,
connect one of the outer pins to 5V and the other outer pin to ground. Lastly
connect the middle pin to an Arduino analog input. You now have a means of
setting a variable voltage on the analog input pin. It is effectively exactly the
same circuit as above.
Using Arduino Studio, copy the code below into a new session and upload to
the board. Once the below program is running on the Arduino board, move
the potentiometer through various positions. As you do so, you should see
the value on the display change. We've built a very basic voltage meter.

Procedure:

Write Arduino Codes on Arduino Software IDE.


Build .hex file from Arduino Software.
Now click Compile button. Compilation yields .hex file created.
I turn the Proteus as a Simulator for Arduino with the help of
Arduino Proteus library files.
Draw the required schematic diagram of Proteus.

Then attach the resister and LED with proteus and also attach
ground.
To load .hex file to the Arduino board, just double click on the
board and browse the .hex file in the Program File section.

Lab Task:
Analog voltage reading and display on 7 segment

Screen Shoots:

Programe:
(1)
void setup() {
Serial.begin(9600);
}
void loop() {
intAnalogVoltage=analogRead(A2);
float voltage= AnalogVoltage*(5.0/1023.0);
Serial.println(voltage);
}
(2)
int a=9;
int b=8;
int c=7;
int d=6;
int e=5;

int f=4;
int g=3;
void setup()
{
pinMode(a, OUTPUT);
pinMode(b, OUTPUT);
pinMode(c, OUTPUT);
pinMode(d, OUTPUT);
pinMode(e, OUTPUT);
pinMode(f, OUTPUT);
pinMode(g, OUTPUT);
}
void loop() {
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
delay(2000);
digitalWrite(a, LOW);
digitalWrite(b, LOW);
digitalWrite(c, LOW);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
delay(1000);
digitalWrite(b, LOW);
digitalWrite(c, LOW);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(g, HIGH);
delay(1000);
digitalWrite(a, LOW);
digitalWrite(b, LOW);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(g, LOW);
digitalWrite(c, HIGH);
digitalWrite(a, HIGH);

digitalWrite(b, HIGH);
digitalWrite(d, HIGH);
digitalWrite(g, HIGH);
delay(1000);
digitalWrite(c, LOW);
digitalWrite(a, LOW);
digitalWrite(b, LOW);
digitalWrite(d, LOW);
digitalWrite(g, LOW);
digitalWrite(c, HIGH);
digitalWrite(b, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
delay(1000);
digitalWrite(c, LOW);
digitalWrite(b, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(c, HIGH);
digitalWrite(a, HIGH);
digitalWrite(d, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
delay(1000);
digitalWrite(c, LOW);
digitalWrite(a, LOW);
digitalWrite(d, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(c, HIGH);
digitalWrite(a, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
delay(1000);
digitalWrite(c, LOW);
digitalWrite(a, LOW);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(c, HIGH);
digitalWrite(b, HIGH);

digitalWrite(a, HIGH);
delay(1000);
digitalWrite(c, LOW);
digitalWrite(b, LOW);
digitalWrite(a, LOW);
digitalWrite(c, HIGH);
digitalWrite(a, HIGH);
digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
digitalWrite(b, HIGH);
delay(1000);
digitalWrite(c, LOW);
digitalWrite(a, LOW);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
digitalWrite(b, LOW);
digitalWrite(c, HIGH);
digitalWrite(a, HIGH);
digitalWrite(b, HIGH);
digitalWrite(f, HIGH);
digitalWrite(g, HIGH);
delay(1000);
digitalWrite(c, LOW);
digitalWrite(a, LOW);
digitalWrite(b, LOW);
digitalWrite(f, LOW);
digitalWrite(g, LOW);
delay(1000);
}

You might also like