Chapter 17: Sensors - PowerPoint PPT Presentation

1 / 42
About This Presentation
Title:

Chapter 17: Sensors

Description:

Chapter 17: Sensors CEG2400 - Microcomputer Systems Contents Sensors for our robot: Touch sensors Range IR proximity sensors: Light sensors IR Path following sensors ... – PowerPoint PPT presentation

Number of Views:117
Avg rating:3.0/5.0
Slides: 43
Provided by: cseCuhkE6
Category:
Tags: chapter | sensors

less

Transcript and Presenter's Notes

Title: Chapter 17: Sensors


1
Chapter 17 Sensors
  • CEG2400 - Microcomputer Systems

2
Contents
  • Sensors for our robot
  • Touch sensors
  • Range IR proximity sensors Light sensors
  • IR Path following sensors
  • Sound sensors
  • Ultra-sonic sensors
  • Temperature Sensor
  • Electromagnetic sensors electronic compass
  • Accelerometers
  • Analog-to-digital Conversion

3
1) Sensors for robot
4
Robot with sensors
5
2) touch sensorsKey switch interfacing

6
Key switch array
GPIO output port

GPIO input port
7
exercise
  • Exercise 1 Exercise
  • I. Determine which key has been depressed by
    using x and y?
  • II. How to handle multiple key presses.

8
Key scan algorithm
  • Key_scan_simple( )
  • unsigned char i,x,y
  • //handle denounce problem here, such as,
  • // check if the previous key press has been
    released or not
  • //scanning for a key press
  • for(i0ilt4i) //4 times
  • y1110(B) //Y(3),Y(2),Y(1),Y(0)1110
  • output y to GPIO output port
  • X read in GPIO input port
  • If (X not equal to 1111(B))
  • //a key has been depressed
  • break
  • rotate y 1 bit to left, i.e. 1110 will
    become 1101 etc.
  • Find which key has been depressed by current X
    and Y values.

GPIO 4-bit Output port
GPIO 4-bit Input port
9
Tentacles

10
3) IR proximity range sensor
  • Exercise 2 What is Schmitt trigger logic? Why do
    we need a Schmitt trigger inverter here?

11
Schmitt triggered inverter (7414)http//www.datas
heetcatalog.net/de/datasheets_pdf/7/4/1/4/7414.sht
ml

12
Frequency modulated range sensor(less sensitive
to surrounding light)

13
Infrared (IR) reflective proximity range sensorA
reliable practical solution from Mondotronics..

From http//datasheet.octopart.com/3-337-Mondotro
nics-datasheet-7285303.pdf
14
Using analog-to-digital (ADC)converter
  • Using analog-to-digital converter to measure the
    distance between the lightsensor and the
    obstacle.
  • ADCAnalog to digital converter
  • DACDigital to Analog converter

15
N channels range measurement using IR,
multiplexer and ADC.

16
Algorithm for channel selection (one of N
channels) and conversion
  • Main()
  • Init. System (GPIO , ADC).
  • Select channel
  • Read sensor reading by ADC.

17
4) IR path following setup

18
5) Sound sensors
  • Types of microphones
  • Moving coil microphone
  • Condenser microphone---
  • Use ADC to convert to digital code
  • Input to Speech Recognition system
  • Clipping for simple sound detection

19
Moving coil microphone (battery not required)

20
Condenser microphone (more sensitive, battery
required)

21
Microphone with amplifier

22
A digital sound recorder using ADC and DAC
  • Microphone uses a uA741 op-amp to amplifier the
    signal
  • ADC circuit An ADC (ADC0820 or ARM ADC) circuit
    is used to convert speech signal input into
    digital form.
  • Output Digital-to-Analog converter DAC that
    converts digital code into analog voltage
  • Output is fed to an audio power amplifier (LM386)
    to drive a speaker.

23
Output power amplifier

5V power supply
Analog output from DAC
1uF
C250uF
To speaker
C150.05uF R10KOhms

24
Algorithm to drive the digital recorder
  • xdata unsigned char ram_storeN, i
  • record //sampling record and playback at one go
  • for(i0 I lt N i)
  • ram_storei read_in_sound_code_from_GPIO
  • output_to_dac ram_storei
  • delay() //this determines the sampling rate
  • playback() // playback what has been rcordered
  • for(i0 I lt N i)
  • output_to_dac ram_storei
  • delay() //this determines the sampling rate

25
Exercises
  • Write the program for the interrupt method.
  • (II) Write the algorithm to detect the sound of a
    handclap or a whistle sound.
  • (III) What are the elements we need to implement
    a speech recognition system?

26
Sound DC level shifterfor sound level detector

27
6) Ultrasonic radar system- non invasion range
detection system - Batmans radar system

Ultrasonic Transmitter receiver
picture from http//szsaibao.taobao.com/?spm2013
.1.2-543493819.1.TCe5j8
28
The transmitter circuit

29
The receiver circuit

30
Method 1 Ultrasonic-radar control using MCU and
timer

Algortithm_radar1() //by polling Send out
pulses switch on timer Wait until echo is
received. Stop timer //wait-loop Read
timer, Convert time into length
Timer clock is 13824 KHz
31
Method 2 Ultrasonic- radar control using
interrupt and MCUs internal timer

Timer clock is 13824 KHz
Video http//www.youtube.com/watch?vqHuVhR6-Q1E
32
Algorithm_radar2 Ultrasonic- radar control
using MCU interrupt and its internal timer
  • Algorithm_radar2 ( ) // by interrupt and timer
    method, tested with good result
  • initialize internal_timer interrupt
  • instruct the GPIO to send out pulses
  • start timer //32-bit internal timer counting
    at 13.824MHz
  • //loop
  • wait a while // wait a while, the echo is
    expected to arrive
  • read internal_timer value // result, convert
    into distance
  • //ISR ////////////////////////////////////////////
    ///////////////////////////////////////////
  • isr2_type2_for_timer1_for_radar2 //executes when
    echo arrives
  • Stop internal_timer

33
Exercises
  • I. Compare the two methods Algorithm_radar1(
    )polling and Algorithm_radar2( ) using
    internal timer interrupt shown above.
  • II. For Algorithm_radar2( ), if the object is 3
    meters away and the speed of sound is
  • 330m/s, what is the time-of-flight of the sound
    wave from the transmitter to the receiver?
  • III. What is the result at the count?
  • IV. What is the accuracy (-meters) of this
    design? What factors determine the accuracy of
    this system?

34
7) Temperature sensors

35
8) Electromagnetic sensorElectronic compass,
accuracy /- 1 degree

2 perpendicular coils
36
HMC1501 and HMC1512 Linear, Angular, and Rotary
Displacement Sensor

http//www.ssec.honeywell.com/magnetic/datasheets/
hmc1501-1512.pdf
37
9) Accelerometers
  • An accelerometer measures acceleration,
    vibration, and shock.
  • Example car airbag triggering sensor, 3D mouse
    -- tilt sensor.
  • From National Instruments Corporation
    http//www.ni.com/products/

38
Example of using accelerometer Fromhttp//www.cs
l.sony.co.jp/person/rekimoto/tilt/
Youtube Link
39
Accelerometers in WII
  • http//myskitch.com/keith/wii-20070724-011824.jpg/
    preview.jpg
  • IMU camera control / stabilisation

Video link https//www.youtube.com/watch?v7GVXqNL
LH7Q
http//youtu.be/CQ_P5XWkYcI
40
Gyroscopes can be applied to building self
balancing robots
  • 2-side wheels self balancing robot
  • Motor cycle
  • Our robot has one of the hottest self balancing
    robots in YouTube.
  • 52759 clicks on 18 Dec 2012
  • http//www.youtube.com/watch?v0312BNqIBFI

41
Summary
  • A number of different sensors have been studies
  • And examples of how they are used are also
    demonstrated

42
Apenxi Answer for Exercise for ultrasonic
radar
  • I. Compare the two methods Algorithm_radar1(
    )polling and Algorithm_radar2( ) using
    internal timer interrupt shown above.
  • II. For Algorithm_radar2( ), if the object is 3
    meters away and the speed of sound is 330m/s,
    what is the time-of-flight of the sound wave from
    the transmitter to the receiver?
  • Answer sound traveled 3x26m.
  • Time_delay (dt)6m/(330m/s)18.18ms
  • If interrupt is 13.824MHz, each timer clock is
    1/13.824M72.33ns
  • III. What is the result at the count?
  • so counting result for dt18.18ms/(1/13.824M)18.1
    8ms/72.33ns251347.
  • IV. What is the accuracy (-meters) of this
    design? What factors determine the accuracy of
    this system?
  • Each clock pulse is (1/13.824M)s72.33ns, that
    represents dL330m/s(72.33ns)
    (330/13.824M)m0.239mm
  • The real accuracy is half of it because it is an
    echo , so 0.239mm/20.119mm
Write a Comment
User Comments (0)
About PowerShow.com