MICROMOUSE LECTURE #2 SENSORS, MINI PROJECT #2 11/6/2014
WHAT IS A SENSOR? Converts outside parameters to voltage signals Converts outside parameters to voltage signals
SENSORS IN A MICROMOUSE EncodersGryoscopeInfrared
GRYOSCOPE Outputs angular velocity Outputs angular velocity Mouse turns Gryo outputs angular velocity Code integrates angular velocity Determine what mouse should do
HOW TO CHOOSE A GRYO Range Range Need at least +/ degrees/second Need at least +/ degrees/second Can be analog or digital Can be analog or digital Only need to measure 1 axis Only need to measure 1 axis
INFRARED SENSORS Infrared LEDs emit light in wavelengths from 870nm to 950nm Infrared LEDs emit light in wavelengths from 870nm to 950nm Receivers (phototransistors) sensitive to IR light Receivers (phototransistors) sensitive to IR light Emitter emits light Light bounces off wall Receiver measures reflected light Determine wall presence
HOW TO CHOOSE AN IR RECEIVER/EMITTER
LED EMITTER Make sure to choose a narrow emission angle Make sure to choose a narrow emission angle Maximize power efficiency Maximize power efficiency Maximize signal amplitude Maximize signal amplitude Power Density Power Density Measures solid angle Measures solid angle Often measured in mW/sr (miliwatt/steradians) Often measured in mW/sr (miliwatt/steradians)
LED RECEIVER Make sure to match the receiver with emitter wavelength Make sure to match the receiver with emitter wavelength Make sure to choose small angles=high directivity Make sure to choose small angles=high directivity Reduces interference Reduces interference Emitter/receiver pairs generally sold together Emitter/receiver pairs generally sold together Note that max sensitivity at 940nm Note high directivity
CALIBRATION Mostly trial and error Mostly trial and error Vary distances and measure voltage with MCU Vary distances and measure voltage with MCU IR calibration is non-linear IR calibration is non-linear
THE SENSORS YOU WILL BE USING IR Emitter: an IR Light Emitting Diode IR Emitter: an IR Light Emitting Diode IR Receiver: An NPN phototransistor IR Receiver: An NPN phototransistor Amplifies current going into the Base and sends it out the Emitter Amplifies current going into the Base and sends it out the Emitter An overly-simplified analogy: think of it as a dimmer switch An overly-simplified analogy: think of it as a dimmer switch
IR SENSOR SCHEMATIC
Emitter: you can drive the LED directly from the MCU Emitter: you can drive the LED directly from the MCU Make sure you use a series resistor so you don’t burn out the LED! Make sure you use a series resistor so you don’t burn out the LED! Orientation matters! Anode goes to power, cathode goes towards ground Orientation matters! Anode goes to power, cathode goes towards ground Receiver: need to use a pull down resistor at the Emitter Receiver: need to use a pull down resistor at the Emitter BJTs work with current, but MCU reads voltage. BJTs work with current, but MCU reads voltage. Resister allows current to pass and have a readable voltage Resister allows current to pass and have a readable voltage
AMBIENT LIGHT Ambient light will definitely confuse your mouse Ambient light will definitely confuse your mouse Might seem like there is a wall when there isn’t Might seem like there is a wall when there isn’t How to deal with softer ambient light: How to deal with softer ambient light: Turn IR emitter off and read from receiver Turn IR emitter off and read from receiver Turn IR emitter on and read from receiver Turn IR emitter on and read from receiver Subtract the first reading from the second Subtract the first reading from the second Won’t work if light is too bright and saturates receiver Won’t work if light is too bright and saturates receiver
IR SENSORS SAMPLE PROGRAM
JEREMY HAUGEN GUEST LECTURE ON SENSORS