Week 13 Today - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Week 13 Today

Description:

It operates at a high, fixed frequency (thus not usable for servos) Great for LEDs and motors. Uses built-in PWM circuits of the ATmega8 chip (no software needed) ... – PowerPoint PPT presentation

Number of Views:49
Avg rating:3.0/5.0
Slides: 20
Provided by: turimc
Category:
Tags: servos | today | week

less

Transcript and Presenter's Notes

Title: Week 13 Today


1
Week 13Today
  • Homework presentations.
  • Data to and from with LEDs.
  • H-bridge, Batteries and such.
  • Final project discussion.

2
Homework
  • Present inspirations.
  • Show your FUNCTIONAL interactive piece.
  • Show documentation of your other draft piece.
  • Discuss your concept.

3
  • Review and Requests

4
Arduino PWM
  • Arduino has built-in PWM
  • On pins 9,10,11
  • Use analogWrite(pin,value)
  • It operates at a high, fixed frequency(thus not
    usable for servos)
  • Great for LEDs and motors
  • Uses built-in PWM circuits of the ATmega8 chip
    (no software needed)
  • Why do we need software PWM sometimes?
  • PWM speed used for analogWrite() is set to 30
    kHz.
  • When programming PWM, speed can be set to just
    about any value.

Src Tod E Kurt
5
Color PWM
Three PWM outputs and three primary colors -
sounds interesting doesnt it? With RGB, you can
make any color. Use either the 220 or 330 ohm
resistors
Src Tod E Kurt
6
Dimming LEDs
To make a cool color dimmer - http//www.arduino.c
c/en/Tutorial/DimmingLEDs (thats the code youll
need) Youll basically be fading nicely through
a lot of colors.
Src Tod E Kurt
7
Mood Diffuser
To make something a bit more interesting. Face
your project with some semi-transparent material
- like this scratched acrylic.
Src Tod E Kurt
8
Working with more than 5v
Your board runs on 5 volt logic. This means all
the signals are between 0-5 volts. Also that
you can burn out your components if you run more
than 5 volts through them. But - lots of things
run on higher voltage.. because theyll have more
power to do work for you. So you need something
that you can control with 5 volt logic that can
send information (or current) at a higher
voltage. Its called an h-bridge. There are many
of them.
9
An H-Bridge example
  • There are many h-bridges youll need to find one
    that works for your project
  • How much power do I need?
  • How many do I need in one chip?
  • Etc.
  • Well work on an example for a low-voltage DC
    motor (5-36v) that you can send forward and in
    reverse.
  • This example uses an H-bridge IC, the Texas
    Instruments SN754410 (or the L293). This chip has
    4 half-H bridges, and can therefore control 2
    motors. It can drive up to 1 amp of current, and
    between 4.5 and 36V. If your motor needs more
    than that, use a different H-bridge.

Ref http//tigoe.net/pcomp/labs/lab-motors.shtml
10
About H-bridges
  • All H-bridges have certain elements
  • Pins for logic input
  • Pins for Supply voltage
  • Pins for Logic voltage
  • Pins for Supply output
  • Pins for ground
  • The logic voltage pins want the same voltage and
    current as your microcontroller.
  • The supply voltage wants whatever voltage and
    current you run your motors with.
  • The logic inputs connect to the pins on your
    microcontroller that you use to output control
    signals to the H-bridge.
  • The supply output pins go to your motor.
  • The configuration of these pins might vary
    slightly depending on the manufacturer of the
    H-bridge. They might also use slightly different
    names, but the concepts are the same.

Ref http//tigoe.net/pcomp/labs/lab-motors.shtml
11
Getting one working
Step 1 Test your motor!! You need to know it
works before you start so that if there is a
problem you know its not with the motor. Get a
DC motor that runs on low voltage DC, in the
5-15V range. Connect leads to its terminals,
and run it from a DC power supply. Try changing
the voltage on it, and seeing what effect it has.
Don't go over the motor's rated voltage.
Connect a switch in series with the motor and
use it to turn on the motor.
Ref http//tigoe.net/pcomp/labs/lab-motors.shtml
12
Start on the H-bridge
Step 2 Set up the chip Connect things
carefully. Youll need SN754410 (or L293)
H-bridge DC motor power supply for DC
motor 5-15vdc power supply 10uF capacitor 1uF
capacitor 10Kohm resistors 220 ohm resistors 5
volt regulator (7805) Image shows H-Bridge
connected to a PIC. Note the motor supply wire.
In this example, it runs to the 12V input from
the DC power supply, because the motor runs on
12V. It may be different on your circuit,
depending on the voltage your motor needs. Note
also the 10Kphm pull down resistor needed on the
enable pin.
Ref http//tigoe.net/pcomp/labs/lab-motors.shtml
13
Double check.
Step 2a Double check. Really.
14
Set up the power.
Step 3 Get the power set so that it runs the
correct voltages to the correct places. Most
motors take much more current than a
microcontorller, and need their own supply. This
example uses 12V, run in parallel with a 7805 5v
regulator. Whatever motor you use, make sure the
power source is compatible (i.e. don't use a 9V
battery for a 3V motor!). Note that we've added
two capacitors on either side of our regulator.
They smooth out the power, as the motor will
cause spikes and dips when it turns on and
off. Here's the schematic for the capacitors and
the regulator. Note that the motor and the
microcontroller need a common ground (in our
case, they get it through the transistor's base
see above schematic).
Ref http//tigoe.net/pcomp/labs/lab-motors.shtml
15
Set up your program.
Step 4 Program your arduino board. (I have not
tested) Wiring Code (for Arduino board) / DC
motor control by Ryan Holsopple modification of
Tom Igoe's DC motor code I added function to
start motor turning in one direction I raised
the threshold for my pot to work Created 8 Feb.
2006 / int sensorValue 0 // the variable
to hold the analog sensor value int sensorPin
0 // the analog pin with the sensor on
it int motorPin 9 // the digital pin
with the motor on it int threshold 300 //
theshold of analog sensor below which the motor
should turn on int forwardPin 7 int
backwardPin 8 // prototype of the function
that changes the motor's speed void
changeMotorSpeed() //function to begin motor
turning in one direction void forwardDirection()
void setup() // declare the inputs and
outputs pinMode(motorPin, OUTPUT)
pinMode(forwardPin, OUTPUT) pinMode(backwardPin,
OUTPUT) pinMode(sensorPin, INPUT)
void loop() // read the analog sensor
sensorValue analogRead(sensorPin) //
determine whether its above or below the
threshold if (sensorValue gt threshold) //
it's above the threshold // turn off the
motor digitalWrite(motorPin, LOW)
else //start motor turning forward
forwardDirection() // change the speed of
the motor based on the sensor value
changeMotorSpeed() ///////////////////////
///////////////// void forwardDirection()
digitalWrite (forwardPin, HIGH) digitalWrite
(backwardPin, LOW) void changeMotorSpeed()
analogWrite(motorPin, sensorValue)
http//itp.nyu.edu/physcomp/Tutorials/DC1L293HBrid
ge
16
Running Arduino via battery.
Great for portability. Bad for Reliability. With
just two parts your Arduino goes portable,
powered by a 9V battery. Step 1 You'll need a
9V battery clip, a 2.5mm power plug, a soldering
iron and some solder, and optionally a small
piece of heat shrink tubing. Step 2 Solder the
battery clip's black (-) wire to the outside
connection of the plug. Then, solder the
battery clip's red () wire to the centre
connection of the plug. Optionally, add a piece
of heat shrink tubing on the red wire to protect
the positive connection.
http//www.arduino.cc/playground/Learning/9VBatter
yAdapter
17
Running Arduino via battery.
Great for portability. Bad for Reliability. Step
3 Once the wires are soldered, slip the
heatshrink over the positive connection and
gently crimp the wires in place with the small
metal tabs. Add some hot glue (not shown) over
the connection area for further reliability.
http//www.arduino.cc/playground/Learning/9VBatter
yAdapter
18
  • Break, 10 minutes.

19
Homework
  • Prepare your draft presentation site.
  • Presentation site must include documentation of
    your draft projects.
  • GROUP PROJECTS Be sure to write what YOU did in
    the group project.
  • Revise and combine your interaction drafts
    completed for this week.
  • These must be functional in the next class.
  • DO NOT WAIT UNTIL THE NIGHT BEFORE to work on
    this.
  • Be ready to present your final draft of your
    final project to the class at next session.
  • All or most functionality working
  • Strong concept
  • Finished code, ready to implement feedback and
    suggestions
  • Clear questions to ask for help
  • Ready to start on the physical enclosure
  • You should do most of your work on the final THIS
    week.
  • So next week you only have to complete the
    physical enclosure, debug your work, and put
    together the final presentation.
Write a Comment
User Comments (0)
About PowerShow.com