Controlling the Outside World Servo Motor Servo motor

  • Slides: 15
Download presentation
Controlling the Outside World Servo Motor

Controlling the Outside World Servo Motor

Servo motor • A feedback controlled motor – The Parallax standard servo motor has

Servo motor • A feedback controlled motor – The Parallax standard servo motor has built in feedback – Range of motion is limited • Parallax also supplies continuous servo motors for robotic applications but… – This is not a continuous servo! • That is, it will not go 360º • It will hit “stops” at either direction around

The servo motor

The servo motor

Wiring the servo motor • You can wire up the servo on the proto

Wiring the servo motor • You can wire up the servo on the proto board as shown in the schematic… • …but, there’s an easier way

Wiring the servo motor

Wiring the servo motor

Wiring the servo motor • The X 4 and X 5 connectors are designed

Wiring the servo motor • The X 4 and X 5 connectors are designed to control the servo motors • But, the power source must be set via the jumper connector

Power • Check your power source! – If using a DC power blocks, it

Power • Check your power source! – If using a DC power blocks, it may be 9 V or it may be 6 V – Set the Vdd/Vin jumper as specified • Vdd if using a 9 V source (or 9 V battery) • Vin if using a 6 V source – Power switch must be in position 2 to send power to the X 4/X 5 (servo) connectors

How it works • To light up an LED we send a continuous, level

How it works • To light up an LED we send a continuous, level signal (DC voltage) voltage 5 v HIGH pin 0 v time

Controlling the servo • To move the servo horn we send a pulse train

Controlling the servo • To move the servo horn we send a pulse train voltage 5 v 0 v 1. 5 ms 20 ms Time (in milli-seconds)

Controlling the servo • The pulse width will control the location of the servo

Controlling the servo • The pulse width will control the location of the servo • The time between pulses should be 20 milli-seconds

From PBASIC • PULSOUT command PULSOUT pin, duration • pin is the pin number

From PBASIC • PULSOUT command PULSOUT pin, duration • pin is the pin number to which your servo is wired (12, 13, 14, or 15 if you are using the servo ports on the Rev. C board) • duration is the pulse width

PULSOUT command details • The duration parameter is in units of 2μS (2 micro-seconds)

PULSOUT command details • The duration parameter is in units of 2μS (2 micro-seconds) • The servo prefers values in units of milliseconds • The time between pulses is under software control (PAUSE command – units of milli-seconds)

Activity – in class • Test the servo – Test all 4 servo ports

Activity – in class • Test the servo – Test all 4 servo ports • Find the values of the duration parameter (in the PULSOUT command) that cause the servo to hit the stops in both the clockwise and counterclockwise directions

Homework • • Design a system that continually moves the servo from one stop

Homework • • Design a system that continually moves the servo from one stop to the other – That is, it goes from full counter-clockwise to full clockwise and back again, continuously Add two buttons to the board (B 1 and B 2) – B 1 is the emergency stop (EStop) • When it is pressed all servo motion stops – B 2 is the reset button • When it is pressed the servo motion begins again Add two LEDs – The red LED lights when the servo is all the way clockwise – The green LED lights when the servo is all the way counterclockwise – Both LEDs are off (not lit) when the servo is somewhere between clockwise and counterclockwise The servo should not “slam” into the stops

Deliverables • A state-machine diagram depicting the operation of the system • Source code

Deliverables • A state-machine diagram depicting the operation of the system • Source code • A schematic diagram of the circuit • A working demonstration on the Basic Stamp development board (in class)