SlideShare a Scribd company logo
Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
Microcontroller
Programming Beginning
with Arduino
Ashifur Rahaman
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Microcontrollers
 Tiny, self­contained computers in an IC
 Often contain peripherals
 Different packages availible
 Vast array of size and power availible
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
   
Sensory Input
 Robots need to be able to recieve input from the 
world in the form of sensory input.
 Microcontrollers handle this input.
 Thousands of sophisticated sensors availiable
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Pressure/Force Sensors
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
GPS Locators
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Gyroscopes
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
   
Wheel Encoders
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
   
Infared Proximity Detectors
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Accelerometers
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Ultrasonic Rangefinders
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
   
Alcohol Vapor Density
Detectors
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Arduino
 Development board for the ATMega328
 Inludes
 Programmer,
 Voltage Regulators
 Seral to USB Converter
 CHEAP ­­ $30! Has everything you need!
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Arduino C Template
void setup() {
  // Setup stuff to only run once at the beginning   
}
void loop()
{
  // This function gets called indefinatly
}
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Peripherals
 Analog to Digital Converters (ADC)
 Counters/Timers (TMRx)
 PWM Modules (CCP/PWM)
 Serial Ports (UART)
 Many, many more....
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Digital I/O
 Only HIGH and LOW values
 Each pin configurable to do input or output
 pinMode(pinNumber, pinState)
 pinMode(13, INPUT)
 pinMode(13, OUTPUT)
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Digital I/O (Part II)
 Output
 digitalWrite(pinNumber, HIGH/LOW)
 Input
 int val = digitalRead(pinNumber)
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Arduino Digital I/O Example
int ledPin =  13;
void setup() {
  // Set the digital pin as output:
  pinMode(ledPin, OUTPUT);      
}
void loop()
{
  // Bring the pin high (1)
  digitalWrite(ledPin, HIGH);
}
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Serial Interface (UART)
 Communicate with other microcontrollers or PC's
 Asynch. communication
 Arduino libraries make it extremely easy
 Serial.begin(baudRate)
 Serial.println(”String To Send”)
 int bytesWaiting = Serial.Availible()
 Char incomingData = Serial.read()
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Arduino Serial Example
void setup() {
Serial.begin(9600);  // Setup baud rate
}
void loop() {
Serial.println(”Give me input”);  // output data
while(Serial.availible() < 1) {     // if there's data waiting
char input = Serial.read();     // get a byte of data
}
}
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Analog to Digital Converter
(ADC)
 Take analog voltage as input on one of the pins
 Return digital representation to program
 Different numbers of bits change precision.
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Light Sensors
 Photoresistors
 Extremely Simple to Use
 Resistance changes with light
 Measure voltage over the sensor with
an ADC, and you're done
 Many more complicated sensors
simulate this behavior for simplicity
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
   
Arduino ADC Example
int sensorPin = 0;
void setup() {
  Serial.begin(9600); // Turn on Serial Connection
}
void loop() {
  // read the value from the sensor:
  sensorValue = analogRead(sensorPin);
  
  // Print sensor value to the Serial
  Serial.println(sensorValue);
}
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
PWM Modules (CCP)
 Create PWM signals on output pins
 Measure PWM signals on input pins
 CCP stands for Capture/Compare
 What is PWM, anyway?
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Pulse Width Modulation
(PWM)
 Transmit analog values using a single digital input/
output pin through careful timing.
 A PWM signal consists of two values
 Period: how long before the signal repeats
 Pulse Width: how long the signal is HIGH before it 
goes LOW.
 Duty Cycle: % of time the signal is HIGH, or
(Pulse Width / Period)
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
PWM In Robotics
 The average voltage (Duty Cycle * Voltage) can be 
used to control the speed of DC motors.
 Innaccurate, poor strength, braking, and other 
problems exist.
 Servo Motors and Speed Controllers.
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Servo Motors
 DC Motor with gears allow for high torque
 Embedded microcontroller monitors PWM input 
and motor position.
 Vary pulse width to change position of motor
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Speed Controllers
 Embedded microcontroller varies voltage on output 
lines based on PWM input.
 Results in constant voltage to motors rather than 
intermittent.
 Allow a second, more powerful, power supply to 
drive large motors.
 Alter pusle width to change the speed of the motor
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Arduino PWM Command
 AnalogWrite(Pin, DutyCycle)
 DutyCycle = 0   0%, 127   50%, 255   100%→ → →
 Pin can be 3, 5, 6, 9, 10, or 11
 Frequency of about 490Htz
 Other periods are possible, but not with AnalogWrite
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
   
Arduino PWM Example
int Pin = 9;
void setup()
{
  pinMode(Pin, OUTPUT);
}
void loop()
{
  analogWrite(Pin, 127);  // Generate 50% duty cycle on ”Pin”
}
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
Useful Resources
 Robot Parts and Excellent Forums
www.TrossenRobotics.com
 Electrical parts, sensors, and microcontrollers
www.Sparkfun.com
 Arduino Development Platform
www.ardiono.cc
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com
C
lick
to
B
U
Y
N
O
W
!
PD F-XChange Edit
or
www
.
tracker-software.com
C
lick
to
B
U
Y
N
O
W
!
PD
F-XChange Edit
or
www
.
tracker-software
.com

More Related Content

Viewers also liked

Comentario desmayarse, atreverse, estar furioso.
Comentario desmayarse, atreverse, estar furioso.Comentario desmayarse, atreverse, estar furioso.
Comentario desmayarse, atreverse, estar furioso.
Pablo Díaz
 
Event Sourcing with Microservices
Event Sourcing with MicroservicesEvent Sourcing with Microservices
Event Sourcing with Microservices
Ralph Winzinger
 
Como hacer amigos e influir sobre las personas
Como hacer amigos e influir sobre las personasComo hacer amigos e influir sobre las personas
Como hacer amigos e influir sobre las personas
yaniratatianatorres2
 
Cours0 presentation carte arduino
Cours0   presentation carte arduinoCours0   presentation carte arduino
Cours0 presentation carte arduino
labsud
 
Intro arduino
Intro arduinoIntro arduino
Intro arduino
SOAEnsAD
 
Cassiopeia Ltd - ESP8266+Arduino workshop
Cassiopeia Ltd - ESP8266+Arduino workshopCassiopeia Ltd - ESP8266+Arduino workshop
Cassiopeia Ltd - ESP8266+Arduino workshop
tomtobback
 
Presentation arduino
Presentation arduinoPresentation arduino
Presentation arduino
SinGuy
 
Présentation Arduino par Christian, F5HOD
Présentation Arduino par Christian, F5HODPrésentation Arduino par Christian, F5HOD
Présentation Arduino par Christian, F5HOD
webmasterref68
 
Sócrates y sofistas
Sócrates y sofistasSócrates y sofistas
Sócrates y sofistas
minervagigia
 
Ein- und Ausgangsverwiegung mit Radlastwaagen von ATP Messtechnik
Ein- und Ausgangsverwiegung mit Radlastwaagen von ATP MesstechnikEin- und Ausgangsverwiegung mit Radlastwaagen von ATP Messtechnik
Ein- und Ausgangsverwiegung mit Radlastwaagen von ATP Messtechnik
ATP Messtechnik
 
Abhishek Garg Resume
Abhishek Garg ResumeAbhishek Garg Resume
Abhishek Garg ResumeAbhishek Garg
 

Viewers also liked (12)

Comentario desmayarse, atreverse, estar furioso.
Comentario desmayarse, atreverse, estar furioso.Comentario desmayarse, atreverse, estar furioso.
Comentario desmayarse, atreverse, estar furioso.
 
Event Sourcing with Microservices
Event Sourcing with MicroservicesEvent Sourcing with Microservices
Event Sourcing with Microservices
 
Narrativa medieval
Narrativa medievalNarrativa medieval
Narrativa medieval
 
Como hacer amigos e influir sobre las personas
Como hacer amigos e influir sobre las personasComo hacer amigos e influir sobre las personas
Como hacer amigos e influir sobre las personas
 
Cours0 presentation carte arduino
Cours0   presentation carte arduinoCours0   presentation carte arduino
Cours0 presentation carte arduino
 
Intro arduino
Intro arduinoIntro arduino
Intro arduino
 
Cassiopeia Ltd - ESP8266+Arduino workshop
Cassiopeia Ltd - ESP8266+Arduino workshopCassiopeia Ltd - ESP8266+Arduino workshop
Cassiopeia Ltd - ESP8266+Arduino workshop
 
Presentation arduino
Presentation arduinoPresentation arduino
Presentation arduino
 
Présentation Arduino par Christian, F5HOD
Présentation Arduino par Christian, F5HODPrésentation Arduino par Christian, F5HOD
Présentation Arduino par Christian, F5HOD
 
Sócrates y sofistas
Sócrates y sofistasSócrates y sofistas
Sócrates y sofistas
 
Ein- und Ausgangsverwiegung mit Radlastwaagen von ATP Messtechnik
Ein- und Ausgangsverwiegung mit Radlastwaagen von ATP MesstechnikEin- und Ausgangsverwiegung mit Radlastwaagen von ATP Messtechnik
Ein- und Ausgangsverwiegung mit Radlastwaagen von ATP Messtechnik
 
Abhishek Garg Resume
Abhishek Garg ResumeAbhishek Garg Resume
Abhishek Garg Resume
 

Similar to Arduino Basics

Design Guide on USB-C PD Charge-Through Feature with Data Role Swap - Welcome...
Design Guide on USB-C PD Charge-Through Feature with Data Role Swap - Welcome...Design Guide on USB-C PD Charge-Through Feature with Data Role Swap - Welcome...
Design Guide on USB-C PD Charge-Through Feature with Data Role Swap - Welcome...
aud Scarlet
 
In-Circuit Test Probes
In-Circuit Test ProbesIn-Circuit Test Probes
In-Circuit Test Probes
Equip-Test Kft
 
Report Remote communication of Robotic module using lifa
Report Remote communication of Robotic module using lifaReport Remote communication of Robotic module using lifa
Report Remote communication of Robotic module using lifa
Vatsal N Shah
 
IEEE PROJECTS FOR ECE 2013 2014
IEEE PROJECTS FOR ECE 2013 2014IEEE PROJECTS FOR ECE 2013 2014
IEEE PROJECTS FOR ECE 2013 2014
JPINFOTECH JAYAPRAKASH
 
History on Technology Development by Cantoria of IV-BSITE
History on Technology Development by Cantoria of IV-BSITEHistory on Technology Development by Cantoria of IV-BSITE
History on Technology Development by Cantoria of IV-BSITE
mrose_cantoria
 
Hcna intermediate lab
Hcna intermediate labHcna intermediate lab
Hcna intermediate lab
Ibrahima Toure
 
Mc100 installation guide
Mc100 installation guideMc100 installation guide
Mc100 installation guideNetPlus
 
Tools for Cisco Pre Sales Engineers
Tools for Cisco Pre Sales EngineersTools for Cisco Pre Sales Engineers
Tools for Cisco Pre Sales Engineers
Andre Mendes Camillo
 
Shaking Hands with Apple TV
 Shaking Hands with Apple TV Shaking Hands with Apple TV
Shaking Hands with Apple TVcrysatal16
 
Flow control trainer | Best Flow control trainer price in India - sap engineers
Flow control trainer | Best Flow control trainer price in India - sap engineersFlow control trainer | Best Flow control trainer price in India - sap engineers
Flow control trainer | Best Flow control trainer price in India - sap engineers
Icecream48
 
Pneumatic trainer kit price | plc based electro pneumatic trainer | pneumatic...
Pneumatic trainer kit price | plc based electro pneumatic trainer | pneumatic...Pneumatic trainer kit price | plc based electro pneumatic trainer | pneumatic...
Pneumatic trainer kit price | plc based electro pneumatic trainer | pneumatic...
Icecream48
 
AVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A Glance
AVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A GlanceAVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A Glance
AVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A Glance
Scott Faria
 

Similar to Arduino Basics (20)

Design Guide on USB-C PD Charge-Through Feature with Data Role Swap - Welcome...
Design Guide on USB-C PD Charge-Through Feature with Data Role Swap - Welcome...Design Guide on USB-C PD Charge-Through Feature with Data Role Swap - Welcome...
Design Guide on USB-C PD Charge-Through Feature with Data Role Swap - Welcome...
 
In-Circuit Test Probes
In-Circuit Test ProbesIn-Circuit Test Probes
In-Circuit Test Probes
 
Report Remote communication of Robotic module using lifa
Report Remote communication of Robotic module using lifaReport Remote communication of Robotic module using lifa
Report Remote communication of Robotic module using lifa
 
IEEE PROJECTS FOR ECE 2013 2014
IEEE PROJECTS FOR ECE 2013 2014IEEE PROJECTS FOR ECE 2013 2014
IEEE PROJECTS FOR ECE 2013 2014
 
History on Technology Development by Cantoria of IV-BSITE
History on Technology Development by Cantoria of IV-BSITEHistory on Technology Development by Cantoria of IV-BSITE
History on Technology Development by Cantoria of IV-BSITE
 
RAPELLY_resume1
RAPELLY_resume1RAPELLY_resume1
RAPELLY_resume1
 
Mohammed Habeeb_Engineer
Mohammed Habeeb_EngineerMohammed Habeeb_Engineer
Mohammed Habeeb_Engineer
 
Mohammed Habeeb_Engineer
Mohammed Habeeb_EngineerMohammed Habeeb_Engineer
Mohammed Habeeb_Engineer
 
Access point
Access pointAccess point
Access point
 
Hcna intermediate lab
Hcna intermediate labHcna intermediate lab
Hcna intermediate lab
 
Hassan-CV
Hassan-CVHassan-CV
Hassan-CV
 
Mc100 installation guide
Mc100 installation guideMc100 installation guide
Mc100 installation guide
 
Tools for Cisco Pre Sales Engineers
Tools for Cisco Pre Sales EngineersTools for Cisco Pre Sales Engineers
Tools for Cisco Pre Sales Engineers
 
Shaking Hands with Apple TV
 Shaking Hands with Apple TV Shaking Hands with Apple TV
Shaking Hands with Apple TV
 
Flow control trainer | Best Flow control trainer price in India - sap engineers
Flow control trainer | Best Flow control trainer price in India - sap engineersFlow control trainer | Best Flow control trainer price in India - sap engineers
Flow control trainer | Best Flow control trainer price in India - sap engineers
 
Pneumatic trainer kit price | plc based electro pneumatic trainer | pneumatic...
Pneumatic trainer kit price | plc based electro pneumatic trainer | pneumatic...Pneumatic trainer kit price | plc based electro pneumatic trainer | pneumatic...
Pneumatic trainer kit price | plc based electro pneumatic trainer | pneumatic...
 
AVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A Glance
AVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A GlanceAVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A Glance
AVR HOW-TO GUIDE Interfacing SPI-Ethernet With AVR Slicker Contents At A Glance
 
SRahman.CV
SRahman.CVSRahman.CV
SRahman.CV
 
CISCOtoHP (1)
CISCOtoHP (1)CISCOtoHP (1)
CISCOtoHP (1)
 
News-letter-July15
News-letter-July15News-letter-July15
News-letter-July15
 

More from Md. Ashifur Rahaman

Mspc 2018 ashifur
Mspc 2018  ashifurMspc 2018  ashifur
Mspc 2018 ashifur
Md. Ashifur Rahaman
 
Mspc 2018 irfan-edited
Mspc 2018 irfan-editedMspc 2018 irfan-edited
Mspc 2018 irfan-edited
Md. Ashifur Rahaman
 
Design of a 20,000 t double acting ice class general cargo ship of service ...
Design of a 20,000 t double acting ice class general cargo ship   of service ...Design of a 20,000 t double acting ice class general cargo ship   of service ...
Design of a 20,000 t double acting ice class general cargo ship of service ...
Md. Ashifur Rahaman
 
Arduino
Arduino Arduino
Scantling of Ship
Scantling of ShipScantling of Ship
Scantling of Ship
Md. Ashifur Rahaman
 
Cargo ship componenet
Cargo ship componenetCargo ship componenet
Cargo ship componenet
Md. Ashifur Rahaman
 
Rudder & Steering Design
Rudder & Steering Design  Rudder & Steering Design
Rudder & Steering Design
Md. Ashifur Rahaman
 
Technology Runs to Get Brains’ Control
Technology Runs to Get Brains’ ControlTechnology Runs to Get Brains’ Control
Technology Runs to Get Brains’ Control
Md. Ashifur Rahaman
 

More from Md. Ashifur Rahaman (8)

Mspc 2018 ashifur
Mspc 2018  ashifurMspc 2018  ashifur
Mspc 2018 ashifur
 
Mspc 2018 irfan-edited
Mspc 2018 irfan-editedMspc 2018 irfan-edited
Mspc 2018 irfan-edited
 
Design of a 20,000 t double acting ice class general cargo ship of service ...
Design of a 20,000 t double acting ice class general cargo ship   of service ...Design of a 20,000 t double acting ice class general cargo ship   of service ...
Design of a 20,000 t double acting ice class general cargo ship of service ...
 
Arduino
Arduino Arduino
Arduino
 
Scantling of Ship
Scantling of ShipScantling of Ship
Scantling of Ship
 
Cargo ship componenet
Cargo ship componenetCargo ship componenet
Cargo ship componenet
 
Rudder & Steering Design
Rudder & Steering Design  Rudder & Steering Design
Rudder & Steering Design
 
Technology Runs to Get Brains’ Control
Technology Runs to Get Brains’ ControlTechnology Runs to Get Brains’ Control
Technology Runs to Get Brains’ Control
 

Recently uploaded

MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
TeeVichai
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
Kamal Acharya
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
MdTanvirMahtab2
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
ssuser9bd3ba
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
AhmedHussein950959
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
Kamal Acharya
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
MuhammadTufail242431
 

Recently uploaded (20)

MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
Railway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdfRailway Signalling Principles Edition 3.pdf
Railway Signalling Principles Edition 3.pdf
 
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdfCOLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
COLLEGE BUS MANAGEMENT SYSTEM PROJECT REPORT.pdf
 
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
Industrial Training at Shahjalal Fertilizer Company Limited (SFCL)
 
LIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.pptLIGA(E)11111111111111111111111111111111111111111.ppt
LIGA(E)11111111111111111111111111111111111111111.ppt
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
ASME IX(9) 2007 Full Version .pdf
ASME IX(9)  2007 Full Version       .pdfASME IX(9)  2007 Full Version       .pdf
ASME IX(9) 2007 Full Version .pdf
 
Cosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdfCosmetic shop management system project report.pdf
Cosmetic shop management system project report.pdf
 
Halogenation process of chemical process industries
Halogenation process of chemical process industriesHalogenation process of chemical process industries
Halogenation process of chemical process industries
 

Arduino Basics

  • 1. Bangladesh University of Engineering & Technology (BUET), Dhaka-1000 Microcontroller Programming Beginning with Arduino Ashifur Rahaman C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 2.     Microcontrollers  Tiny, self­contained computers in an IC  Often contain peripherals  Different packages availible  Vast array of size and power availible C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
  • 3. Bangladesh University of Engineering & Technology (BUET), Dhaka-1000 C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 4. Bangladesh University of Engineering & Technology (BUET), Dhaka-1000 C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 5. Bangladesh University of Engineering & Technology (BUET), Dhaka-1000 C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
  • 6.     Sensory Input  Robots need to be able to recieve input from the  world in the form of sensory input.  Microcontrollers handle this input.  Thousands of sophisticated sensors availiable C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 7.     Pressure/Force Sensors C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 8.     GPS Locators C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 9.     Gyroscopes C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
  • 10.     Wheel Encoders C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
  • 11.     Infared Proximity Detectors C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 12.     Accelerometers C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 13.     Ultrasonic Rangefinders C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
  • 14.     Alcohol Vapor Density Detectors C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 15.     Arduino  Development board for the ATMega328  Inludes  Programmer,  Voltage Regulators  Seral to USB Converter  CHEAP ­­ $30! Has everything you need! C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 16.     Arduino C Template void setup() {   // Setup stuff to only run once at the beginning    } void loop() {   // This function gets called indefinatly } C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 17.     Peripherals  Analog to Digital Converters (ADC)  Counters/Timers (TMRx)  PWM Modules (CCP/PWM)  Serial Ports (UART)  Many, many more.... C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 18.     Digital I/O  Only HIGH and LOW values  Each pin configurable to do input or output  pinMode(pinNumber, pinState)  pinMode(13, INPUT)  pinMode(13, OUTPUT) C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 19.     Digital I/O (Part II)  Output  digitalWrite(pinNumber, HIGH/LOW)  Input  int val = digitalRead(pinNumber) C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 20.     Arduino Digital I/O Example int ledPin =  13; void setup() {   // Set the digital pin as output:   pinMode(ledPin, OUTPUT);       } void loop() {   // Bring the pin high (1)   digitalWrite(ledPin, HIGH); } C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 21.     Serial Interface (UART)  Communicate with other microcontrollers or PC's  Asynch. communication  Arduino libraries make it extremely easy  Serial.begin(baudRate)  Serial.println(”String To Send”)  int bytesWaiting = Serial.Availible()  Char incomingData = Serial.read() C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 22.     Arduino Serial Example void setup() { Serial.begin(9600);  // Setup baud rate } void loop() { Serial.println(”Give me input”);  // output data while(Serial.availible() < 1) {     // if there's data waiting char input = Serial.read();     // get a byte of data } } C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 23.     Analog to Digital Converter (ADC)  Take analog voltage as input on one of the pins  Return digital representation to program  Different numbers of bits change precision. C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 24.     C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 25.     C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 26.     Light Sensors  Photoresistors  Extremely Simple to Use  Resistance changes with light  Measure voltage over the sensor with an ADC, and you're done  Many more complicated sensors simulate this behavior for simplicity C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com Bangladesh University of Engineering & Technology (BUET), Dhaka-1000
  • 27.     Arduino ADC Example int sensorPin = 0; void setup() {   Serial.begin(9600); // Turn on Serial Connection } void loop() {   // read the value from the sensor:   sensorValue = analogRead(sensorPin);      // Print sensor value to the Serial   Serial.println(sensorValue); } C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 28.     PWM Modules (CCP)  Create PWM signals on output pins  Measure PWM signals on input pins  CCP stands for Capture/Compare  What is PWM, anyway? C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 29.     Pulse Width Modulation (PWM)  Transmit analog values using a single digital input/ output pin through careful timing.  A PWM signal consists of two values  Period: how long before the signal repeats  Pulse Width: how long the signal is HIGH before it  goes LOW.  Duty Cycle: % of time the signal is HIGH, or (Pulse Width / Period) C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 30.     C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 31.     PWM In Robotics  The average voltage (Duty Cycle * Voltage) can be  used to control the speed of DC motors.  Innaccurate, poor strength, braking, and other  problems exist.  Servo Motors and Speed Controllers. C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 32.     Servo Motors  DC Motor with gears allow for high torque  Embedded microcontroller monitors PWM input  and motor position.  Vary pulse width to change position of motor C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 33.     Speed Controllers  Embedded microcontroller varies voltage on output  lines based on PWM input.  Results in constant voltage to motors rather than  intermittent.  Allow a second, more powerful, power supply to  drive large motors.  Alter pusle width to change the speed of the motor C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 34.     Arduino PWM Command  AnalogWrite(Pin, DutyCycle)  DutyCycle = 0   0%, 127   50%, 255   100%→ → →  Pin can be 3, 5, 6, 9, 10, or 11  Frequency of about 490Htz  Other periods are possible, but not with AnalogWrite C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 35.     Arduino PWM Example int Pin = 9; void setup() {   pinMode(Pin, OUTPUT); } void loop() {   analogWrite(Pin, 127);  // Generate 50% duty cycle on ”Pin” } C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com
  • 36. Bangladesh University of Engineering & Technology (BUET), Dhaka-1000 Useful Resources  Robot Parts and Excellent Forums www.TrossenRobotics.com  Electrical parts, sensors, and microcontrollers www.Sparkfun.com  Arduino Development Platform www.ardiono.cc C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software.com C lick to B U Y N O W ! PD F-XChange Edit or www . tracker-software .com