Microcontroller Handson Workshop 3 Ahmad Manshad New Mexico
- Slides: 25
Microcontroller Hands-on Workshop #3 Ahmad Manshad New Mexico State University Institute of Electrical and Electronics Engineers November 7, 2009
Agenda for Today v. Quick Review v. More sensors (Infrared) v. Introduction to pulse width modulation (PWM) v. Controlling motors with the Arduino v. Begin working on robot 2
Today’s Kit 1. Arduino Microcontroller/ USB Cable 2. Breadboard 3. 1 x Red LED 4. Infrared Sensor 5. Wires 6. Soldering Iron w/ solder 7. Freeduino Motor Controller 3
Quick Review - Code int led. Pin = 13; // LED connected to digital pin 13 void setup() { pin. Mode(led. Pin, OUTPUT); // sets the digital pin as output } void loop() { digital. Write(led. Pin, HIGH); // sets the LED on delay(1000); // waits for a second digital. Write(led. Pin, LOW); // sets the LED off delay(1000); // waits for a second } 4
Quick Review - Breadboard 5
Infrared Proximity Sensor v Send infrared light through IR-LEDs, which is then reflected by any object in front of the sensor. 6
Infrared Proximity Sensor v Sender: IR Emitter LED v Receiver: IR Detector LED w/ an operational amplifier. 7
Solder Wires to IR Sensor v Left pin (1) – SIGNAL v Middle pin (2) – GROUND v Right pin (3) – POWER( +5 volts) 2 1 3 8
How to Solder Wires to IR Sensor 1. Warm up the iron 2. Prepare a moisten sponge 3. Apply heat to the lead. 4. Apply solder to the lead 5. Allow solder to cool down 6. Inspect the connection 9
IR connected to arduino - CODE 10
Pulse Width Modulation v PWM signal is a digital square wave where the fraction of the time the signal is on can be varied between 0 and 100%. v Call analog. Write(pin, duty. Cycle), where duty. Cycle is a value from 0 to 255. v Use one of the PWM pins (3, 5, 6, 9, 10, or 11). 11
Applications 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. 12
Motors � Electromechanical device that converts electrical energy to mechanical energy 13
Motors! �DC Motor �Servo Motors �Stepper Motor 14
DC 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 15
Servo Motor (DC motor w/ feedback) �Pros �Simple (3 wire) and “Standard” �accurate even under load �High torque �Cons �Slower �More expensive 16
Servo Motor 17
Simple Motor Driver �Motors are inductive loads and require a high current �Use a transistor to switch the high-current load 18
H-Bridge v An H-bridge is an electronic circuit which enables a voltage to be applied across a load in either direction. v Often used in robotics and other applications to allow DC motors to run forwards and backwards. v H-bridges are available as integrated circuits, or can be built from discrete components (i. e. four switches) 19
H-Bridge �S 1 and S 4 closed - positive voltage applied across the motor. �S 2 and S 3 closed - voltage is reversed, negative voltage applied. �S 1 and S 2 (or S 3 and S 4) closed – short circuit! 20
Freeduino Motor Controller �Control 2 motors from your Arduino �SN 754410 NE 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 21
Assembling 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-freeduino- arduino-motor-shield/ 22
Soldering Components to PCB 23
Robot Design v. Discuss Robot Plans with Team Members! 24
Questions or Comments? 25
- This is the religion that god accepts
- Alsa routing
- Analytical research
- James handson
- James handson
- A handson
- Handson activities
- Handson activities
- Handson session
- New mexico history timeline
- Nmmip
- New mexico interlock
- New mexico brain injury resource center
- Acd 31075
- New mexico board of pharmacy license verification
- New mexico ffa
- Cte school new mexico
- Meteor crater new mexico
- New mexico tech
- F ti
- Sunset baseball field
- Special olympics new mexico
- New mexico amp
- Independent petroleum association of new mexico
- Conduent benefits web
- New mexico privacy