10/16
Pulse Width Modulation (PWM)
PWM is a way of digitally encoding analog signal levels.
Through the use of high-resolution counters, the duty cycle of a square wave is modulated to encode a specific analog signal level. The PWM signal is still digital because, at any given instant of time, the full DC supply is either fully on or fully off.
The voltage or current source is supplied to the analog load by means of a repeating series of on and off pulses. The on-time is the time during which the DC supply is applied to the load, and the off-time is the period during which that supply is switched off. Given a sufficient bandwidth, any analog value can be encoded with PWM.
Pulse Width Modulation (PWM)
Three different PWM signals.
Figure 1a shows a PWM output at a 10% duty cycle.
That is, the signal is on for 10% of the period and off the other 90%.
Figures 1b and 1c show PWM outputs at 50% and 90% duty cycles, respectively.
These three PWM outputs encode three different analog signal values, at 10%, 50%, and 90% of the full strength.
If, for example, the supply is 9V and the duty cycle is 10%, a 0.9V analog signal results.
DC MOTOR
BRUSHES
COMMUTATOR
Hobby Servo:
Built in Encoder -- Built in Servo Controller
+V, GND, Signal
Give the signal line a PWM value. (like PWM)
ATT: Pulse Width DEFINES POSITION, NOT SPEED
Pulse Width Signal created by Built Servo Controller.
[the above is true for hobby servos. It allows for cheap
Motors. Industrial servos, use different control
Techniques….]
Stepper Motor
[Electro-Magnets]
Microcontroller->Transistor->Solenoid
Solid State Relays (SSR)
DC Solid State: opto-isolation, very fast (PWM), very low power, drive directly from
Microcontroller.
AC Solid State: same as above, may not be able to switch faster than the AC
Signal frequency. (used in light dimmers)
Mechanical Relay: cheap, makes little noise, visible
Mechanical motion.
Solid State Relay: opto-isolation, very fast (PWM), very low power, drive directly from microcontroller.
Transistor Switch: very cheap, small, fast.
RESISTIVE SENSORS:
(change resistance)
CAPACITIVE:
(change capacitance)
“Photocell”
“Bend Sensors”
“CO sensor”
“Condenser microphones”
“Touch Sensors”
PIEZO ELECTRIC PYRO ELECTRIC SONARS
PIEZO ELECTRIC:
Create voltage when bent / when voltage across they bend… .
PYRO ELECTRIC digital-out built in.
Warps when exposed to heat. => change capacitance
(“Motion Infrared Sensors”)
SONARS
Emit sound and record time it takes for sound waves to return.
(reflection, angle, complications…)
PHOTOTRANSISTOR
Light controlled switches
(base current created with photons)
INFRARED REFLECTION SENSORS
Transmitter / Receiver in one package or two.
(record reflection time, similar to sonars; can be used as collision detection sensors or data link.)
IR OPTICAL SWITCH
IR LED + PHOTOTRANSISTOR
BARCODES, RFID, ACCELEROMETERS, THERMISTORS,
HUMIDITY, SENSORS, GYROSCOPES (how fast you’re turning)… .
C Motor Control with a TIP120 Transistor This example assumes you're using a DC motor that runs on low voltage DC, in the 5-15V range. Connect leads to Its terminals, and run if from a benchtop power supply if you have one. 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.
Connect the base of a TIP120 transistor to one pin of your microcontroller.
Note the second power supply. Most motors take a great deal more current than a microprocessor
, and need their own supply. The example below uses a 9V battery as a separate power source.
Whatever motor you use, make sure the power source is compatible (i.e. don't use a 9V battery f or a 3V motor!). Although the example shown is on a BX-24, you can use it with any microcontroller.
Just connect the 1K resistor to the output pin of your microcontroller.
This circuit drives small DC motors up to about 100 watts or
5 amps or 40 volts, whichever comes first. Using bigger parts could make it more powerful. Using a real H-bridge IC makes sense for this size of motor, but hobbyists love to do it themselves, and I thought it was about time to show a tested
H-bridge motor driver that didn't use exotic parts.
http://www.allegromicro.com/
PWM MOTOR DRIVER
WORM GEAR
Linkages
Belt Drive
Mechanical Movements
http://www.beatrizdacosta.net/projects.html
• Light to vary motor speed.
• Heat to set off siren.
Mapping data… AND redefine your baseline each time...
Define Threshold… AND redefine your baseline each time..
ANALOG VOLTAGES on ARDUINO
• analogRead: -- reads an analog voltage at any of the ADC pins (you have 6).
• analogWrite: -- writes a PWM pulse to the PWM enabled digital pins (you have
3).
• Sensor “Calibration”
• Global Issues, question 1&2. 2 pages max.
• Due: October 30th, beginning of
Lecture.
• No lecture next week.