Low Cost DAQ What is DAQ Data AcQuisition (DAQ) is the process of measuring an electrical or physical signals such as voltage, current, temperature, pressure, or sound with a computer. A DAQ system consists of sensors, DAQ measurement hardware, and a computer with programmable software. Compared to traditional measurement systems, PC-based DAQ systems exploit the processing power, productivity, display, and connectivity capabilities of industry-standard computers providing a more powerful, flexible, and cost-effective measurement solution. DAQ’s Block Diagram DAQ Device’s Components Signal Conditioning Signals from sensors or the outside world can be noisy or too dangerous to measure directly. Signal conditioning circuitry manipulates a signal into a form that is suitable for input into an ADC. This circuitry can include amplification, attenuation, filtering, and isolation. Some DAQ devices include built-in signal conditioning designed for measuring specific types of sensors. DAQ Device’s Components Analog-to-Digital Converter (ADC) Analog signals from sensors must be converted into digital before they are manipulated by digital equipment such as a computer. An ADC is a chip that provides a digital representation of an analog signal at an instant in time. In practice, analog signals continuously vary over time and an ADC takes periodic “samples” of the signal at a predefined rate. These samples are transferred to a computer over a computer bus where the original signal is reconstructed from the samples in software. DAQ Device’s Components Computer Bus DAQ devices connect to a computer through a slot or port. The computer bus serves as the communication interface between the DAQ device and computer for passing instructions and measured data. DAQ devices are offered on the most common computer buses including USB, PCI, PCI Express, and Ethernet. More recently, DAQ devices have become available for 802.11 Wi-Fi for wireless communication. There are many types of buses, and each offers different advantages for different types of applications. Market Background • Nowadays, there is several low cost DAQ applications, with an average 200$ price tag. • Typical dimensions varies from a size of a cigarettes pack. • Typical power consumption of such devices varies between : ~ 0.1W - 0.5W Project Motivation • Ultra low cost MSP430™ series Microcontroller – starting from 2$ • Ultra low power consumption ~20uW • Integrated USB2 controller with PHY • Small dimension – can be applied on an USB dongle Principle of operation • To implement the DAQ device, we will use an MSP430F5529’s GPIOs for collecting analog DATA and to generate a desired output. Integrated ADC will convert the signals. As a DAQ’s manipulator and a data analyzer, we will use a PC powered with NI LabView. Thanks to the integrated USB2 controller, we will be able to achieve a 12Mb/s data link. Introducing the MSP as the heart of the DAQ • 16-Bit RISC Architecture, 8+2KB SRAM, up to 25-MHz System Clock • An ADC with a 12 bit A/D conversion for collecting the analog data • Up to 43 GPIO’s for custom use • 4 16-bit timers for setting an analog sample rate, and generating PWM signal. • Full speed USB with integrated PHY Introducing the MSP as the heart of the DAQ Things to do • Check what an USB class device is the best for our application • Implement an USB client side communication using a TI MSP430 USB API • Implement the DAQ’s functions and operation modes Things to do • Implement a Windows driver for communicating with a MSP430F5529 • Using LabView, implement a GUI for data acquisition Development process: Tools MSP430F5529 USB Experimenter’s Board Development process: Tools MSP430F5529 USB EB Features • • • • USB Based Development Platform 5-pad capacitive touch strip microSD Card Slot 102x64 grayscale, dot-matrix LCD with backlight Development process: Tools MSP430F5529 USB EB Features • 4 push buttons • 3 GP LEDs, 5 LEDs for capacitive touch buttons, and 1 LED Power indicator. • Scroll wheel/Potentiometer • Integrated eZ-FET for Spy-Bi-Wire (2-wire JTAG) programming and debugging Development process: Tools MSP430F5529 USB EB Features • JTAG header for full 4-wire JTAG programming and debugging • Easy access to F5529 I/O pins by 100mil header Development process: Tools TI Code Composer Studio Integrated Development Environment v5 • CCS is used for MSP430 target code development and designing. It features integrated ez-FET driver for MSP430F5529 EB flasher/debbuger, MSP430 family API, various debugger tools, and C compiler for MSP430 MCUs. Development process: Tools MSP430 USB API Stack for CDC/PHDC/HID/MSC This API is used for implementing a client side USB communication with a Host. For our application, we have chose the CDC USB class. Classes description, and the choice reason will be explained later Development process: Tools National Instruments LabView LabVIEW (short for Laboratory Virtual Instrumentation Engineering Workbench) is a system design platform and development environment for a visual programming language from National Instruments. Development process: Tools National Instruments LabView This design platform was chosen for implementing the PC host side client application. The main reason of this choice is ease and relatively short development time of the host application Development process: Digital I/O The digital I/O features include: • Independently programmable individual I/Os • Any combination of input or output • Individually configurable P1 and P2 interrupts. • Independent input and output data registers • Individually configurable pullup or pulldown resistors Development process: Digital I/O • MSP459F5529 have eight digital I/O ports implemented (P1 to P8, PU and PJ). • P1 to P7 ports contain eight I/O lines; however, P8, Port U and Port J contains three, three and four lines respectively. • Ports P1 and P2 always have interrupt capability. Each interrupt for the P1 and P2 I/O lines can be individually enabled and configured to provide an interrupt on a rising or falling edge of an input signal. • Most pins connect to a more specialized peripheral, but if that peripheral is not needed, the pin may be used for generalpurpose I/O. Development process: • • • • • Digital I/O We are going to use the following ports: P1 or/and P2 - Timers and External interrupts. P6, P7.0-P7.3 – 12 bit ADC inputs. P5.0 and P5.1 - ADC reference voltage inputs. PU – Communication with PC via USB protocol. • P5.2-P5.5 – Inputs for 2 crystal oscillators. Development process: Digital I/O For example Port 6 that can be used as GPIO and as Analog signal inputs for ADC: Development process: USB Universal Serial Bus (USB) is an industry standard developed in the mid-1990s that defines the cables, connectors and communications protocols used in a bus for connection, communication and power supply between computers and electronic devices. This communication protocol is widely used nowadays for communicating between a host PC and various detachable peripherals Development process: USB MSP430F5529 Block diagram Development process: USB MSP430 USB API stack supported USB classes 1. HID 2. MSC 3. CDC 4. PHDC Development process: USB HID • Human interface device class • Pros: there is no need for a driver for a Host machine. Great advantage for limited access workstations • Contras: 64KB/s Development process: USB MSC • Mass storage Device Class • Designed for storage operations • Supports only bulk transfer Development process: USB • • • • PHDC Personal Healthcare Device Class Certified for use with several Personal Healthcare devices such as blood pleasure monitor, thermometer, weight scale and etc. Pros: Easy development Contras: For PH devices only, consumes large amount of RAM Development process: USB • • • • CDC Communication device class For use with various communication devices. Simple protocol Pros: Widely used virtual com class. High communication speed. Simple host application development Contras: At the first use on the host workstation, an appropriate driver installation is needed. Disadvantage for a limited access workstations Development process: USB DAQ’s USB Class • For implementing an USB communication with a host PC, was decided to use the CDC protocol due to it’s high data rate speed (up to 6.3Mbp/s) and simple communication protocol that fits our needs Development process: USB DAQ’s USB Class • Relying on the USB API stack, we developed a target code that gives the ability to the MSP430F5529 to communicate with a host PC through virtual COM port. Development process: USB DAQ’s USB Class • USB communication target code is initializing MSP430 device as CDC class device with a temporary (development) VID/DID. USB interrupt register launches several routines to handle USB events such as initial connection handshake, data transmit ready, data receive ready, device disconnected, host busy and etc… Development process: USB MSP430 USB communication code • USB communication target code is initializing MSP430 device as CDC class device with a temporary (development) VID/DID. USB interrupt register launches several routines to handle USB events such as initial connection handshake, data transmit ready, data receive ready, device disconnected, host busy and etc… Development process: USB USB Input handling • USB target code designed to continuously receive all incoming data and to store it in the buffer. After receiving the CR (Enter) character, a C case routine handle the received data to perform the user desired request and the buffer is cleared. Development process: USB USB output • After the desired DAQ’s operation performed, MCU will prepare the collected data and transmit it back to the PC. Yet not designed a transmitted data package. It is up to the host’s application to handle and to decode the package Development process: ADC • An analog-to-digital converter (abbreviated ADC) is a device that converts a continuous signal to a discrete time digital representation. • Typically, an ADC is an electronic device that converts an input analog voltage or current to a digital number proportional to the magnitude of the voltage or current. Development process: ADC MSP430F5529 ADC Block diagram Development process: ADC • The ADC module supports 12-bit analog-todigital conversions. The module implements a 12-bit SAR core, and a 16-word conversionand-control buffer. The conversion-andcontrol buffer allows up to 16 independent analog-to-digital converter samples to be converted and stored without any CPU intervention. Development process: ADC 1. 2. 3. 4. 5. 6. Main features Greater than 200-ksps maximum conversion rate Sample-and-hold with programmable sampling periods controlled by software or timers. Conversion initiation by software or timers. Software-selectable on-chip reference voltage generation (1.5 V, 2.0 V, or 2.5 V) Software-selectable internal or external reference Up to 12 individually configurable external input channels Development process: ADC Main features 7. Conversion channels for internal temperature sensor, AVCC, and external references 8. Independent channel-selectable reference sources for both positive and negative references 9. Selectable conversion clock source 10. Single-channel, repeat-single-channel, sequence (autoscan), and repeat-sequence conversion modes 11. Interrupt vector register for fast decoding of 18 ADC interrupts 12. 16 conversion-result storage registers Development process: ADC Used ADC registers 1. ADC12CTL0: For setting a sampling time and turning the ADC module on 2. ADC12CTL1: For choosing an internal sampling timer, setting continuous/single sampling mode and choosing a conversion memory register 3. ADC12MCTLx: Assigning a memory register conversion input channel 4. ADC12IE: Enabling interrupts corresponding “memory loaded” flag 5. ADC12IV: Interrupt vector events Development process: ADC ADC decoding formula N A D C 4095 * • Vin – Analog input • Vr+ - Positive reference voltage • Vr- - Negative reference voltage V in V R VR VR Development process: Timers MSP430F5529 features 4 16bit Timers • Timer A0 with 5 Capture/Compare registers • Timer A1 with 3 Capture/Compare registers • Timer A2 with 3 Capture/Compare registers • Timer B0 with 7 Capture/Compare registers Development process: Timers 16-bit timer/counter with up to seven capture/compare registers. Timer can support multiple capture/compares, PWM outputs, and interval timing. Timer also has extensive interrupt capabilities. Interrupts may be generated from the counter on overflow conditions and from each of the capture/compare registers. Development process: Timer Development process: Timer We intend to use the timer for a sampling interval, as well as PWM generator. Timers code development hasn’t started yet. Gantt task name duration Reading materials Reading materials Experimenting with MSP430F5529 Characterization 1 week 1 week 1 week 1 week C code writing: 10 weeks USB Interface 3 weeks ADC modes library 4 weeks DAQ’s modes – MSP side 2 weeks Host PC LabView GUI development 4 weeks Fine tuning Mid presentation Verification and Debugging Final report Final presentation 1 week 1 weeks 3 weeks 7 weeks 1 weeks 26/3 2/4 9/4 16/4 23/4 30/4 7/5 14/5 21/5 28/5 4/6 11/6 18/6 25/6 30/7 6/8 13/8 20/8 X X X X X X X X X X X X X X X X X X X X X X X X X X E X A M S X X X X X X X X X X References • Data Aacquisition -http://en.wikipedia.org/wiki/Data_acquisition • NI Low-Cost DAQ USB 6008 http://sine.ni.com/nips/cds/view/p/lang/en/nid/201986 • TI datasheets: • http://www.ti.com/tool/msp-exp430f5529 • http://www.ti.com/product/msp430f5529 • http://focus.ti.com/paramsearch/docs/parametricsearch.tsp?family=analog &familyId=2020&uiTemplateId=NODE_STRY_PGE_T • http://www.usb.org/home • http://www.ti.com/tool/msp430usbdevpack • http://www.ni.com/labview/ • http://www.ni.com/data-acquisition/ • http://www.ni.com/data-acquisition/usb/