Lecture 11 - Sensors Flashcards

1
Q

What are the general understandings of sensors?

A
  • There are millions of different sensor types
  • You have to select the right one for your application and budget and read the specs
  • Some sensors require also input from CPU E.g. activation/deactiv., triggering data transfer, …
  • Our scope here is more on interfacing sensors than on understanding the sensors themselves
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are some typical sensor outputs?

A

Typical Sensor Outputs
* Binary signal (0 or 1) -> Tactile sensor
* Analog signal (e.g. 0..5V) -> Inclinometer
* Timing signal (e.g. PWM) -> Gyroscope
* Serial link (RS232 or USB) -> GPS Module
* Parallel link -> Digital Camera

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are binary sensors?

A

Tactile sensor / switch
* Easy to be interfaced
* Use a resistor and link to digital input of CPU or latch
Refer to slides

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is the contact bounce effect?

A

Problem:
* When activating switch, contact moves up and down several times (“contact bounce” or “switch bounce”)
* Bad when counting pulses or in user menus → incorrect results !
Refer to slides

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the solution to the contact bounce effect?

A

Solutions:
* Hardware:
Analog: resistor-capacitor circuit
Digital: flip-flop with single-pole/double-throw switch
* Software:
Wait certain delay time before allowing next change (Refer to slides for code)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is an encoder - specifically a shaft encoder?

A

Shaft encoder
* incremental or absolute position (refer to slides)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is an encoder - specifically an incremental encoder?

A
  • Usually requires 2 sensors to determine speed and direction
  • See motor control
    The technology necessary
  • Magnet + hall sensors (incremental)
  • Optical sensors with black/white segments
    (incremental)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the general understanding of an encoder?

A
  • Encoder signal (2 lines) are connected to microcontroller like 2 binary sensors (2 digital input lines)
  • Microcontrollers usually have special internal registers for pulse counting
     This is done in parallel to normal calculations
     Does not slow down the CPU
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

General data input - A data transfer can be?

A

A data transfer can be
1. CPU-initiated (“polling”)
2. Device-initiated (“interrupt”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is polling?

A

Read device input without interrupt
Refer to slides (NEED TO KNOW CODE)

  • CPU-initiation → Polling
    – CPU initiates read/write with IN/OUT instruction
    – Timing relies only on CPU
    – May have to do this in loop in case device is not ready
    → “busy-wait loop” → loss of CPU time → inefficient
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is a quadrature encoder?

A

A quadrature encoder is like a car’s odometer, but can run forwards or backwards

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What are encoder counting methods?

A
  • Counting in the “foreground” program wastes compute time that may be required for other tasks
  • Counting in “foreground” may take too long, so it misses counts for faster signals (e.g. wheel spinning faster).
    → Solution: Interrupts
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What are interupts?

A

Read device data with interrupt
Refer to slides

  • Device-initiated → Interrupts
    – Device signals CPU that it is ready via special interrupt line
    – CPU interrupts whatever it was doing and calls special “interrupt service routine” (ISR)
    – CPU returns to previous task after finishing ISR (like subroutine)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Define interupts

A
  • Execution of one program (user) is temporarily suspended for another program with higher priority (somewhat like a unscheduled subroutine call)
  • Sometimes also called exception
  • Interrupts can be raised either by software (special CPU command) or by hardware (external signals linked to CPU interrupt lines)
  • Many embedded systems have interrupts that occur at regular time intervals (e.g. every 0.01s)
     timer interrupts

Refer to slides

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What are digital sensors?

A

Digital sensors are
* usually more complex than analog sensors
* often more accurate than analog sensors
* sometimes analog sensors with built-in A/D converters

Refer to slides

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How can you interface digital sensors?

A

How to interface this sensor to a controller?
* Hardware
* Software

Refer to slides (NEED TO KNOW CODE)

17
Q

What are Analog Sensors and A/D Converter?

A

A number of sensors have analog output signal rather than digital signals
 A/D converter is required to connect to CPU
Examples:
* Microphone
* Analog infrared distance sensor
* Analog compass
* Barometer sensor

18
Q

What do A/D Converters do?

A
  • Transform analog signal into a sequence of numbers
  • Sampling rate and conversion number range will determine digitizing quality (how accurately the signal will be digitized)
  • There will be some information loss
  • Signal has to be provided at correct level, e.g. between 0 .. 5V
19
Q

What are the three versions of A/D Converters?

A

Version 1: Parallel (e.g. 8 bit, direct connection to data bus)
Version 2: Serially digital, Provide clock signal to converter to read bit by bit
Version 3: Serially digital with multiple inputs, Requires an analog multiplexer
Refer to slides

20
Q

What are PWM sensors?

A

We have already seen PWM for:
* Velocity control for DC motors
* Position specification for servos
Now we see PWM for:
* Sensor data
* Examples:
– Accelerometer
– Gyroscope
– Inclinometer

21
Q

What is elaspsed time?

A

Elapsed time (e.g. in ms) will then be the digital sensor value

22
Q

What is sensor calibration?

A

Sensor output may be linear or nonlinear to measured dimension:
* Before a (digitized) sensor value can be used in an embedded system, its data has to be calibrated
* Linear relationship: a few initial measurements are sufficient
* Non-linear measurements: complete measurement table is required
* During runtime us: formula for simple relationships lookup table for arbitrary relationships use interpolation for values between entries (simple and efficient)