580 likes | 843 Views
MAS836 – Sensor Technologies for Interactive Environments. Lecture 10 – Digital Sensor Processing and Modules. The Next Steps. So far, we have concentrated on the use of a variety of sensors to measure human interaction However, a measurement alone is of little value Next steps:
E N D
MAS836 – Sensor Technologies for Interactive Environments Lecture 10 – Digital Sensor Processing and Modules
The Next Steps • So far, we have concentrated on the use of a variety of sensors to measure human interaction • However, a measurement alone is of little value • Next steps: • Conversion of the data into a computer-readable format • Processing within the microcontroller • Communication with to other devices
Analog Processing Analog to Digital Conversion Digital Processing RF Transmission Sensor One Approach • There are numerous possible data flow patterns • We will concentrate on one: • Each involves different technologies and issues • We will also discuss other networking protocols
Analog Processing (1) • Most analog signal processing was covered in first three lectures • Some issues are of particular importance when preparing data for analog to digital conversion • Just as important for looking at data using other techniques (e.g. oscilloscope) • Three issues are quickly touched upon • Obviously there are many more
Analog Processing (2) • Output Range • Voltage output should fill the input range of the analog to digital converter (ADC) • Unipolar/bipolar • Output Bandwidth • Amplifier should attenuate outside frequencies of interest (both high and low) • Take both sensor and data bandwidth into account • Output Impedance • Usually need to buffer signal to avoid loading of next portion of signal chain
Analog to Digital Conversion:Basics • Converts analog data (continuous) into digital values (discrete) • Input range is divided into steps • Each is at a discrete voltage and represented by an integer value
Analog to Digital Conversion:Figures of Merit • Number of bits: Size of the integer used to represent the analog value. • N bits provide 2N different values • Vref: Maximum voltage of the converter • Vref is represented by 2N-1 • Minimum voltage is almost always 0V • Sampling rate: Number of individual measurements made in a fixed time • Limited by technique used • Impedance limit: Largest input impedance at which the ADC will still function properly • Based on size of internal hold capacitor and sampling rate
Analog to Digital Conversion:Successive Approximation • Most common form of ADC • Bits are calculated one at a time and operation can be stopped at any point • Each bit is found by comparing the input value to the value represented by all the bits calculated so far • Requires a DAC
Analog to Digital Conversion:Flash • Simplest, fastest form of ADC • Sometimes known as a parallel converter • Voltage ladder divides reference voltage into 2N steps, which are compared to the input voltage • Requires 2N resistors and comparators • Limited by resistor accuracy
Analog to Digital Conversion:Misc • Highest accuracy ADCs are sigma-delta type • Gains arise from oversampling (alters noise spectra) • Chart shows range of ADCs discussed
Analog to Digital Conversion:Sampling Rate • Aliasing is the folding over of higher frequencies when sampled at less than double their frequency • Leads to loss of data and increase in noise • To avoid: • Always sample at twice the highest frequency of interest (known as Nyquist sampling) • Always filter out higher frequencies before conversion
Analog to Digital Conversion:Error/Noise • The error in an ADC can be treated as a white noise source • Only if number of bits is high enough and voltage is in range • Equivalent to half of the least significant bit • 6(N+1) dB • Comparison of this value and the noise in the system allows calculation of the maximum accuracy (number of bits) worth considering
Microcontrollers:Overview • A microcontroller (uC) is a small, lightweight CPU which is usually combined with on-board memory and peripherals • Compact and low power (relatively) • Often used as a simple hardware to software interface as well as for in-situ processing • Analog to digital gateway • Allows for real-time feedback based on data
Microcontrollers:Features (1) • Processor speed: Fundamental measure of processing rate of device • Value of interest is in MIPS, not MHz • Supply voltage/current: Measure of the amount of power required to run the device • Multiple modes (sleep, idle, etc) • It is possible to adjust the voltage and frequency of some devices in real time, thereby trading off speed and power usage
Microcontrollers:Features (2) • Internal memory: Sometimes divided between program and data memory, the amount of information that can be stored on board • Can sometimes be supplemented by external memory • I/O Pins: Individual points for communication between the uC and the rest of the world • Can be digital or analog, general or special purpose • Interrupts: Non-linear program flow based on event triggers from peripheral or pins
Microcontrollers:Peripherals (1) • Timers: Internal registers (any size) in the uC that increment at the clock rate • May have prescaler • May be combined with range testing for interrupt • Watchdog timers reset processor if it hangs. • Comparators: Input that effectively functions as a 1-bit ADC with an adjustable threshold • Used for real-time data monitoring
Microcontrollers:Peripherals (2) • ADC: Most ADCs used in sensor data collection are integrated with uC • Watch for number of channels vs number of inputs • Sampling speed does not include input switch time • Very fast ADCs often combined with DMA • DAC: Digital to analog converters are also include in some data collection driven uC • Mostly used for feedback and control
Microcontrollers:Communication (1) • UART: Basic hardware module which mediates serial communication (RS232) • Simplest form of communication but limited by speed • Most modules are full duplex • USB: High bandwidth serial communication between uC and a computer or an embedded host • Usually requires chips with specialized hardware and firmware • Host side issues • SPI: Full duplex master-slave 4-wire protocol for data transfer between uCs • Mbit transfer rates, but somewhat quirky protocol • Unlimted (almost) nodes, can change master
Microcontrollers:Communication (2) • I2C: Half duplex master-slave 2-wire protocol for data transfer between uCs • kbit transfer rates • Tx/Rx based on slave addressing • Can invert protocol with sensors as masters • RF: Radio frequency (>100 MHz) EM transmission of data • Built in to some newer special-purpose uC • Wireless spherical transmission • More later
Microcontrollers:Atmel AVR • 8-bit RISC series of microcontroller chips • Large range of available devices covering many interfaces, speeds, memory sizes, and package sizes • Large hobbyist development community with many available free toolchains and sample applications • General specs • One MIPS per MHz • Models available up to 20MHz • Max 128K program space / 8K RAM • ADC/LCD Driver/Motor Control • UART/CAN/USB/IIC/SPI/DAC/LCD/PWM/Comparators • http://www.atmel.com/products/product_selector.asp
Microcontrollers:TI MSP430 • Proprietary TI low-power low-cost RISC chips • Well supported by TI with good program chain • Designed for intermittent sampling and fast startup • General specs • Very low power (flexible) • Max 32KHz / 8 MIPS • Max 50K program space / 10K RAM • Max 16 bit ADC • UART/SPI/DAC/LCD/PWM/Comparators • http://www.msp430.com
Microcontrollers:Silicon Labs (FKA Cygnal) • 8051 derivate uC with high reconfigurability • Many programming environments available • Vary from 3mm2 to 100 pin packages • General specs • Medium power • Max 100 MHz / 100 MIPS • Max 128K program space / 8K RAM • Max 16 bit ADC • UART/USB/SPI/CAN/PWM/Comparators • http://www.silabs.com/products/microcontroller/
Microcontrollers:Atmel ARM7 (AT91SAM7S series) • 32-bit ARM microcontroller • Low power (for 32-bit machines) • Can run in 16-bit mode if needed • General specs • Lots of memory (8-64KB RAM, 32-256KB flash) • Variable speed up to 55MHz • Packed with peripherals (USB, ADC, SPI, etc.) • Comes in LQFP 48 and 64 packages • Not suitable for beginners • http://www.at91.com/
Microcontrollers:Misc • Analog Devices ADUC8xx: • More of an ADC with a uC attached • Some models include 24 bit sigma-delta converter • Useful with IEEE 1451 (see later) • http://www.analog.com/IST/SelectionTable/?selection_table_id=212 • Chipcon CCxxxx: • More of an RF transceiver with a uC attached • Variety of frequency ranges and modulation schemes • http://www.chipcon.com/index.cfm?kat_id=2
x[n] Digital Filter h[n] y[n] Digital Signal Processing:Basics • A discrete time stream x[n] is convolved with a discrete time impulse response h[n] to produce an output y[n] • x[n] is usually acquired from a continuous time signal x(t) using an ADC • h[n] is the response to a single input of 1 at time 0 • Can be finite (FIR) or infinite (IIR) • Can be described as a difference equation
Digital Signal Processing:Considerations • Why would I want to do this? • Reconfigurable in real-time • Allows off-line processing • Power savings • What are the drawbacks? • Non-parallel • Memory intensive • Stability issues can be complex
Digital Signal Processing:Algorithms (1) • Simplest and most common DSP algorithm is the N-point running average: • Acts as a smoothing filter • Pseudo-lowpass • Recursive implementation in two operations per cycle
Digital Signal Processing:Algorithms (2) • A wide variety of frequency filters (HP/LP/BP) can be constructed as both FIR and IIR filters • FIR more stable • IIR shorter impulse response • See MATLAB for more details • Fast Fourier Transform allows quick ( ) conversion from time domain to frequency domain (for N = power of two) where
Digital Signal Processing:Algorithms (3) • Outlier detection • Not strictly DSP (no impulse response) • No analog equivalent • Difference with adjoining points must meet certain criteria: • Greater than some factor of a baseline value • ie More than three greater than the standard deviation • Sign of values are opposites • ie Curve changes direction (spikes)
Radio Frequency Transmission:Basics (1) • Radio frequency (RF) electromagnetic transmission is the use of high frequency radiation to transmit data wirelessly between devices • Can be very high speed (50 Mbits+) • Can have enormous range (10 km+) • Does not require line-of-sight • HCI systems tend to be <1Mbit and have a range of <10m, but the same principles apply in all cases
Radio Frequency Transmission:Basics (2) • Data is transmitted on a carrier wave of a fixed frequency • The centre frequency is known as the carrier frequency • Data is introduced into the carrier through means of a modulation scheme • Often, multiple transmitters want (need) to share the channel, requiring channel access schemes • Transmissions are made more robust to (non-flat) interference through spread spectrum techniques
Radio Frequency Transmission:Figures of Merit • Transmitter power: Measured in dBm (dB referenced to 1 mW), the fundamental measurement of the power in a signal • Most unlicensed transmitters are ~0dBm • Receiver sensitivity: The smallest signal which can be adequately detected • Usually around –90dBm • BER: Bit error rate, the frequency with which data is received incorrectly • Can be in 10-9 range for simple short transmissions
Radio Frequency Transmission:Modulation – OOK/ASK • On-Off Keying (OOK) is the most trivial of all modulation schemes. • The transmitter is turned on to full power to send 1 and off to send 0 • Can be driven directly with a UART • Most power efficient since transmitter is only on 50% of the time on average • Amplitude Shift Keying (ASK) is similar, except the TX power is merely lowered for a 0 bit • Allows for faster transmission
Radio Frequency Transmission:Modulation - BPSK • Binary phase shift keying (BPSK) uses a carrier continuously broadcast at the same amplitude • A 1 is indicated if there is a 180 phase shift in the bit window, otherwise the bit is 0 • Allows for better carrier lock at receiver • We see at right that OOK is equivalent to multiplying the carrier by the data, while BPSK is XOR
RF Channel Sharing Protocols • Time Division Multiple Access (TDMA) • Frequency Division Multiple Access (FDMA) • Carrier Sense Multiple Access (CSMA) • Direct Sequence Spread Spectrum (DSSS) • Frequency Hopping Spread Spectrum (FHSS) Laibowitz and Paradiso, “Embedded Wireless Transceivers and Applications in Lightweight Wearable Platforms,” Circuit Cellar, February 2004
Radio Frequency Transmission:Channel Access – TDMA/FDMA • Time division multiple access (TDMA) divides the channel up into chunks of time, with a different transmitter for each chunk • Requires master receiver to allocate chunks and keep synchronization • Frequency division multiple access (FDMA) divides the channel up into chunks of frequency, with a different transmitter for each chunk • Master not necessarily required
Tx1 Rx Tx2 Tx1 Range Tx2 Range Radio Frequency Transmission:Channel Access – CSMA • For low duty cycle transmitters, we can avoid masters and complicated schemes by using carrier sense multiple access (CSMA) • Listen before you talk • Hidden node problem:
Radio Frequency Transmission:Spread Spectrum - DSSS • Direct sequence spread spectrum (DSSS) expands the frequency range of a signal by modulating it (xor) with a much faster sequence known as a chip • Chips must be orthogonal to each other • Receiver must have same noise (chip) generator • Provides immunity to localized (in frequency) noise
Radio Frequency Transmission: Spread Spectrum - FHSS • While DSSS spreads at greater than the data rate, frequency hopping spread spectrum (FHSS) spreads at a much lower rate • Shifts happen ~ 10 bits (or so) • Again, receiver must know sequence • Originally invented during WWII by Hedy Lamarr and George Antheil to avoid jamming of radio-controlled torpedoes • Player piano rolls used to synchronize • In both techniques, all other sequences appear to be noise at the receiver
Radio Frequency Transmission:Bands • Low frequency unlicensed bands at 433 and 915 MHz are often used by low power ASK devices • Can only transmit for 36 seconds each hour (1%) • The high frequency unlicensed bands at 2.4 GHZ and 5.8 GHz are used by high speed spread spectrum devices • Eg. Wireless LAN • Both parts of the ISM band
Radio Frequency Transmission:Usage Notes • RF components are enormously sensitive to: • Placement • ground plane and traces • Power supply • Antenna can also have huge effect: • Quarter-wave whip best, but large for lower frequencies (c=f) • Helical antennae attenuate by 5dB, printed whip by 10dB • Need to match impendence to transmitter output (50)
The RFRAIN Card • Made by Mat Laibowitz for the UbER-Badge • GP RF card based on the Chipcon CC1010 • Circa 70 kbps • CSMA Scheme
The CC2500 Daughtercard • Made by Mat Laibowitz for the Plug and other projects • GP RF card based on the Chipcon CC2500 • Circa 500 kbps • CSMA Scheme, but can be used with other methods
Sensor Networking Protocols:Overview • Our previous discussion considered sensor modules which did not talk to each other or have any response more complicated than continuous collection, processing and transmission of data • Sensor networking protocols allow: • To establish clusters on the fly • To be remotely interrogated and controlled by master devices over a variety of communication systems • Modules to describe their own data
Sensor Networking Protocols:Importance • Allow for easier creation of sensor networks, including central node which understands and processes the data • Increase user acceptance of modules by trivializing their setup • Decentralize the data processing to reduce communication costs • Allow for remote collaboration through searching protocols and shared open sensors
Local Processor Sensors Star Topology Intelligence at the Extremities • Local processor detects, processes or compresses local features • High data rates possible with limited node densities • Wearable, medical applications Peer-Peer • Feature extraction via local communication • Results routed out node-node • Potentially scalable to very high density • Electronic skins, sensate media
Some Sensor Net Architectures • Berkeley Motes • Current version favors size and integration over modularity • Commercial Version from Crossbow (also moteiv) • Concentrates on ad-hoc networking application • http://webs.cs.berkeley.edu/tos/hardware/hardware.html • Philips SAND • Modular system for wireless sensing • Multiple panes with different functionality (IMU/ECG/DSP) • Networking via ZigBee • http://www.research.philips.com/password/archive/23/downloads/pw23_sip_18.pdf • Millenial Net • MIT ME Spinoff (lower-end) • http://www.millennial.net/ • Ember • Media Lab Spinoff (higher-end) • http://www.ember.com/
Sensor Networking Protocols:802.15 • IEEE 802.15 standard defines specifications for wireless personal-area network (PAN) • Defined as a number of devices communicating solely amongst themselves in a 10m radius • Transmission is in the 2.4 GHz band • Master-slave protocol with automatic discovery • TDMA or CSMA channel sharing • Sub-standards based on transmission speed, number of nodes, and packet size