0% found this document useful (0 votes)
14 views

4in1 Arduino Tutorial 3

Uploaded by

mervynmada2001
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

4in1 Arduino Tutorial 3

Uploaded by

mervynmada2001
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 16

BRUTE FORCE

ELECTRONICS-PROGRAMMING-ROBOTICS

BRUTE FORCE [email protected] +263718384192


Course Overview

▪ Week 1 – Electronics
▪ Week 2 – Programming
▪ Week 3 – Arduino
▪ Week 4 – Robotics

BRUTE FORCE [email protected] +263718384192


Tutorial 3

Arduino Controls

BRUTE FORCE [email protected] +263718384192


Focus
● Pulse Width Modulation
● Controlling a DC Motor

BRUTE FORCE [email protected] +263718384192


Arduino Pulse Width Modulation
● Pulse Width Modulation or PWM is a common technique used to vary the width of the pulses in a
pulse-train.
● PWM is a technique by which width of a pulse is varied while keeping the frequency of the wave
constant. It is a method for generating an analog signal using a digital source.
● It has many applications such as controlling servos and speed controllers, limiting the effective
power of motors and LEDs.

BRUTE FORCE [email protected] +263718384192


PWM Basic Principle
● Pulse width modulation is basically, a square wave with a varying
high and low time.
● There are various terms associated with PWM −
➢ On-Time − Duration of time signal is high.
➢ Off-Time − Duration of time signal is low.
➢ Period − It is represented as the sum of on-time and off-time of
PWM signal.
➢ Duty Cycle − It is represented as the percentage of time signal
that remains on during the period of the PWM signal.

BRUTE FORCE [email protected] +263718384192


PWM Pins of Arduino

● Arduino Uno has 6 8-bit PWM channels. The pins


with symbol ‘~’ represents that it has PWM support.

BRUTE FORCE [email protected] +263718384192


Arduino Functions for PWM
● analogWrite() Function
analogWrite (pin, duty cycle)
● pin – pin on which we want to generate pwm or analog signal.
● duty cycle – it lies in between 0 (0%, always off) – 255 (100%, always on).

➢ The function writes an analog value (PWM wave) to a pin.


➢ It is used to generate PWM or output analog value to a specified PWM channel.
➢ It can be used to light a LED at varying brightness or drive a motor at various speeds. After a call of the
analogWrite() function, the pin will generate a steady square wave of the specified duty cycle until the
next call to analogWrite() or a call to digitalRead() or digitalWrite() on the same pin.
➢ The frequency of the PWM signal on most pins is approximately 490 Hz.

BRUTE FORCE [email protected] +263718384192


LED Fading using Arduino PWM
A program in which led will fade
continuously. This led fading application
used for decoration in functions and
festivals.

BRUTE FORCE [email protected] +263718384192


Control LED Brightness using Potentiometer

BRUTE FORCE [email protected] +263718384192


Arduino DC Motor
● There are three different type of motors −
➢ DC motor
➢ Servo motor
➢ Stepper motor

● Direct Current (DC) MOTOR - is the most common type of motor. DC motors normally have just
two leads, one positive and one negative. If you connect these two leads directly to a battery, the
motor will rotate. If you switch the leads, the motor will rotate in the opposite direction.

BRUTE FORCE [email protected] +263718384192


Reading Analog and Digital Inputs

You will need:


Arduino board
Breadboard
LED
220 ohm resistor
potentiometer

BRUTE FORCE [email protected] +263718384192


Motor Spin Control
● You will need:
Arduino UNO board
PN2222 Transistor
6V DC Motor
1N4001 diode
270 Ω Resistor

Warning − Do not drive the motor directly


from Arduino board pins. This may
damage the board. Use a driver Circuit or
an IC.

BRUTE FORCE [email protected] +263718384192


Motor Spin Control

● The transistor acts like a switch, controlling the power


to the motor. Arduino pin 3 is used to turn the transistor
on and off

BRUTE FORCE [email protected] +263718384192


Motor Speed Control

BRUTE FORCE [email protected] +263718384192


THANK YOU ARDUINO GEEKS!

IGNITING CREATIVITY - LEARN BY DOING


BRUTE FORCE [email protected] +263718384192

You might also like