Mpi L
Mpi L
Prepared By
Name:
Roll Number:
Submitted To
Engr. S. M. Omair
Assistant Professor
BMED
(SSUET/QR/111)
SIR SYED UNIVERSITY OF ENGINEERING & TECHNOLOGY
BIOMEDICAL ENGINEERING DEPARTMENT
LAB OBJECTIVE:
The lab facilitates the students in learning and improving their skills in Arduino programming, hardware /
modules interfacing, system designing, software simulation and troubleshooting.
Furthermore, the lab objectives are to achieve the following Program Learning Outcomes:
PLO-5 Modern Tool Usage
PLO-11 Project Management
COURSE LEARNING OUTCOMES (CLOs) and its mapping with Program Learning Outcomes (PLOs):
CLO Bloom’s
Course Learning Outcomes (CLOs) PLOs
No. Taxonomy
Display Arduino’s effectiveness by applying its basic
program structure, generate various logics and PLO 5 P4
4 sequences on LEDBARs and Seven segment LEDs. (Modern Tool Usage) (Mechanism)
Construct various circuits and logics using LCDs,
Keypad, sensors and motors.
CLO 4 CLO 5
Assessment Tools
(35) (15)
Lab Manual 43% (15) -----
GRADING POLICY:
Exceeds Meets
Criteria Developing Unsatisfactory Score
Expectations Expectations
(5-6) (<5) Obtained
(9-10) (7-8)
Performanc
e Able to present full Able to present Able to present No or very less
knowledge of both adequate knowledge sufficient knowledge knowledge of both
(10 Marks) problem and solution. of both problem and of both problem and problem and solution
solution solution
Viva Able to answer the Able to answer the Able to answer the Unable to answer
(10 Marks) questions easily and questions related to questions but with the questions
correctly across the the project mistakes
project.
Total Score (20 Marks)
Examined by:
(Name and Signature of concerned lab instructor)
Micro Processor & Interfacing (BM-321L) Lab Report
10
11
12
13
14
15
LAB #1
Display the Arduino UNO board pinout and understand its basic program structure
THEORETICAL BACKGROUND
MICRO-CONTROLLER:
A microcontroller is a chip optimized to control electronic devices. It is stored in a single integrated circuit
which is dedicated to performing a particular task and execute one specific application. It is specially
designed circuits for embedded applications and is widely used in automatically controlled electronic
devices. It contains memory, processor, and programmable I/O.
MICRO-PROCESSOR:
A microprocessor is a controlling unit of a micro-computer wrapped inside a small chip. It performs
Arithmetic Logical Unit (ALU) operations and communicates with the other devices connected with it. It is
a single Integrated Circuit in which several functions are combined.
ARDUINO:
Arduino is an open-source platform (Often referred as Micro-controller) used for building electronics
projects. Arduino consists of both a Programmable hardware and a software which is used to over write the
Arduino Programmable Hardware by using language Which in terms called embedded C and C.
DIGITAL PINS:
There are 14 digital input and output pins (0-13) operating at 5v and approximately 20 – 30 mA.
ANALOG PINS:
There are 6 analog pins which are default input and are used for analog device interfacing [A0-A5].
PWM PINS:
PWM stands for Pulse Width Modulation Pins which has a sign of tilde (~); used for controlling the speed
of dc motors and brightness of a LED [3,5,6,9,10,11].
AREF
This pin is used to set analog reference voltage other than the supply voltage for precise analog to digital
conversion.
IOREF:
IOREF stands for INPUT/OUTPUT Reference which helps Arduino Shield identify power options in use by
Arduino board.
Serial Communications:
There are various serial communication options available in Arduino in the form of RX/TX, I2C and SPI.
External Interrupts:
External hardware interrupt option is available on digital pins 2 and 3 in Arduino UNO.
iii. CELL/BATTERY:
We can directly Operate Arduino Micro Controller by giving directly a DC supply of 5v to its Vin Pin.
OBJECTIVE 1
To operate a LED by using Arduino IDE and simulate that program on Proteus Professional Software.
COMPONENTS REQUIED
1. Arduino UNO Board
2. 100 Ω resistor
3. Animated LED
CIRCUIT DIAGRAM
SOURCE CODE
void setup()
{
pinMode(13,OUTPUT);
}
void loop()
{
digitalWrite(13,HIGH);
delay(1000);
digitalWrite(13,LOW);
delay(1000);
}
RESULTS
When program is switching led high:
CONCLUSION
Arduino is an open-source electronics platform that consists of a hardware and software ecosystem. It
provides a flexible and easy-to-use platform for creating interactive projects and prototypes. The Arduino
platform is built around microcontroller boards, which are programmable devices that can interact with
inputs and outputs to control various electronic components.
LAB #2
COMPONENTS REQUIED
CIRCUIT DIAGRAM
SOURCE CODE
void setup() digitalWrite(4,LOW);
{ digitalWrite(5,HIGH);
pinMode(2,OUTPUT); delay(300);
pinMode(3,OUTPUT); digitalWrite(5,LOW);
AREF
13
PB5/SCK U1
12
PB4/MISO
RESET 11 1 20
~PB3/MOSI/OC2A
10 2 19
~ PB2/SS/OC1B
9 3 18
~ PB1/OC1A
8 4 17
PB0/ICP1/CLKO
5 16
ATMEGA328P-PU
1121
DIGITAL(~PWM)
7 6 15
ANALOG IN
PD7/AIN1
6 7 14
A0 ~ PD6/AIN0
PC0/ADC0 5 8 13
A1 ~ PD5/T1
PC1/ADC1 4 9 12
A2 PD4/T0/XCK
PC2/ADC2 3 10 11
A3 ~ PD3/INT1
PC3/ADC3 2
A4 PD2/INT0
PC4/ADC4/SDA 1 LED-BARGRAPH-GRN
A5 TX PD1/TXD
PC5/ADC5/SCL 0
RX PD0/RXD
ARDUINO UNO R3
void loop() {
for(a=2;a<=11;a++)
{
digitalWrite(a,HIGH);
delay(duration);
digitalWrite(a,LOW);
}
}
void loop() {
for(a=11;a>=2;a--)
{
digitalWrite(a,HIGH);
delay(duration);
digitalWrite(a,LOW);
}
}
TASK 4: To make LED glow by moving bottom to top and vice versa
RESULTS
CONCLUSION
In Arduino programming, a for loop is important when controlling or "glowing" an LED because it allows
you to repeat a series of instructions for a specific number of times. By using a for loop, you can easily
control the on and off states of an LED to create various patterns or effects.By using a for loop, you can
easily control the number of times the LED blinks and manipulate the timings to achieve different blinking
patterns or effects. The for loop simplifies the code by eliminating the need to write repetitive instructions
multiple times, making the code more efficient and easier to understand.
LAB #3
COMPONENTS REQUIED
RESULTS
TASK 2: To display numbers from ‘0-99’ using two seven segment displays
SOURCE CODE
Int count=99, convert=0 , bit_value; Delay(300);
Int a,b,pins[]={13,12,11,10,5,4,3,2}; Count--;
Void setup() If(count<=0)
{ {
For(a=7;a>=0;a--) Count=99;
{ Convert=0;
pinMode(pins[a],OUTPUT); }
} }
} Int bintobcd(int recv)
Void loop() {
{ Int q,r;
Convert=bintobcd(count); Q=recv/10;
For(a=7;a>=0;a--) R=recv%10;
{ Q=q<<4;
Bit_value=bitRead(convert,a); Q=q|r;
digitalWrite(pins[a],bit_value);} Return q;
RESULTS
TASK 3: To display numbers from ’99-0’ using two seven segment displays.
SOURCE CODE
int pins[]={13,12,11,10,5,4,3,2}; }
int count=99,convert=99,a,bit_value; delay(300);
void setup() { count--;
// put your setup code here, to run once: if(count<=0)
for(a=0;a<=7;a++) {
{ count=99;
pinMode(pins[a],OUTPUT); convert=99;
} }}
} int bintobcd(int recv)
{
void loop() { int q,r;
// put your main code here, to run repeatedly: q=recv/10;
convert=bintobcd(count); r=recv%10;
for(a=0;a<=7;a++) q=q<<4;
{ q=q|r;
bit_value=bitRead(convert,a); return q;
digitalWrite(pins[a],bit_value); }
RESULTS
TASK 4: Generate code for first 0-99 countdown then 99-0 countdown.
SOURCE CODE
Int a,count=0,convert=0,bit_value; }
Int pins[]={13,12,11,10,5,4,3,2}; for(count=99;count>=0;count--)
void setup() {
{ convert=bintobcd(count);
for(a=0;a<=7;a++) for(a=0;a<=7;a++)
CONCLUSION
In this lab, we utilize Arduino to perform various tasks involving a 7-segment screen in different ways. One
possible method involves using an LED bar graph with the Arduino to display the 7-segment output.
LAB #4
delay(800);
digitalWrite(LED, 0);
}}
CONCLUSION
Arduino boards have multiple digital pins that can be configured as inputs or outputs. The digitalRead(pin)
function can be used to read the digital value (HIGH or LOW) of a specific pin. This is commonly used to
read the status of buttons, switches, or other digital sensors.
LAB #5
TASK 1: To make LED glow with the help of push button by reducing inputs in Arduino.
SOURCE CODE RESULTS
const byte LED = 4, button = 3;
byte check; R1
void setup() PWR
10k
GND
ARD1
{
GND
pinMode(LED, OUTPUT);
B U TTO N
pinMode(button, INPUT);
ON
R eset B T N
PWR
w w w .T h e E n g in e e rin g P ro je c ts .co m
} D1
AREF
R2
void loop() PB5/SCK
13 LED GND
{ RESET
PB4/MISO
~ PB3/MOSI/OC2A
12
11
100
LED-RED
10
check = digitalRead(button); ~ PB2/OC1B
~ PB1/OC1A
9
8
if (check == 1) PB0/ICP1/CLKO
AT M E G A328P -P U
1121
7
A N A L O G IN
{ A0
PD7/AIN1
~ PD7/AIN1
6
5
PC0/ADC0 ~ PD5/T1/OC0B
digitalWrite(LED, 1); A1
A2
PC1/ADC1 PD4/T0/XCK
4
3
LED
PC2/ADC2 ~ PD3/INT1/OC2B
A3 2 BUTTON
PC3/ADC3 PD2/INT0
A4 PD1/TXD 1
PC4/ADC4/SDA
delay(800); A5
PC5/ADC5/SCL PD0/RXD 0
}}
PWR
ARD1
R1
PWR GND
10k
ON
Reset BTN
www.TheEngineeringProjects.com
UP
AREF
13 UP
PB5/SCK
PB4/MISO
12 LED D1
RESET ~ PB3/MOSI/OC2A
11 CLOCK R2
10 DATA LED GND
~ PB2/OC1B
9 LATCH 100
~ PB1/OC1A LED-RED
8
PB0/ICP1/CLKO
ATMEGA328P-PU
1121
7
ANALOG IN
PD7/AIN1
6
~ PD7/AIN1
A0 5
PC0/ADC0 ~ PD5/T1/OC0B
A1 4
PC1/ADC1 PD4/T0/XCK
A2 3
PC2/ADC2 ~ PD3/INT1/OC2B
A3 2
PC3/ADC3 PD2/INT0
A4 PD1/TXD 1
PC4/ADC4/SDA
A5 PD0/RXD 0
PC5/ADC5/SCL
ARDUINO UNO R3
PWR
PWR
A2
B2
C2
D2
E2
F2
G2
A1
B1
C1
D1
E1
F1
G1
U1 U3
11 15 U2 7 13
CLOCK SH_CP Q0 0 4 A QA A2
14 1 7 13 1 12
DATA DS Q1 1 0 A QA A1 5 B QB B2
2 1 12 2 11
Q2 2 1 B QB B1 6 C QC C2
12 3 2 11 6 10
LATCH ST_CP Q3 3 2 C QC C1 7 D QD D2
4 6 10 4 9
Q4 4 3 D QD D1 BI/RBO QE E2
5 4 9 5 15
Q5 5 BI/RBO QE E1 PWR RBI QF F2
6 5 15 3 14
Q6 6 PWR RBI QF F1 LT QG G2
10 7 3 14
PWR MR Q7 7 LT QG G1
13 9 74LS47
GND OE Q7'
74LS47
74HC595
TASK 3: To display down counting by using 7 segment display by reducing inputs in Arduino.
SOURCE CODE
const byte UP = 13, LED = 12, CLOCK = 11, DATA = 10, DOWNcheck = digitalRead(DOWN);
LATCH = 9, DOWN = 8; if (UPcheck == 1)
byte UPcheck, DOWNcheck, count = 0, convert = 0; break;
void setup() if (DOWNcheck == 1)
{
pinMode(UP, INPUT); {
pinMode(DOWN, INPUT); delay(250);
pinMode(LED, OUTPUT); count--;
pinMode(CLOCK, OUTPUT); if (count == 0)
pinMode(DATA, OUTPUT); {
pinMode(LATCH, OUTPUT); count = 99;
displayvalue(convert); convert = 0;
} displayvalue(convert);
void loop() break;
{ }
while (1) convert = bintobcd(count);
{ displayvalue(convert);
UPcheck = digitalRead(UP); }
DOWNcheck = digitalRead(DOWN); }
if (DOWNcheck == 1) digitalWrite(LED, 1);
break; delay(1000);
if (UPcheck == 1) digitalWrite(LED, 0);
{ }
delay(250); byte bintobcd(byte recv)
count++; {
if (count == 100) byte q, r;
{ q = recv / 10;
count = 0; r = recv % 10;
convert = 0; q = q << 4;
displayvalue(convert); q = q | r;
break; return q;
} }
convert = bintobcd(count); void displayvalue(byte recv)
PWR
ARD1
R1
PWR GND
10k
ON
Reset BTN
www.TheEngineeringProjects.com
UP
AREF
13 UP
PB5/SCK
PB4/MISO
12 LED D1
RESET ~ PB3/MOSI/OC2A
11 CLOCK R2
10 DATA LED GND
~ PB2/OC1B
9 LATCH 100
~ PB1/OC1A LED-RED
8
PB0/ICP1/CLKO
ATMEGA328P-PU
1121
7
ANALOG IN
PD7/AIN1
6
~ PD7/AIN1
A0 5
PC0/ADC0 ~ PD5/T1/OC0B
A1 4
PC1/ADC1 PD4/T0/XCK
A2 3
PC2/ADC2 ~ PD3/INT1/OC2B
A3 2
PC3/ADC3 PD2/INT0
A4 PD1/TXD 1
PC4/ADC4/SDA
A5 PD0/RXD 0
PC5/ADC5/SCL
ARDUINO UNO R3
PWR
PWR
A2
B2
C2
D2
E2
F2
G2
A1
B1
C1
D1
E1
F1
G1
U1 U3
11 15 U2 7 13
CLOCK SH_CP Q0 0 4 A QA A2
14 1 7 13 1 12
DATA DS Q1 1 0 A QA A1 5 B QB B2
2 1 12 2 11
Q2 2 1 B QB B1 6 C QC C2
12 3 2 11 6 10
LATCH ST_CP Q3 3 2 C QC C1 7 D QD D2
4 6 10 4 9
Q4 4 3 D QD D1 BI/RBO QE E2
5 4 9 5 15
Q5 5 BI/RBO QE E1 PWR RBI QF F2
6 5 15 3 14
Q6 6 PWR RBI QF F1 LT QG G2
10 7 3 14
PWR MR Q7 7 LT QG G1
13 9 74LS47
GND OE Q7'
74LS47
74HC595
CONCLUSION
Arduino boards have multiple digital pins that can be configured as inputs or outputs. The digitalRead(pin)
function can be used to read the digital value (HIGH or LOW) of a specific pin. This is commonly used to
read the status of buttons, switches, or other digital sensors.