Sensors - PowerPoint PPT Presentation

About This Presentation
Title:

Sensors

Description:

Sensors Material taken from Robotics with the Boe-Bot Where Are We Going? Devices that Contain Sensors The boebot uses sensors to interact with its environment. – PowerPoint PPT presentation

Number of Views:138
Avg rating:3.0/5.0
Slides: 33
Provided by: Computer111
Learn more at: https://www.cs.unca.edu
Category:
Tags: sensors

less

Transcript and Presenter's Notes

Title: Sensors


1
Sensors
  • Material taken from Robotics with the Boe-Bot

2
Where Are We Going?
Sumo-Bot competitions
3
Devices that Contain Sensors
  • The boebot uses sensors to interact with its
    environment.
  • There are a variety of sensors used for a variety
    of purposes Pressure, rotation, temperature,
    smoke, tilt, vibration, light, proximity and so
    on.

4
Ultrasonic Proximity Sensor
  • Devantech Sonic Range Finder
  • The ultrasonic distance sensor provides precise
    distance measurements from about 3 cm to 3
    meters.
  • It works by transmitting an ultrasonic burst and
    providing an output pulse that corresponds to the
    time required for the burst echo to return to the
    sensor.
  • By measuring the echo pulse width the distance to
    target can easily be calculated.

5
Not So Simple to Connect
6
Theory of Operation
  • The sensor emits a short ultrasonic burst and
    then "listens" for the echo.
  • Under control of a host microcontroller (trigger
    input), the sensor emits a short 40 kHz
    (ultrasonic) burst.
  • This burst travels through the air at about 1.125
    feet per millisecond, hits an object and then
    bounces back to the sensor.
  • The sensor provides an output pulse to the host
    that will terminate when the echo is detected,
    hence the width of this pulse corresponds to the
    distance to the target.

7
Limited Detection Range
8
Basic Program Initialization
  • ' ----- I/O Definitions ------------------------
    --------------------
  • Trigger PIN 0
  • Echo PIN 1
  • ' ----- Constants ------------------------------
    --------------------
  • Trig10 CON 5 ' trigger pulse 10 uS
  • ToCm CON 30 ' conversion factor to cm
  • ' ----- Variables ------------------------------
    --------------------
  • samples VAR Nib ' loop counter
  • pWidth VAR Word ' pulse width from sensor
  • rawDist VAR Word ' filtered measurment
  • cm VAR Word ' centimeters
  • inches VAR Word
  • ' ----- Initialization -------------------------
    --------------------
  • Setup
  • LOW Trigger
  • DEBUG CLS,

9
Main Routine
  • ' ----- Program Code ---------------------------
    --------------------
  • Main
  • DO
  • GOSUB Get_Sonar ' take sonar
    reading
  • DEBUG CRSRXY, 15, 2, DEC rawDist, CLREOL
  • cm rawDist / ToCm ' convert to
    centimeters
  • DEBUG CRSRXY, 15, 3, DEC cm, CLREOL
  • inches cm / 03EF ' x 3.937 (to 0.1
    inches)
  • DEBUG CRSRXY, 15, 4,
  • DEC inches / 10, ".", DEC1 inches,
  • CLREOL
  • PAUSE 250 ' delay
    between readings
  • LOOP
  • END

10
Get the Sonar Reading
  • ' ----- Subroutines ----------------------------
    --------------------
  • Get_Sonar
  • rawDist 0 '
    clear measurement
  • FOR samples 1 TO 5 ' take
    five samples
  • PULSOUT Trigger, Trig10 ' 10 uS
    trigger pulse
  • PULSIN Echo, 1, pWidth ' measure
    pulse
  • rawDist rawDist (pWidth / 5) ' simple
    digital filter
  • PAUSE 10 '
    minimum period between
  • NEXT
  • RETURN

11
Light Sensors
  • Light sensors are also used in a variety of
    applications
  • Automatic street lights
  • Camera flash and exposure controls
  • Security alarms

12
Introducing the Photoresistor
  • While there are a variety of light sensors, a
    very popular one is the photoresistor in that it
    is easy to use and inexpensive.
  • As the name implies, it is a resistor that reacts
    to light. The active ingredient Cadmium Sulfide
    (CdS) allows electrons to flow more easily when
    light energy hits it, thus lowering it resistance
    (opposition to current flow).
  • The brighter the light the lower the resistance.

13
Why?
  • A photoresistor is made of a high resistance
    semiconductor.
  • The photons of high frequency light are absorbed
    by the semiconductor giving bound electrons
    enough energy to jump into the conduction band.
    The resulting free electrons (and their hole
    partners) conduct electricity thereby lowering
    resistance.

14
Basic Circuit
As the photoresistors resistance changes with
light exposure, so does the voltage at Vo. As R
gets larger, Vo gets smaller, and as R gets
smaller, Vo gets larger. Vo is what the BASIC
Stamp I/O pin is detecting when it is functioning
as an input. If this circuit is connected to
IN6, when the voltage at Vo is above 1.4 V, IN6
will store a 1. If Vo falls below 1.4 V, IN6 will
store a 0.
R
V0
15
A Better Idea Measuring Using Time
  • The photoresistor can also be used with the BASIC
    Stamp in an RC circuit (Resistor-Capacitor
    circuit) to obtain a value in relation to the
    amount of resistance, or, in this case, the
    amount of light hitting the sensor.
  • In a RC-network, the capacitor is charged and
    discharged at different rates determined by the
    resistor and the capacitor sizes.

16
Introducing the Capacitor
  • The capacitor is a device which can store an
    electron charge. Its size is expressed typically
    in microfarads (?F) or millionths of Farads.
  • Certain types of capacitors are polarity
    sensitive, that is, they can only be connected in
    one direction.
  • Connecting a polarity sensitive capacitor
    backwards can cause the device to explode.
  • Wear safety glasses.
  • Ensure proper polarity when connecting.

17
(No Transcript)
18
Polled RC Time
  • In the Polled RC Time circuit the following
    occurs
  • Button is pressed charging the capacitor.
  • The button is released, the BASIC Stamp begins
    timing and the capacitor begins to discharge.


5V
19
Polled RC Time (continued)
  • The BASIC Stamp continues timing until input P7
    changes to a low (drops below 1.4V).
  • Time is displayed in tenths of seconds.

V gt 1.4VLogic 1
V lt 1.4VLogic 0
20
Polled RC Time (continued)
  • The time to discharge the capacitor is in
    proportion to the size of the resistor and
    capacitor network (RC).
  • The larger the capacitance (C), the greater the
    charge it can hold, increasing time.
  • The larger the resistance (R), the slower the
    capacitor will discharge, increasing time.

21
Reading RC-Time with BASIC Stamp
  • The BASIC Stamp has an instruction to perform
    much of the timing operation automatically
  • RCTIME Pin, State, Variable
  • Where
  • Pin is the pin the RC network is connected.
  • State is the initial state when timing begins.
  • Variable is the memory location to store the
    results. Just like PULSOUT the time is the
    number of 2uS increments.

22
Build Test
  • The RC Time circuits is configured so that the
    capacitor is charged by the output (P2 in this
    case) and the time to discharge though the
    resistor is measured.
  • In this case, as light level changes, discharge
    time will change.

23
  • What happens to the value of time as the light
    level changes? When is it lowest? Highest?

24
Using A Sample Plot
  • This image shows a plot of the light level. Note
    how the value increases from left to right then
    drops again suddenly. Why?

25
Object Detection Using IR
26
The IR Detector
  • The IR detector is only looking for infrared
    thats flashing on and off 38,500 times per
    second.
  • It has built-in optical filters that allow very
    little light except the 980 nm infrared.
  • It also has an electronic filter that only allows
    signals around 38.5 kHz to pass through.
  • This prevents IR interference from common sources
    such as sunlight and indoor lighting.

27
Schematics
28
Detecting IR
  • The key to making each IR LED/detector pair work
    is to send 1 ms of 38.5 kHz FREQOUT harmonic, and
    then, immediately store the IR detectors output
    in a variable.
  • FREQOUT 8, 1, 38500
  • irDetectLeft IN9
  • The IR detectors output state when it sees no IR
    signal is high. When the IR detector sees the
    38500 Hz harmonic reflected by an object, its
    output is low.
  • The IR detectors output only stays low for a
    fraction of a millisecond after the FREQOUT
    command is done sending the harmonic, so its
    essential to store the IR detectors output in a
    variable immediately after sending the FREQOUT
    command.

29
Simple Display Program
30
IR Detection Range
  • Less series resistance will make an LED glow more
    brightly.
  • Brighter IR LEDs can make it possible to detect
    objects that are further away.

31
OBJECT DETECTION AND AVOIDANCE
32
OBJECT DETECTION AND AVOIDANCE
Write a Comment
User Comments (0)
About PowerShow.com