Bionic Arduino

Páginas: 9 (2222 palabras) Publicado: 23 de abril de 2012
Bionic Arduino
Introduction to Microcontrollers with Arduino

Class 4
20 Nov 2007 - machineproject - Tod E. Kurt

What’s for Today
• About PWM • Controlling Servos • About the I2C bus • Using I2C on Arduino • About Accelerometers • Nintendo Wii Nunchuck as Input Device

Recap: Blinky LED
Make sure things still work

compile

upload

Load “File/Sketchbook/Examples/Digital/Blink”TX/RX flash

link sketch runs b
Change the “delay()” values to change blink rate

link b

Pulse Width Modulation
• More commonly called “PWM” • Computers can’t output analog voltages • Only digital voltages (0 volts or 5 volts) • But you can fake it • if you average a digital signal flipping
between two voltages.

• For example...

PWM
Output voltage is averaged from on vs. offtime
output_voltage = (on_time / off_time) * max_voltage
5 volts

3.75 Volts
0 volts 75% 25% 75% 25% 75% 25%

5 volts

2.5 Volts
0 volts 50% 50% 50% 50% 50% 50%

5 volts 0 volts 20% 80% 20% 80% 20% 80%

1.0 Volts

PWM
• Used everywhere

Lamp dimmers, motor speed control, power supplies, noise making

• Three characteristics of
PWM signals

• • •

Pulse width range(min/max) Pulse period (= 1/pulses per second) Voltage levels (0-5V, for instance)
height

width

period

You experienced a few applications of PWM already.

Servomotors
• Can be positioned
from 0-180º (usually)

• Internal feedback • Easy three-wire

circuitry & gearing takes care of the hard stuff PWM 5V interface

More specifically, these are R/C hobby servos used by remote controlenthusiasts In general, “servomotor” is a motor with an inherent feedback mechanism that allows you to send position commands to it without requiring you to do the position reading.

Servos are Awesome
• • • • •
DC motor High-torque gearing Potentiometer to read position Feedback circuitry to read pot and control motor All built in, you just feed it a PWM signal

With these little blue onesyou have, you can see inside a bit at the internals of the servo.

Servos, good for what?
• Roboticists, movie effects people, and
puppeteers use them extensively motion

• Any time you need controlled, repeatable • Can turn rotation into linear movement
with clever mechanical levers

Even clothes use servos now:

http://www.technologyreview.com/read_article.aspx?id=17639&ch=infotech Servos
• Come in all sizes • from super-tiny • to drive-your-car • But all have the same
3-wire interface
weight: speed: torque: voltage: size:
http://rctoys.com/ http://hobbypeople.net/

9g

• Servos are spec’d by:
9g .12s/60deg @ 6V 22oz/1.5kg @ 6V 4.6~6V 21x11x28 mm

157g

Servo Mounts & Linkages
Lots of ways to mount a servo

And turn its rotational motion into other typesof motion

mounting bracket:

http://www.sierragiant.com/prod28.html

Servo Control
180º

Ground (0V) Power (+5V) Control (PWM)

• PWM freq is 50 Hz (i.e. every 20 millisecs) • Pulse width ranges from 1 to 2 millisecs • 1 millisec = full anti-clockwise position • 2 millisec = full clockwise position

Servo Movement
0 degrees 90 degrees 180 degrees

1000 microsecs

1500 microsecs2000 microsecs

In practice, pulse range can range from 500 to 2500 microsecs
(and go ahead and add a wire marker to your servo like the above)
Put the red “arm” on your servo. Needs a philips screwdriver. Many commercial servo drivers have a calibration setting to deal with servo variability

Servo and Arduino
First, add some jumper wires to the servo connector

Gnd Power PWMcontrol

I recommend matching the color coding of the wires as closely as possible

Servo and Arduino

Plug power wires in Plug control wire to digital pin 7

Moving a Servo
“ServoSimple” Move the servo across its range of motion
Uses delayMicroseconds() for pulse width Uses delay() for pulse frequency

Sketch is in the handout Created a custom function to handle making servo pulses New...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • la bionica
  • Bionica
  • Bionica
  • bionico
  • Biónica
  • Bionica
  • Bionica
  • BIONICOS

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS