0% found this document useful (0 votes)
10 views4 pages

LAB 7 23102024 105957pm

Uploaded by

Rana Muzzamil
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)
10 views4 pages

LAB 7 23102024 105957pm

Uploaded by

Rana Muzzamil
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/ 4

Lab Manual Embedded System Design

EXPERIMRENT # 7
Objectives: In this Lab Students are introduced about Pulse width modulation (PWM),
motor driver and interfacing of DC motor with Arduino Uno
Introduction:
Pulse width modulation (PWM):
Pulse width modulation (PWM) is an important feature in Arduino
Uno, it is used to control the brightness of LED or speed of a DC
motor by varying the duty cycle of PWM. Figure 7.1 shows PWM
signals with different duty cycles.

Fig 7.1: PWM signals

Arduino Uno has pin no 3, 5, 6 9,10 & 11 that can be used to generate a PWM
signal , these pins are labelled with (~) sign on Arduino Uno board. Arduino IDE
has a built in function analogWrite () that is used to generate PWM signal.

analogWrite (0) means a

signal of 0% duty cycle.

analogWrite (127) means a

signal of 50% duty cycle.

analogWrite(255) means a

signal of 100% duty cycle.

16
Software Engineering Department
Bahria University (Karachi Campus)
Lab Manual Embedded System Design

DC Motor Driver:
DC motor can be interfaced to Arduino Uno through L298N motor driver. L298N
is a dual channel H-bridge IC capable of controlling two Dc motors. Simplified
circuit diagram of H-bridge is shown in figure 7.2:

Fig 7.2: Single channel H-bridge.

When transistors Q1 & Q4 are on and Q2 & Q3 are off, motor runs in lock wise
direction, similarly when Q1 & Q4 are off and Q2 & Q3 are on, motor runs in anti-clock
wise direction. Diode across the transistors are to prevent back EMF from the motor.
Time Boxing
Activity Name Activity Time Total Time
Login Systems + Setting up Proteus & Arduino 3 mints + 5 mints 8 mints
Environment
Walk through Theory & Tasks 60 mints 60 mints
Implement Tasks 80 mints 80 mints
Evaluation Time 30 mints 30 mints
Total Duration 178 mints

Lab Tasks/Practical Work:


Task 1: Write a program to generate a PWM signal with duty cycles (25%, 50%, 75% &
100%)

Connections:
1121
ATMEGA328P-PU

DIGITAL (~PWM)
ANALOG IN

17
Software Engineering Department
Bahria University (Karachi Campus)
Lab Manual Embedded System Design

Code:

Task 2: Write a program to interface DC motor with Arduino Uno.

Connections:

Code:

18
Software Engineering Department
Bahria University (Karachi Campus)
Lab Manual Embedded System Design

Task 3: Write a program in Arduino Uno to control the speed of DC motor using PWM.
Code:

Conclusion:

19
Software Engineering Department
Bahria University (Karachi Campus)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy