Title: Chapter 2: Your Boe-Bot's Servo Motors
1Chapter 2 Your Boe-Bot's Servo Motors
Presentation based on"Robotics with the
Boe-Bot" By Andy LindsayParallax, Inc
Presentation developed byMartin A.
HebelSouthern Illinois University
Carbondale College of Applied Sciences and
Arts Electronic Systems Technologies 7/6/04
2Continuous Rotation Servo
- Used to provide drive motion for the
Bot. - Standard Servo Used for positioning, such as
with RC airplane rudder and flaps. - Continuous Rotation Servo Rotate in a certain
direction and speed.
3Tracking Time
- PAUSE is used to have the BASIC Stamp wait a
short amount of time.PAUSE duration - Duration is in milliseconds (mS) or 1/1000th of a
second, 1-65535PAUSE 1000
4(No Transcript)
5Repeating Actions
- A DO.LOOP is used to repeat a sequence of
commands.DO 'Commands to performLOOP
6Basic Electronics
- Voltage (V or E) Potential difference between 2
points. Volts. - () - A lack of electrons
- (-) A surplus of electrons
- When a circuit is formed, electrons will flow to
equalize out the 2 sides. - Current (I) The measure of the flow of
electrons. Amps. - Resistance (R) Opposition to current flow. Ohms.
- Ohm's Law I V/R
7(No Transcript)
8Resistors
- Devices used to insert resistance, or oppose
current flow. Used to limit current flow. - Color codes are used to indicate the value.
9 10The LED
- LED Light Emitting Diode
- Diode Device which allows current to flow in
only one direction. - To operate it must be installed correctly with
respect to polarity.
11- A regular LED can be damaged if current exceed
20mA (milliamps) or 0.02 amps. - Apply ohm's law to find the resistor size that
will limit current to 20mAwith a 5V supply.I
V/R
12LED Circuit Schematic
13The BreadBoard
- Breadboards are used to make connections between
devices.
14Building the Circuit
15Pictorial or Wiring Diagram
16Code to Blink LEDs
17Task
- Perform Chapter 2 up to this point (page 52),
including "Your Turn- Blink the other LED"
18Additional The Speaker/Buzzer
- A small piezoelectric speaker is included with
your kits. - A frequency can be made on it using the FREQOUT
command.FREQOUT pin, duration, frequency - pin Pin it is connected to.
- duration Length of time in milliseconds.
- frequency Frequency to play, measured in Hertz
(Hz).
19- Sound the Speaker for 1 second at 1000Hz
20Pseudo-Code
- Pseudo-Code is English-like statements that
describes the steps the code will perform - From the pseudo-code, the program code can be
developed to match the actions needed.
21Group Task
- Write a program that will
- Display in DEBUG Window "Stop! Police!"
- Turn ON P12 LED
- Sound a tone for ½ second at 1000Hz
- Turn OFF P12 LED
- Turn on P13 LED
- Sound a tone for ½ second at 2000Hz
- Turn off P13 LED
- Repeat sequence
22Individual Task
- Develop a program to perform the following
- Turn on P12 LED
- Wait ½ second
- Turn on P13 LED
- Wait ½ second
- Sound tone at 3000 Hz for 1 second
- Turn off P13 LED
- Wait ½ second
- Turn off P12 LED
- Wait ½ second
- Sound tone at 2000 Hz for 1 second
- Repeat entire sequence
23Servo Signals
- Servos are controlled with a high pulse lasting a
short time, and repeated. - The PULSOUT instruction can be used to send a
short pulse.PULSOUT Pin, Duration - Pin Pin device is connected to.
- Duration Time in 2?S (microsecond) intervals,
1-65535. Microsecond 1 millionth of a
second.PULSOUT 12, 1PULSOUT 13, 2
24(No Transcript)
25Servo Signals
- Typical servos require a pulse of 1mS to 2mS to
define the direction/position. - A 20mS pause must be between each pulse.
- What values of PULSOUT are in the valid range?
26Connecting the Servos
27(No Transcript)
28Centering the Servos
- The pulse width defines the direction and speed
of the servo motor. - 1000 Maximum speed one direction
- 750 Stopped
- 500 Maximum speed other direction
- Use the servo center programs to ensure it is
stopped at 750.
29(No Transcript)
30Task
- Perform Activities 3 and 4
31Storing and Counting Values
- Variable are used to store values
- Variables much be declared prior to being used.
Declaring a variable is giving it a name, and a
size to hold.VariableName var Size
32- DEBUG ? is short hand to display the value of a
variable or pin.
33Counting and Controlling Repetitions
- FORNEXT loops can be used to control the number
of repetitions a segment of code takes.FOR
StartValue TO EndValue STEP StepValueNEXT
34What will this code do?
- Freq VAR Word
- DO
- FOR Freq 1000 to 5000 Step 100 DEBUG ?
Freq - FREQOUT 4, 100, Freq TOGGLE 12 TOGGLE
13NEXT - LOOP
35Testing Servos
- To control the servo, send a series of pulses
with values between 500 to 1000 (1-2mS) - Changing the value will change the direction and
speed to some extent.
36FORNEXT to Control Servo Run Time
- The FORNEXT Loop can be used to control how long
to drive a servo.
37(No Transcript)
38TASKS
- Perform Activities 5 and 6
- Test servo speeds and directions on pages 79 and
80.
39Group Task
- Put LEDs on P7, P8, Speaker on P4
- Write a program to perform the following
pseudo-code. - Turn on P7 LED
- Wait one second
- Rotate P12 servo CW for 1 second
- Repeat 3 time
- Sound 2000Hz tone for 2 second
- Pause 1 second
- Turn on P8 LED
- Rotate P13 BOTH servos CCW
- End the program
40Review
41(No Transcript)