Title: Getting Started with the: Wind Energy Challenge
1Microcontroller Hands-on Workshop 3
Ahmad Manshad New Mexico State University Institut
e of Electrical and Electronics
Engineers November 7, 2009
2Agenda for Today
- Quick Review
- More sensors (Infrared)
- Introduction to pulse width modulation (PWM)
- Controlling motors with the Arduino
- Begin working on robot
3Todays Kit
- Arduino Microcontroller/ USB Cable
- Breadboard
- 1x Red LED
- Infrared Sensor
- Wires
- Soldering Iron w/ solder
- Freeduino Motor Controller
4Quick Review - Code
- int ledPin 13 // LED connected
to digital pin 13 -
- void setup()
-
- pinMode(ledPin, OUTPUT) // sets the
digital pin as output -
-
- void loop()
-
- digitalWrite(ledPin, HIGH) // sets the LED
on - delay(1000) // waits for a
second - digitalWrite(ledPin, LOW) // sets the LED
off - delay(1000) // waits for a
second -
-
5Quick Review - Breadboard
6Infrared Proximity Sensor
- Send infrared light through IR-LEDs, which is
then reflected by any object in front of the
sensor.
7Infrared Proximity Sensor
- Sender IR Emitter LED
- Receiver IR Detector LED w/ an operational
amplifier.
8Solder Wires to IR Sensor
- Left pin (1) SIGNAL
- Middle pin (2) GROUND
- Right pin (3) POWER( 5 volts)
2
3
1
9How to Solder Wires to IR Sensor
- Warm up the iron
- Prepare a moisten sponge
- Apply heat to the lead.
- Apply solder to the lead
- Allow solder to cool down
- Inspect the connection
10IR connected to arduino - CODE
11Pulse Width Modulation
- PWM signal is a digital square wave where the
fraction of the time the signal is on can be
varied between 0 and 100. - Call analogWrite(pin, dutyCycle), where dutyCycle
is a value from 0 to 255. - Use one of the PWM pins (3, 5, 6, 9, 10, or 11).
12Applications of Pulse Width Modulation
- Dimming an LED
- Generating audio signals.
- Generating a modulated signal, for example to
drive an infrared LED for a remote control. - Providing variable speed control for motors.
13Motors
- Electromechanical device that converts electrical
energy to mechanical energy
14Motors!
- DC Motor
- Servo Motors
- Stepper Motor
15DC Motor
- Pros
- Simple cheap (only 2 wires)
- Fast can be geared down for higher torque
- Easy to reverse
- Speed control through PWM
- Cons
- No built-in feedback
16Servo Motor (DC motor w/ feedback)
- Pros
- Simple (3 wire) and Standard
- accurate even under load
- High torque
- Cons
- Slower
- More expensive
17Servo Motor
18Simple Motor Driver
- Motors are inductive loads and require a high
current - Use a transistor to switch the high-current load
19H-Bridge
- An H-bridge is an electronic circuit which
enables a voltage to be applied across a load in
either direction. - Often used in robotics and other applications to
allow DC motors to run forwards and backwards. - H-bridges are available as integrated circuits,
or can be built from discrete components (i.e.
four switches)
20H-Bridge
- S1 and S4 closed - positive voltage applied
across the motor. - S2 and S3 closed - voltage is reversed, negative
voltage applied. - S1 and S2 (or S3 and S4) closed short circuit!
21Freeduino Motor Controller
- Control 2 motors from your Arduino
- SN754410NE motor driver
- Board and Arduino pinout
- Motor A Direction - Arduino Digital pin 13
- Motor A Speed (PWM) - Arduino Digital pin 10
- Motor B Direction - Arduino Digital pin 12
- Motor B Speed (PWM) - Arduino Digital pin 9
22Assembling Freeduino Motor Controller
- GO TO WWW.GOOGLE.COM
- TYPE FREEDUINO MOTOR
- CLICK ON THE FIRST LINK
- CLICK THE LINK THIS GUIDE
- Or Type the following in the address bar
- http//mcukits.com/2009/03/12/assembling-the-freed
uino-arduino-motor-shield/
23Soldering Components to PCB
24Robot Design
- Discuss Robot Plans with Team Members!
25Questions or Comments?