390 likes | 1.02k Views
Sensor Technology. Dr. Konstantinos Tatas. Outline. Introduction Sensor requirements Sensor Technology Selecting a sensor Interfacing with sensors Integrated sensors Nanosensors Case studies. Introduction.
E N D
Sensor Technology Dr. Konstantinos Tatas
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
Selecting a sensor • Appropriate dynamic range: • Sufficient sensitivity:
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
u(V) 1111 1110 16 1100 14 12 1010 1001 10 1000 8 0110 0101 0100 6 4 u(V) 2 16 ADC 1111 1 2 3 4 5 6 7 8 9 t (S) 1110 14 1100 12 D0 0 1 0 1 0 0 1 0 0 1010 10 1001 1000 D1 0 0 1 0 1 1 1 0 0 8 DAC 0110 6 D2 1 0 1 1 0 1 1 1 0 0101 0100 4 D3 0 1 0 0 1 1 1 1 1 2 1 2 3 4 5 6 7 8 9 t (S) Signals (Analog - Digital) • Analog Signal • can take infinity values • can change at any time • Digital Signal • can take one of 2 values (0 or 1) • can change only at distinct times Reconstruction of an analog signal from a digital one (Can take only predefined values)
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)
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 0001and the output voltage is 5mV, then • If the binary code at the input becomes 1001, the output voltage will become ...... 45mV • If a D/A converter has 4 digital inputs then the analog signal at the output can have one out of …… values. 16 • If a D/A converter has N digital inputs then the analog signal at the output can have one out of ……. values. 2Ν
Characteristics of Data Converters • 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 • 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. • Polarity • Polar: the analog signals can have only positive values • Bipolar: the analog signals can have either a positive or a negative value • 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…) • 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 • 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. • 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ºCand has selectable resolution from 0.5ºC downto 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 potentiometer void loop() { int val; // The value coming from the sensor int percent; // The mapped value val = analogRead(potPin); // read the voltage on the pot //(val rangesfrom 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 pin void loop() { int value = analogRead(inPin); float millivolts = (value / 1024.0) * 3300; //3.3V analog input float celsius = millivolts / 10; // sensor output is 10mV per degree Celsius delay(1000); // wait for one second }
Using PIR motion sensors const int ledPin = 77; // pin for the LED const int inputPin = 2; // input pin (for the PIR sensor) void setup() { pinMode(ledPin, OUTPUT); // declare LED as output pinMode(inputPin, INPUT); // declare pushbutton as input } void loop(){ int val = digitalRead(inputPin); // read input value if (val == HIGH) // check if the input is HIGH { digitalWrite(ledPin, HIGH); // turn LED on if motion detected delay(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 340meters per second, which is 29 microseconds per centimeter. The formula for the distance • of the round trip is: RoundTrip = microseconds / 29
Using ultrasonic sensors const int pingPin = 5; const int ledPin = 77; // pin connected to LED void 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 delay digitalWrite(ledPin, LOW); delay( cm * 10); }
Using ultrasonic sensors int 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 distance cm = 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 pins const 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); }
Example const int xPin = 0; // analog input pins const int yPin = 1; void setup() { Serial.begin(9600); // note the higher than usual serial speed } void loop() { int xValue; // values from accelerometer stored here int 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.