* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Lecture 4
Voltage optimisation wikipedia , lookup
Flip-flop (electronics) wikipedia , lookup
Ground loop (electricity) wikipedia , lookup
Dynamic range compression wikipedia , lookup
Mains electricity wikipedia , lookup
Quantization (signal processing) wikipedia , lookup
Control system wikipedia , lookup
Schmitt trigger wikipedia , lookup
Time-to-digital converter wikipedia , lookup
Power electronics wikipedia , lookup
Pulse-width modulation wikipedia , lookup
Switched-mode power supply wikipedia , lookup
Resistive opto-isolator wikipedia , lookup
Integrating ADC wikipedia , lookup
Oscilloscope types wikipedia , lookup
Buck converter wikipedia , lookup
Oscilloscope history wikipedia , lookup
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 Signals (Analog - Digital) u(V 16) 1111 1110 14 1100 12 10 101 0 1001 8 100 0 0110 6 4 Analog Signal • can take infinity values • can change at any time 0101 0100 2 1 2 3 4 5 6 7 8 9 ADC 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) u(V) t (S) 16 1111 1110 14 1100 12 1010 D0 D1 0 0 1 0 0 1 1 0 0 1 0 1 1 1 0 0 0 0 1001 10 1000 8 DAC6 011 0 0100 D2 1 0 1 1 0 1 1 1 0 D3 0 1 0 0 1 1 1 1 1 0101 4 2 1 2 3 4 5 6 7 8 9 t (S) 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) u(V) Analog signal value at sampling time: 4.9 V 16 Quantized Analog signal value: 5.0 V 14 12 Quantization error: 5.0 - 4.9 = 0.1 V 10 8 6 4 2 1 2 3 4 5 6 7 8 9 t (S) 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 45mV voltage will become ...... • If a D/A converter has 4 digital inputs then the analog signal at the output can have one out of 16 values. …… • If a D/A converter has N digital inputs then the analog signal at the output can have one out of 2Ν values. ……. D3 D2 D1 D0 Vout (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. 2. 3. 4. 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) 5. 6. 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. 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. 0.1Vo Vo 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 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 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 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 Case study 2: PIR motion sensor 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 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 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 6: accelerometer 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.