ENGR10006 Chap.7 Signals, Sensors and Analog-to-Digital Conversion
Signals, Sensors and Analog-to-Digital Conversion
The robot reads the world through two QTI infrared line sensors and a PING ultrasonic distance sensor, and every reading passes through analog-to-digital conversion before Stateflow can use it. This chapter explains analog versus digital signals and why binary dominates, converts between binary and decimal, and models a sensor as an affine map f(x) = ax + b with sensitivity and bias that calibration must find.
It covers sampling and quantisation, bits per sample as the ceiling of log base 2 of the number of levels, and bit rate as sample rate times bits per sample, with the robot's 10-bit IR values from 0 to 1023. It closes with the ultrasonic sensor's 40 kHz chirp, its echo-time output and the situations in which it cannot be trusted.
Worked examples calibrate an IR threshold and size the storage for a logged run, with practice in base conversion and sensor limits.
What this chapter covers
- 01
Analog and digital signals
- 02
Binary and decimal conversion
- 03
Affine sensor maps and inversion
- 04
IR line sensors and calibration
- 05
Sampling and quantisation
- 06
Bit rate and storage
- 07
Ultrasonic distance sensing
- 08
Noise sources in sensor readings
Worked example · free
Inverting an affine sensor map to recover distance
- +1Invert the map: x = (f(x) - b) / a. For 1.45 V, x = (1.45 - 0.20) / 0.05 = 25 cm.
- +1For 0.95 V, x = (0.95 - 0.20) / 0.05 = 15 cm.
- +1Forward map at 40 cm: f = 0.05 × 40 + 0.20 = 2.20 V. Check by inverting: (2.20 - 0.20) / 0.05 = 40 cm.
Key terms
- Analog signal
- A signal carried by a continuous variable that can take infinitely many values.
- Digital signal
- A signal limited to a small set of distinct values, most often two.
- Sensitivity
- The slope a of an affine sensor map, the change in output per unit of the measured quantity.
- Bias
- The offset b of an affine sensor map, the output when the measured quantity is zero.
- Sampling
- Taking values of a signal at regular times, faster than the signal varies.
- Bit rate
- The number of bits produced per second, equal to sample rate times bits per sample.
- Ultrasonic
- Sound above 20 kHz, beyond the range of human hearing.
- QTI sensor
- The infrared reflectance sensor the robot uses to locate the tape line.
Signals, Sensors and Analog-to-Digital Conversion FAQ
Why does the tape give a smaller IR reading than the board?
The Workshop 5 hint states that the sensor value is inversely proportional to the reflected light reading. The light tape reflects more infrared than the dark surface, so the sensor over the tape returns the lower number, and thresholds must be set with that direction in mind.
How do I find the number of bits per sample?
Find the smallest whole number of bits that can label every quantisation level: the ceiling of log base 2 of the number of levels. 256 levels need 8 bits and 1024 levels need 10 bits, which is why the robot's IR readings run from 0 to 1023.
When is the ultrasonic sensor unreliable?
The slides list objects more than 3 m away, reflective surfaces at a shallow angle that send sound elsewhere, objects too small to reflect enough sound, and floor echoes when the sensor is mounted low. Design object detection with those cases in mind.
Does bright room light affect line following?
Bright light adds a roughly fixed amount to both IR readings. The steering error uses their difference, so it is largely unaffected, but detecting T-intersections can be. Workshop 9 suggests initialisation states that sample light and dark surfaces, with defaults if sampling fails.
Assessment move
Make the conversions automatic first. Practise binary to decimal by adding powers of 2 and decimal to binary by repeated division, checking each answer by converting back. Then rehearse the A/D chain with your own numbers: levels to bits, bits and sample rate to bit rate, bit rate and duration to storage in bytes.
For sensors, write the affine model, then invert it to recover distance, and remember that some sensors need a curve rather than a line. Calibrate your robot's IR sensors on the real track, recording at least three positions for each sensor, and derive thresholds from the measured values rather than copying another team's.
For the ultrasonic sensor, test the distance threshold with real objects at the angles they will appear on the track. Record these tests with dates and lighting conditions, because the report asks for evidence of robust testing. Before the robot quiz, rework each conversion type once with new numbers and check every answer in the opposite direction.
Note the lighting in the room beside every calibration so you can explain any drift later.