sensor technology dr. konstantinos tatas. outline introduction sensor requirements sensor technology...
TRANSCRIPT
Outline• Introduction• Sensor requirements• Sensor Technology• Selecting a sensor• Interfacing with sensors• Integrated sensors• Nanosensors• Case studies
Introduction
• A sensor is a device that converts a physical quantity into a signal (typically voltage) that can be measured
• Typical sensors:– Temperature– Humidity– Pressure– Acceleration– Light intensity
Sensor requirements
• Sensitivity: The smallest change in quantity it can detect
• Linearity: The range of detection should be mapped to the output value range ideally in a linear or logarithmic function
• Must not disturb the measured quantity• Must not be sensitive to other properties of the
environment• Power consumption: Sensors vary significantly
in power consumption depending on their materials
Interfacing with a sensor
• Sensors may be:– Standalone: analog output, require an ADC to
read them– Digital output: The ADC is integrated, the
digital value can be read– Integrated in an MPSoC: The sensor, the
ADC and the processor and memory elements are in a single chip
Signals (Analog - Digital)
2
4
6
8
10
12
14
16
u(V)
1 2 73 4 5 6 8 9 t (S)
D3
D2
D1
D0
0
0
0
1
0
0
1
1
0
0
1
1 0
0
1
1 0
1
1
1
0
0
1
1 1
1
1
1
0
0
1
1
0
1
0
0
Analog Signal • can take infinity values • can change at any time
0100
1001
0110
0101
1010
1110
1111
1100
1000
Digital Signal • can take one of
2 values (0 or 1)• can change only
at distinct times
ADC
2
4
6
8
10
12
14
16
u(V)
1 2 73 4 5 6 8 9 t (S)
DAC
Reconstruction of an analog signal from a digital one
(Can take only predefined values)
1001
0110 0101
1010
11111110
1000
1100
0100
QUANTIZATION ERROR• The difference between the true and quantized value of the analog signal
• Inevitable occurrence due to the finite resolution of the ADC
• The magnitude of the quantization error at each sampling instant is between zero and half of one LSB.
• Quantization error is modeled as noise (quantization noise)
2
4
6
8
10
12
14
16
u(V)
1 2 73 4 5 6 8 9 t (S)
2
4
6
8
10
12
14
16
u(V)
1 2 73 4 5 6 8 9 t (S)
Analog signal value at sampling time: 4.9 V
Quantized Analog signal value: 5.0 V
Quantization error: 5.0 - 4.9 = 0.1 V
SAMPLING FREQUENCY (RATE)
• The frequency at which digital values are sampled from the analog input of an ADC
• A low sampling rate (undersampling) may be insufficient to represent the analog signal in digital form
• A high sampling rate (oversampling) requires high bitrate and therefore storage space and processing time
• A signal can be reproduced from digital samples if the sampling rate is higher than twice the highest frequency component of the signal (Nyquist-Shannon theorem)
• Examples of sampling rates – Telephone: 4 KHz (only adequate for speech, ess sounds like eff)– Audio CD: 44.1 KHz– Recording studio: 88.2 KHz
Digital to Analog Converters • The analog signal at the output of a D/A
converter is linearly proportional to the binary code at the input of the converter.
– If the binary code at the input is 0001 and the output voltage is 5mV, then
– If the binary code at the input becomes 1001, the output voltage will become ......
• If a D/A converter has N digital inputs then the analog signal at the output can have one out of ……. values.
• If a D/A converter has 4 digital inputs then the analog signal at the output can have one out of …… values.
45mV
16
2Ν
D3 D2 D1 D0Vout(mV)
0 0 0 0 0
0 0 0 1 5
0 0 1 0 10
0 0 1 1 15
0 1 0 0 20
0 1 0 1 25
0 1 1 0 30
0 1 1 1 35
1 0 0 0 40
1 0 0 1 45
1 0 1 0 50
1 0 1 1 55
1 1 0 0 60
1 1 0 1 65
1 1 1 0 70
1 1 1 1 75
Characteristics of Data Converters
1. Number of digital lines
– The number bits at the input of a D/A (or output of an A/D) converter.
– Typical values: 8-bit, 10-bit, 12-bit and 16-bit
– Can be parallel or serial
2. Microprocessor Compatibility
– Microprocessor compatible converters can be connected directly on the microprocessor bus as standard I/O devices
– They must have signals like CS, RD, and WR
• Activating the WR signal on an A/D converter starts the conversion process.
3. Polarity
– Polar: the analog signals can have only positive values
– Bipolar: the analog signals can have either a positive or a negative value
4. Full-scale output
– The maximum analog signal (voltage or current)
– Corresponds to a binary code with all bits set to 1 (for polar converters)
– Set externally by adjusting a variable resistor that sets the Reference Voltage (or current)
Characteristics of Data Converters (Cont…)5. Resolution
– The analog voltage (or current) that corresponds to a change of 1LSB in the binary code– It is affected by the number of bits of the converter and the Full Scale voltage (VFS)– For example if the full-scale voltage of an 8-bit D/A converter is 2.55V the the resolution
is:
VFS/(2N-1) = 2.55 /(28-1) 2.55/255 = 0.01 V/LSB = 10mV/LSB
6. Conversion Time– The time from the moment that a “Start of Conversion” signal is applied to an A/D
converter until the corresponding digital value appears on the data lines of the converter.
– For some types of A/D converters this time is predefined, while for others this time can vary according to the value of the analog signal.
0.1Vo
Vo
7. Settling Time – The time needed by the analog signal at
the output of a D/A converter to be within 10% of the nominal value.
ADC RESPONSE TYPES
• Linear– Most common
• Non-linear– Used in telecommunications, since human
voice carries more energy in the low frequencies than the high.
ADC TYPES• Direct Conversion
– Fast
– Low resolution
• Successive approximation
– Low-cost
– Slow
– Not constant conversion delay
• Sigma-delta
– High resolution,
– low-cost,
– high accuracy
Sensor sensitivity vs ADC resolution
• Sensor sensitivity (accuracy) and ADC resolution are not the same thing!
• The TCN75A is rated for an accuracy of +/-1ºC and has selectable resolution from 0.5ºC down to 0.0625ºC
• What is the maximum error when reading a value of 24.63ºC with a resolution of 0.5ºC?
• What is the error upper bound for any temperature?
Case study 1: Generic sensor with analog output
const int potPin = 0; // select the input pin for the potentiometervoid loop() {int val; // The value coming from the sensorint percent; // The mapped valueval = analogRead(potPin); // read the voltage on the pot //(val
ranges from 0 to 1023)percent = map(val,0,1023,0,100); // percent will range from 0 to
100.
EXAMPLE: Temperature sensor
const int inPin = 0; // analog pinvoid loop(){int value = analogRead(inPin);float millivolts = (value / 1024.0) * 3300; //3.3V analog inputfloat celsius = millivolts / 10; // sensor output is 10mV per degree
Celsiusdelay(1000); // wait for one second}
Using PIR motion sensorsconst int ledPin = 77; // pin for the LEDconst int inputPin = 2; // input pin (for the PIR sensor)void setup() {pinMode(ledPin, OUTPUT); // declare LED as outputpinMode(inputPin, INPUT); // declare pushbutton as input}void loop(){int val = digitalRead(inputPin); // read input valueif (val == HIGH) // check if the input is HIGH{digitalWrite(ledPin, HIGH); // turn LED on if motion
detecteddelay(500);digitalWrite(ledPin, LOW); // turn LED off}}
Case study 3: ultrasonic sensors
• The “ping” sound pulse is generated when the pingPin level goes HIGH for two microseconds.
• The sensor will then generate a pulse that terminates when the sound returns.
• The width of the pulse is proportional to the distance the sound traveled
• The speed of sound is 340 meters per second, which is 29 microseconds per centimeter. The formula for the distance
• of the round trip is: RoundTrip = microseconds / 29
Using ultrasonic sensorsconst int pingPin = 5;const int ledPin = 77; // pin connected to LEDvoid setup(){Serial.begin(9600);pinMode(ledPin, OUTPUT);}void loop(){int cm = ping(pingPin) ;Serial.println(cm);digitalWrite(ledPin, HIGH);delay(cm * 10 ); // each centimeter adds 10 milliseconds delaydigitalWrite(ledPin, LOW);delay( cm * 10);}
Using ultrasonic sensorsint ping(int pingPin){long duration, cm;pinMode(pingPin, OUTPUT);digitalWrite(pingPin, LOW);delayMicroseconds(2);digitalWrite(pingPin, HIGH);delayMicroseconds(5);digitalWrite(pingPin, LOW);pinMode(pingPin, INPUT);duration = pulseIn(pingPin, HIGH);// convert the time into a distancecm = microsecondsToCentimeters(duration);return cm ;}long microsecondsToCentimeters(long microseconds){// The speed of sound is 340 m/s or 29 microseconds per centimeter.// The ping travels out and back, so to find the distance of the// object we take half of the distance travelled.return microseconds / 29 / 2;}
Case study 4: Temperature sensor
void setup(){IOShieldTemp.config(IOSHIELDTEMP_ONESHOT |
IOSHIELDTEMP_RES11 | IOSHIELDTEMP_ALERTHIGH);} //oneshot mode, 11-bit resolution and alert
void loop() { float temp; int celsius; char sign, msd_char, lsd_char; //Get Temperature in Celsius. temp = IOShieldTemp.getTemp();}
Case study 5: Gyro sensor• Gyro sensors measure angular velocity in a device (typically in degrees/s)• Example: Analog devices ADIS16266
– Yaw rate gyroscope with range scaling – ±3500°/sec, ±7000°/sec, and ±14,000°/sec settings – 2429 SPS sample rate – Start-up time: 170 ms – Sleep mode recovery time: 2.5 ms – Calibration temperature range: −40°C to +70°C – SPI-compatible serial interface – Relative angle displacement output – Embedded temperature sensor – Digital I/O: data ready, alarm indicator, general-purpose – Sleep mode for power management – DAC output voltage – Single-supply operation: 4.75 V to 5.25 V – 3.3 V compatible digital lines – Operating temperature range: −40°C to +105°C
Case study 7: Resistive touchscreen
• A uniform voltage gradient is applied to one sheet. Whenever the second sheet touches the other sheet, the second sheet measures the voltage as a distance along the first sheet. This combination of voltage and distance provide X coordinate.
• After the X coordinate is located, the process repeats itself by applying uniform voltage gradient to the second sheet in order to find the Y coordinate. This entire process happens in a matter of milliseconds, oblivious to human eye.
Reading XY coordinates from resistive touchscreen sensor
const xres = ;Const yres = ;const int xPin = 0; // analog input pinsconst int yPin = 1;void loop(){int xcoord, ycoord; int xres, yres;xres = analogRead(xPin);yres = analogRead(yPin);xcoord = map(xres,0,1023,0,xres);ycoord = map(yres,0,1023,0,yres);delay(100);}
Exampleconst int xPin = 0; // analog input pinsconst int yPin = 1;void setup(){Serial.begin(9600); // note the higher than usual serial speed}void loop(){int xValue; // values from accelerometer stored hereint yValue;xValue = analogRead(xPin);yValue = analogRead(yPin);Serial.print("X value = ");Serial.println(xValue);Serial.print("Y value = ");Serial.println(yValue);delay(100);}
Question 1
• A temperature measurement system uses a sensor that operates in the -20 to 32.5 degrees Centigrade. The system requires a resolution of 0.05 degrees. Choose an appropriate ADC between 8, 10 and 12 bit options.