Lab 04&05
Lab 04&05
Objectives:
#. Of Taxonomy level
S. No. CLO
Topic Lectures
Demonstrate the operation of Analog and Digital pins using 3 1 Application-C3
simulation of Arduino boards on Proteus
01
Outcome(s):
a. An ability to design and conduct experiments, PLO4: Investigation
as well as to analyze and interpret data
Performan Meets
ce Exceeds expectation(5- Meets expectations(3- expectations Scor
Metric 4) 2) (1-0) e
Subject Operates equipment Operates equipment in Does not know how
Knowledge in correct & careful correct & careful to operate equipment;
fashion, Selects fashion, with guidance, has no knowledge of
optimum range / understand the optimum measurement optimum
setting for range/ setting for range/setting
operation. operation. for operation.
Ability to Plans data collection to Plans data collection to Does not know how to
Conduct achieve experimental achieve experimental plan data collection to
Experiment objectives, and conducts objectives, and achieve experimental
an orderly and a collects complete data goals; data collected
complete data collection with minor error. is incomplete and
contain
errors.
Data Analysis Accurately conducts simple Conducts simple Unable to conduct simple
computations and statistical computations statistical analysis on
analysis using collected and statistical analysis collected data; no attempt
data;
correlates experimental using collected data to correlate experimental
results to known theoretical with minor error; results with known
values; accounts for reasonably correlates theoretical values;
measurement errors experimental results incapable of explaining
and parameters that to know theoretical measurement errors or
affect experimental values; attempts to parameters that affect
results. account for measurement the experimental results.
errors and parameters
that affect experimental
results.
Total Score (out of 15)
TOTAL NORM. SCORE (out
of 0.5)
DEPARTMENT OF TELECOMMUNICATION
MEHRAN UNIVERSITY OF ENGINEERING & TECHNOLOGY JAMSHORO
MICROPROCESSOR AND MICROCONTROLLER (4 TH SEMESTER,
SECOND YEAR)
LAB -04&05
At the conclusion of this experiment, understudy will be able to:
• Get start with the Arduino board-based circuits simulation using Proteus
• To understand the operation of analog and digital pins using Proteus simulation
Required Software:
• Arduino IDE software
• Proteus Software
Introduction
Proteus is a simulation and electronic design development tool developed by Lab Center Electronics. It is
a very useful tool as it ensures that the circuit design or firmware code is working properly before you begin
to physically work on it.
It has an extensive number of components in its library which can be used to virtually design your circuit.
The designs you make can be easily compiled and debugged through Proteus’s virtual meters (voltmeter
and ammeter), oscilloscope, serial monitor, and more.
Copy both of the files and paste them in one of the following paths: C:\Program Files\Labcenter
Electronics\Proteus 8 Professional\LIBRARY or C:\Program Files\Labcenter Electronics\Proteus 8
Professional\Data\LIBRARY.
Now, open Proteus and check whether the Arduino board libraries are installed properly or not.
DEPARTMENT OF TELECOMMUNICATION
MEHRAN UNIVERSITY OF ENGINEERING & TECHNOLOGY JAMSHORO
MICROPROCESSOR AND MICROCONTROLLER (4 TH SEMESTER,
SECOND YEAR)
LAB -04&05
Click Next once you are done and select the appropriate page layout according to your needs. After finishing
the settings, you will land on the empty workspace. Here, you can place components from the library.
Select the op-amp symbol, which changes the mode to component mode. Then click P, which will cause a
list of components to pop up. Here, you can find all types of components and footprints for simulation.
DEPARTMENT OF TELECOMMUNICATION
MEHRAN UNIVERSITY OF ENGINEERING & TECHNOLOGY JAMSHORO
MICROPROCESSOR AND MICROCONTROLLER (4 TH SEMESTER,
SECOND YEAR)
LAB -04&05
Search for Arduino in the component list. All Arduino related boards and connector libraries will display.
If none of the files display on your machine, you can repeat re-installing the Arduino library.
After selecting the library and clicking OK, click the spot on the workspace where you would like to drop
the board.
Example 01:- Making a LED Blink With a SPST switch (with PULL_DOWN) resistor.
• Arduino Code
• Arduino Code
DEPARTMENT OF TELECOMMUNICATION
MEHRAN UNIVERSITY OF ENGINEERING & TECHNOLOGY JAMSHORO
MICROPROCESSOR AND MICROCONTROLLER (4 TH SEMESTER,
SECOND YEAR)
LAB -04&05
• Circuit to Design on Proteus
• If you use INPUT_PULLUP, the button is active-low (pressed = LOW, released = HIGH).
Example 03: - Write an Arduino program that takes temperature sensor input from analog pin, and
shows the temperature in Celsius and Fahrenheit on virtual terminal.
• Arduino Code
DEPARTMENT OF TELECOMMUNICATION
MEHRAN UNIVERSITY OF ENGINEERING & TECHNOLOGY JAMSHORO
MICROPROCESSOR AND MICROCONTROLLER (4 TH SEMESTER,
SECOND YEAR)
LAB -04&05
• Proteus Simulation:-
Example 04: - Write an Arduino code that lights multiple LEDS in sequence, then in reverse, using
FOR LOOP.
DEPARTMENT OF TELECOMMUNICATION
MEHRAN UNIVERSITY OF ENGINEERING & TECHNOLOGY JAMSHORO
MICROPROCESSOR AND MICROCONTROLLER (4 TH SEMESTER,
SECOND YEAR)
LAB -04&05
• Arduino Code
Example 05: - Write an arduino code that if it receives "one" serially, it turns on LED 1 or if it receives
"two" serially, it turns on LED 2. Else it sends error message.
DEPARTMENT OF TELECOMMUNICATION
MEHRAN UNIVERSITY OF ENGINEERING & TECHNOLOGY JAMSHORO
MICROPROCESSOR AND MICROCONTROLLER (4 TH SEMESTER,
SECOND YEAR)
LAB -04&05
• Arduino Code
• Proteus Simulation:-
DEPARTMENT OF TELECOMMUNICATION
MEHRAN UNIVERSITY OF ENGINEERING & TECHNOLOGY JAMSHORO
MICROPROCESSOR AND MICROCONTROLLER (4 TH SEMESTER,
SECOND YEAR)
LAB -04&05
Exercise Tasks:-
1) Write an Arduino code that turns off the LED when a push button is pressed and turns it on when
the button is released. Attach Proteus Simulation along with the Arduino code.
2) Write a program to control the LED brightness with a potentiometer and simulate this on the
Proteus.
3) Prepare a source code for which consider a potentiometer is connected to an analog input pin while
the code reads the voltage and turns ON a specific LED according to the given input:
• If voltage is in between 0 to 2, the LED on pin:13 is turned ON.
• If voltage is in between 2 to 3.5, the LED on pin:14 is turned ON.
• If voltage is in between 3.5 to 5, the LED on pin:15 is turned ON.
4) Write a source code to design a system, that continuously checks Serial data, if data is “FAN”, it
should turn on FAN and turn off HEATER, but if received data is “HTR”, the heater should be turn
ON and Fan should be OFF. Prepare a source code that reads data from Serial port and if the data
on Serial port is x, your name should be sent over serial port.
5) Write an Arduino program to allow Three Push Buttons to control a set of Eight (8) LEDs in the
following manner:
i) When the first push button is pressed, all the LEDs should be turned ON and OFF with
delay of (your roll number)+ 500 milli seconds.
When the second push button is pressed, the switching delay sets to 400 msec.
ii) When the third push button is pressed, the switching delay sets to 200 msec.
Note: Attach the Proteus simulation and programming code of the labs tasks along with the handouts.