2011/9/30 Wireless Sensor Network And Labs fall 2011 1 Outline Platforms and microcontrollers Software Electronics, schematics and datasheets 2011/9/30 Wireless Sensor Network And Labs fall 2011 2 WSN Platform A hardware device that enable wireless sensor network research Typical components Microcontroller Radio Power supply Sensors and/or actuators Peripherals 2011/9/30 USB interface Storage Wireless Sensor Network And Labs fall 2011 3 What Do We Have TelosB (Taroko/TmoteSky/TIP700CM) Original design: UC Berkeley CHNDS Taroko Crossbow TelosB Moteiv Tmote Sky 2011/9/30 Wireless Sensor Network And Labs fall 2011 Maxfor TIP700CM 4 Crossbow Original design: UC Berkeley Commercial product: Crossbow Mica2 Other products from Crossbow Cricket Imote2 IRIS Cricket 2011/9/30 MicaZ Wireless Sensor Network And Labs fall 2011 Imote IRIS 5 Others (Research) BTnode (ETH Zurich) Commercialized XYZ (Yale University) MSB (Freie Universitat Berlin) Modular Sensor Board (MSB) 2011/9/30 Wireless Sensor Network And Labs fall 2011 6 Others (Commercial) Dustnetworks (spun out of UC Berkeley) iDwaRF – NodeBoard Worldsens – WSN430 2011/9/30 Wireless Sensor Network And Labs fall 2011 7 Others (Industrial Control) Accsense MicroStrain Sensicast 2011/9/30 Wireless Sensor Network And Labs fall 2011 8 Now ! 2011/9/30 Wireless Sensor Network And Labs fall 2011 9 Taroko Original design version TelosB by UC Berkeley Modified version Taroko (CHNDS, Taiwan) TelosB (Crossbow, USA) Tmote Sky (Moteiv, USA) TIP700CM (Maxfor, Korea) 2011/9/30 Wireless Sensor Network And Labs fall 2011 10 On Taroko Microcontroller TI (Texas Instruments) MSP430F1611 Radio TI Chipcon CC2420 250kbps, 2.4GHz USB interface 8M-bit flash memory Extension connectors Optional sensors Light, Humidity and Temperature 2011/9/30 Wireless Sensor Network And Labs fall 2011 11 Microcontroller (MCU) The heart of the WSN platform Control everything It is all about programming this chip 2011/9/30 Wireless Sensor Network And Labs fall 2011 12 What Is A Microcontroller No general definition Common features low speed Microcontroller -> ARM/DSP -> Pentium/AMD no hierarchical Memory Bits – usually 8-bit, or 16-bit Power – consume less power Cost – usually it is much cheaper Input/Output (I/O) peripherals 2011/9/30 many on chip peripherals available Wireless Sensor Network And Labs fall 2011 13 List of MCU Texas Instruments (TI): MSP430 Silabs: C8051Fxxx There are many other companies making 8051 architecture microcontrollers including Intel, Atmel, Dallas Semiconductor, and etc. Microchip Technology: PIC Atmel: ATmega128 Freescale Semiconductor (Motorola): 68HCxx Many others AMCC (IBM), Altera, Cypress MicroSystems, Infineon, Holtek, National Semiconductor, Parallax, Rabbit Semiconductor, NEC, STMicroelectronics, Analog Devices, Xemics, ZiLOG, NXP, OKI semiconductor, Renesas Technology, Samsung, and etc. 2011/9/30 Wireless Sensor Network And Labs fall 2011 14 Today’s Personal Computer Motherboard Storage (Harddisk) >120GB Peripherals IDE SATA Audio VGA CPU Memory (DRAM) >1GB Ethernet Keyboard, Mouse, Monitor, Printer, etc Firewire DMA Wifi USB ComPort 2011/9/30 Wireless Sensor Network And Labs fall 2011 15 Microcontroller Block Diagram Microcontroller Clock System Peripherals GPIO Timer Sensors and actuators ADC ALU Memory (RAM) 10KB Storage (Flash) 48KB 2011/9/30 UART SPI DMA External storage, other ICs, other circuits I2C DAC Host PC, PDA, etc. USB Ethernet Wireless Sensor Network And Labs fall 2011 16 Pins Light Sensors Temp/Humidity Sensor Infrared Sensors Motor Clock System USB Chip PC Radio Chip Switches 2011/9/30 Wireless Sensor Network And Labs fall 2011 LEDs 17 MSP430 Family 16-bit Reduced Instruction Set Computer (RISC) CPU 1K to 128K bytes Flash 128 bytes to 10K bytes RAM 14- to 100-pin I/O Ultra-low Power 2011/9/30 Wireless Sensor Network And Labs fall 2011 18 Clock Signal An oscillate signal generated by some hardware All processors, as well as many peripherals require clocks Clock frequency is the speed of the processor Usually, higher speed consume large energy 2011/9/30 Wireless Sensor Network And Labs fall 2011 19 Crystals A small block of quartz Apply a voltage, it will vibrate For a block of given size, it will vibrate at a given and fixed frequency They require a drive circuit to make them go 2011/9/30 Wireless Sensor Network And Labs fall 2011 20 Generate Clock Oscillator module include crystal and drive circuit Internal drive circuit + crystal most common case Digitally Controlled Oscillator an oscillator circuit constructed by some electrical components can control its frequency frequency varies with temperature, voltage, and from device to device 2011/9/30 Wireless Sensor Network And Labs fall 2011 21 MSP430 Clock system Flexible clock sources Always-on low frequency crystal (eg. 32.768KHz) On-demand high speed DCO (up to 25MHz) DCO on and stable in < 1μs 2011/9/30 Wireless Sensor Network And Labs fall 2011 22 Flexible Clock Sources in MSP430 Oscillator consume energy Higher the speed, larger the energy consumption Use high speed DCO for CPU for high speed peripherals wake up and get things done, go to sleep as soon as possible Use low frequency crystal oscillator for peripherals that require always on Save energy 2011/9/30 Wireless Sensor Network And Labs fall 2011 23 An Example: RTC Real-Time clock (RTC) software routine that records second, minute, and hour Calendar clock second, minute, hour, day, month, year. Implementation configure a timer (counter), use low frequency osc. (32.768KHz) as clock source when the timer counts to 32768 (exactly 1 second), it generates an interrupt processor wake-up, execute the RTC routines 2011/9/30 Wireless Sensor Network And Labs fall 2011 24 Memory RAM (Random Access Memory) volatile storage store variables, stack, and etc. Flash non volatile storage store program code, and data Info Segments (on MSP430) A special segment in flash Usually use to store parameters 2011/9/30 Wireless Sensor Network And Labs fall 2011 Memory Map of MSP430 25 Peripherals To communicate with the external world Sensors switches, light, temperature, accelerometer, infrared, humidity, pressure, acoustic, camera, and etc. Actuators and output controls motor, on/off control, LEDs, LCD display, and etc. Other ICs or circuit flash memory IC, SD card, USB flash disk, DSP processor, and etc. Host PC, PDA, Industry PC, and etc. 2011/9/30 Wireless Sensor Network And Labs fall 2011 26 Ways to Communicate Programmed I/O The processor accepts or delivers data at times convenient to it Interrupt-driven I/O External events control the processor by requesting the current program be suspended and the external event be serviced Direct Memory Access (DMA) DMA allows data to be transferred from I/O devices to memory directly without the continuous involvement of the processor 2011/9/30 Wireless Sensor Network And Labs fall 2011 27 Microcontroller Block Diagram Microcontroller Clock System Peripherals GPIO Timer Sensors and actuators ADC ALU Memory (RAM) 10KB Storage (Flash) 48KB 2011/9/30 UART SPI DMA External storage, other ICs, other circuits I2C DAC Host PC, PDA, etc. USB Ethernet Wireless Sensor Network And Labs fall 2011 28 GPIO General purpose input/output A pin on the Microcontroller Function Set as input or output When input Read the “value” on the pin (high/low) Generate an interrupt when transition occur When output Set the output of the pin to high/low voltage Usage Control LEDs, read switches input, communication, etc 2011/9/30 Wireless Sensor Network And Labs fall 2011 29 Timer It is a counter Measures time intervals Generate Interrupt (ex. 32.768kHz Crystal) Internal Clock Source Timer External Source Setting (ex. count to 32768) 2011/9/30 PWM Wireless Sensor Network And Labs fall 2011 Other Outputs 30 Analog to Digital Converter(ADC) Convert Voltage to a digital number Signal Path Signal Conditioning Sensors • Light • Temperature • Acceleration • Humidity • Pressure • etc. Produce a proper output voltage level (if necessary) • Resistance • Capacitance • Current • Voltage • etc. • Amplification • Filtering Convert to voltage Analog to Digital Conversion (ADC) 10011101 Converts voltage to digital number 2011/9/30 Wireless Sensor Network And Labs fall 2011 31 Digital Communications Sending bits between each other 10011101 A B Serial communication Our focus 10011101 Sending bits one by one A UART, SPI, I2C, USB, etc. Parallel communication 1 0 Sending multiple bits at one time 0 1 1 A Ethernet 1 B B 0 1 2011/9/30 Wireless Sensor Network And Labs fall 2011 32 Pins Light Sensors Temp/Humidity Sensor Infrared Sensors Motor Clock System USB Chip PC Radio Chip Switches 2011/9/30 Wireless Sensor Network And Labs fall 2011 LEDs 33 Arduino Hardware platform Open source Based on ATmega8 MCU Cheap, easily available Sparkfun 2011/9/30 Wireless Sensor Network And Labs fall 2011 34 Arduino Shields Boards that can be plugged on top of the Arduino PCB 2011/9/30 Wireless Sensor Network And Labs fall 2011 35 Arduino Projects 2d accelerometer + flash 3d stars http://www.youtube.com/watch?v=49WBPIIo3EE InteractionSoapBox based on Arduino http://www.youtube.com/watch?v=TwhOYmNCqrg Piezo Film + flash http://www.youtube.com/watch?v=nXLDyBFsqdg Weekend Project: Arduino Rumble Robots http://www.youtube.com/watch?v=Qc6DKDFwg9c 2011/9/30 Wireless Sensor Network And Labs fall 2011 36 Taroko “Shields” 2011/9/30 Wireless Sensor Network And Labs fall 2011 37 Robot Cars 2011/9/30 Wireless Sensor Network And Labs fall 2011 38 TI Embedded Processors TI Embedded Processing Portfolio ARM®-Based Processors Microcontrollers (MCUs) 16-bit ultralow power MCUs MSP430™ 32-bit real-time MCUs C2000™ Delfino™ Piccolo™ 32-bit ARM Cortex™-M3 MCUs Stellaris® ARM® Cortex™-M3 ARM Cortex-A8 MPUs ARM® Cortex™-A8 & ARM9 C6000™ DaVinci™ Up to 100 MHz 300MHz to >1GHz Flash 1 KB to 256 KB Analog I/O, ADC LCD, USB, RF Flash, RAM 16 KB to 512 KB Flash 8 KB to 256 KB Measurement, Sensing, General Purpose PWM, ADC, CAN, SPI, I2C Motor Control, Digital Power, Lighting, Ren. Enrgy USB, ENET MAC+PHY CAN, ADC, PWM, SPI Cache, RAM, ROM USB, CAN, PCIe, EMAC Connectivity, Security, Motion Control, HMI, Industrial Automation $1.00 to $8.00 Industrial computing, POS & portable data terminals $5.00 to $20.00 Multi-core DSP C6000™ Ultra Low power DSP C5000™ video processors OMAP™ 40MHz to 300 MHz $1.50 to $20.00 DSP DSP+ARM Sitara™ Up to 25 MHz $0.25 to $9.00 Digital Signal Processors (DSPs) 300MHz to >1Ghz +Accelerator Cache RAM, ROM USB, ENET, PCIe, SATA, SPI Floating/Fixed Point Video, Audio, Voice, Security, Conferencing $5.00 to $200.00 24.000 MMACS Up to 300 MHz +Accelerator Cache RAM, ROM Up to 320KB RAM Up to 128KB ROM USB, ADC McBSP, SPI, I2C SRIO, EMAC DMA, PCIe Telecom test & meas, media gateways, base stations $40 to $200.00 Audio, Voice Medical, Biometrics $3.00 to $10.00 Software & Dev. Tools 2011/9/30 Wireless Sensor Network And Labs fall 2011 39 MSP430F1xx 2011/9/30 Wireless Sensor Network And Labs fall 2011 40 MSP430F4xx 2011/9/30 Wireless Sensor Network And Labs fall 2011 41 MSP430F2xx 2011/9/30 Wireless Sensor Network And Labs fall 2011 42 What Has Changed? 1xx 2xx 4xx 5xx Basic Clock System Basic Clock System + FLL, FLL + Unified Clock System UCS Core voltage same as supply voltage Core voltage same as supply voltage Core voltage same as supply voltage Programmable Core Voltage with integrated PMM 16-bit CPU 16-bit CPU, CPUX 16-bit CPU, CPUX 16-bit CPUXV2 GPIO GPIO w/ pull-up and pull-down GPIO GPIO w/pull-up and pull-down, drive strength N/A N/A N/A CRC16 Software RTC Software RTC Software RTC with Basic Timer, Basic Timer + RTC True 32-bit RTC w/Alarms USART USCI, USI USART, USCI USCI, USB, RF DMA up to 3-ch DMA up to 3-ch DMA up to 3-ch DMA up to 8-ch MPY16 MPY16 MPY16, MPY32 MPY32 ADC10,12 ADC10,12 ADC12 ADC12_A 4-wire JTAG 4-wire JTAG, some devices with Spy-Bi-Wire 4-wire JTAG 4-wire JTAG and Spy-BiWire 2011/9/30 Wireless Sensor Network And Labs fall 2011 43 F5xx vs. Prior MSP430 Generations 2xx 4xx 5xx CPU Clock (max) 16MHz 8MHz 25MHz *Active Current (3.0V, typ) 515uA @ 1MHz 4.2mA @ 8MHz 9.1mA @ 16MHz 600uA @ 1MHz 4.8mA @ 8MHz N/A 290uA @ 1MHz 1.84mA @ 8MHz 230 uA/MHz 8.90mA @ 25MHz 120KB / 8KB (Flash / RAM) 120KB / 8KB (Flash / RAM) 256KB / 16KB (Flash / RAM) Wake-up Time From LPM3 1us 6us 5us Standby LPM3 Current 0.9 – 1.1uA 1.1 – 2.5uA 2.6uA (with active true RTC) LPM4 Current 0.1uA 0.1uA 1.6uA (LPM4) / 0.1uA (LPM5) Flash ISP Minimum DVCC 2.2V 2.7V 1.8V Port I/O Interrupt Capability P1/P2 P1/P2 P1/P2 Some devices also P3/P4 Prog. Port Pin Drive Strength N/A N/A All port pins Prog. Pull-ups/-downs All port pins N/A All port pins Available MCLK Sources DCO LFXT1 XT2 (if available) VLO FLL LFXT1 XT2 (if available) N/A LFXT1 Available FLL Reference Clocks 2011/9/30 UCS FLL LFXT1 XT2 (if available) VLO REFO LFXT1, REFO, & XT2 (if available) Wireless Sensor Network And Labs fall 2011 44 MSP430 Roadmap FR57xx BGM, Catalog Production F53xx Development F51x2 16 MIPS 120 kB Flash 8 kB RAM 500 nA Standby 1.8 – 3.6V G = Value Line F = Flash FR = FRAM F23x0 F23x0 G2xx2 1xx-Catalog • • • • 8MIPS 60 kB Flash 10 kB RAM 1.8 – 3.6 V • • • • • • • F543xA F541x F15x-F16x F13x-F14x G2xx5 75+ devices 5xx-6xx F21x2 F20xx G2xx1 The New Generation RF USB F22xx F21x1 0.9V Native CC430 F552x F12xx FG461x Fx43x F44x F11xx Fx42x Fx42x0 F41x FE42x2 F41x2 Wireless Sensor Network And Labs fall 2011 25MIPS 256 kB Flash 16 kB RAM 1.8 – 3.6V FRAM, USB, RF 6xx: LCD Controller 160 uA/MIPS F471xx F43x Fx47x F47x4 USB L092 Lighting F261x F241x F23x-F24x 2xx-Catalog • • • • • F550x Gen Purpose 100+ devices 2011/9/30 FRAM F6/563x Device 100+ devices 4xx: LCD • • • • 16 MIPS 120 kB Flash 8 kB RAM LCD Controller, 160 segments • 1.8 – 3.6V 45 The eZ430 Family of MSP430 Tools The eZ430 is a tradition of low-cost, easy-to-use tools for MSP430 Options include RF, energyharvesting, RFID, even a wireless sports watch development kit! 2011/9/30 Wireless Sensor Network And Labs fall 2011 46 Programming Tools Parallel FET Supports ALL MSP430 devices Supports 4-Wire JTAG mode only Fixed output voltage of 2.8V No JTAG fuse blow Simple hardware circuit, possible to implement as part of a product USB FET Supports ALL MSP430 devices Supports 4-Wire and 2-Wire (Spy- Bi-Wire) JTAG Adjustable output voltage: 1.8 - 3.6V, 100mA JTAG fuse blow Fast operation 2011/9/30 Wireless Sensor Network And Labs fall 2011 47 Gang Programmer GANG430 2011/9/30 Wireless Sensor Network And Labs fall 2011 48 Target Boards for Device Programming 100-pin target board exclusive to the 2011/9/30 F543x(A) / F541x(A) devices Development board with 100-pin TSSOP (PW) ZIF socket (MSPTS430PZ5x100) All pins brought out to pin headers for easy access Programming via JTAG, Spy-bi-wire or BSL A FET board exists for most variants of MSP430 Only $49 Wireless Sensor Network And Labs fall 2011 49 MSP430 Software Tools Wireless Networking Protocols Z-Stack (CC2520 + MSP430F5438 ZigBee) TI-MAC SimpliciTI (on MSP430 MediaWiki) DASH7 Wireless M-Bus 6LoPAN Example Code for the MSP-EXP430F5438 Experimenter Board (www.ti.com/msp430tools) Drivers for hardware peripherals, LCD, USB conn. Operating Systems uC-OSII IAR PowerPac Salvo 2011/9/30 FreeRTOS Wireless Sensor Network And Labs fall 2011 50 www.ti.com/msp430 User’s Guides Datasheets Code Libraries 100+ Application Reports 1000+ Code Examples Product Brochure Latest Tool Software 3rd Party Listing Silicon Errata 2011/9/30 Wireless Sensor Network And Labs fall 2011 51 2011/9/30 Wireless Sensor Network And Labs fall 2011 52 Typical PC Program # include # define ……. 1. Other sub-functions () main () { do something; wait for input; terminate; } 2011/9/30 External response (mouse/keyboard) Wireless Sensor Network And Labs fall 2011 53 Typical Structure of Our Program # include # define ……. main () { System and Peripherals initialization for(;;) // forever loop { 1. wait for interrupt(sleep) 2. do something after return from interrupt } 1. Peripherals initialization routines () 2. Other sub-functions () Internal/External Events (ISR) Interrupt Service Routines () { 1. Quickly do something or Setting flags } } 2011/9/30 Wireless Sensor Network And Labs fall 2011 54 Initialization Configure hardware into a proper state How to configure set registers Registers each hardware subsystem has its own registers store configuration, status, buffer, and etc. set these registers properly in order to get it works How to set the registers properly MSP430x1xx family user ‘s guide 2011/9/30 Wireless Sensor Network And Labs fall 2011 55 Interrupt A specific internal/external event occur that suspend current program Mostly, it is defined by you some exceptions, for example – reset Usually, you have to handle it immediately You have to define how to react while this event occur 2011/9/30 Wireless Sensor Network And Labs fall 2011 56 maskable/non-maskable Non-maskable interrupts Interrupts that cannot be disable eg. reset, oscillator fault Maskable interrupts Interrupts that can be disable in the program Most of the interrupts you need to handle is maskable 2011/9/30 Wireless Sensor Network And Labs fall 2011 57 What happen when it occur 1. 2. 3. 4. main() { for(;;) { MCU is executing or sleeping } } Set interrupt flag Main program suspended Store state variables Jump to ISR (ISR) Interrupt Service Routines () { 1. Quickly do something or setting flags } 2. Restore state variables 3. Return to main program, resume process Interrupt flag: a special register indicates a particular interrupt occur State variables: information CPU will need to resume to normal processing 2011/9/30 Wireless Sensor Network And Labs fall 2011 58 Where to Jump Memory Map of MSP430 Interrupt vector a special segment in the memory store the address of the ISR by following code Address of Interrupt Vector #progma vector=0xFFFA __interrupt void Timer_B0 (void) where is the interrupt vector 2011/9/30 specified in datasheet Wireless Sensor Network And Labs fall 2011 59 More than one More than one interrupts occur simultaneously serve higher priority first When one interrupt is being serve, it will disable the other interrupts means the other ISR cannot execute before this one finish if more than one occur while serving one interrupt wait until it finish, serve the highest priority one first You can enable interrupt in the ISR not recommended 2011/9/30 Wireless Sensor Network And Labs fall 2011 60 Masked twice While interrupt A is being serve, interrupt B occurred, twice when interrupt A is finished, the ISR of interrupt B will be serve, only once you miss one event!! KEEP YOUR ISR SHORT!!!! 2011/9/30 Wireless Sensor Network And Labs fall 2011 61 Protect Your Data Example: Packet receive interrupt occurred { 1. packet stored in a receive buffer 2. copy receive buffer to temporal buffer 3. return } In main program {In main program { 1. disable global interrupt 1. copy temporal buffer to some data structure 2. 2. enable processglobal data interrupt 3. } 4. process data } 2011/9/30 Wireless Sensor Network And Labs fall 2011 Another packet receive interrupt occurred in the middle of copying data 62 Software Architectures Round Robin with Interrupts for(;;) // forever loop { 1. wait for interrupt(sleep) if( Event 1 occurred) { do something } if( Event 2 occurred) { do something } if( Event 3 occurred) { do something } } Problem: no proirity 2011/9/30 (ISR) Interrupt Service Routines 1 () { 1. do critical things 2. set event 1 occurred flag } (ISR) Interrupt Service Routines 2 () { 1. do critical things 2. set event 2 occurred flag } (ISR) Interrupt Service Routines 3 () { 1. do critical things 2. set event 3 occurred flag } Wireless Sensor Network And Labs fall 2011 63 Software Architectures Function-Queue-Scheduling for(;;) // forever loop { 1. wait for interrupt(sleep) While (function queue is not empty) { call first function on queue } } (ISR) Interrupt Service Routines 1 () { 1. do critical things 2. put function_1 on queue } (ISR) Interrupt Service Routines 2 () { 1. do critical things 2. put function_2 on queue } (ISR) Interrupt Service Routines 3 () { 1. do critical things 2. put function_3 on queue } Worst wait for highest priority task bounded by the longest function 2011/9/30 Wireless Sensor Network And Labs fall 2011 64 Software Architectures Real-Time Operating System (RTOS) load an operating system into the MCU there are many RTOS available it is beyond the scope of this class 2011/9/30 Wireless Sensor Network And Labs fall 2011 65 How To Program FET (Flash Emulation Tool) A tool that allow you to program and debug MSP430 Connects to the JTAG port on MSP430 A generic term used in MSP430 world JTAG (Joint Test Action Group) IEEE 1149.1 standard: “standard Test Access Port and Boundary-Scan Architecture” A standard interface defined for testing and debugging 2011/9/30 Wireless Sensor Network And Labs fall 2011 66 Video 2011/9/30 Wireless Sensor Network And Labs fall 2011 67 TinyOS “System architecture directions for network sensors”, Jason Hill, Robert Szewczyk, Alec Woo, Seth Hollar, David Culler, Kristofer Pister . ASPLOS 2000, Cambridge, November 2000 System software for networked sensors Tiny Microthreading Operating System: TinyOS Component-based Event-driven TinyOS is written in nesC programming language 2011/9/30 Wireless Sensor Network And Labs fall 2011 68 Why TinyOS? TinyOS is very powerful Modern operating system and language techniques in an embedded system A lot of libraries, support code, and community development “TinyOS has a steep learning curve” It can take time to use all of its capabilities 2011/9/30 Wireless Sensor Network And Labs fall 2011 Slides from TinyOS-IPSN2009 69 nesC nesC programming language An extension to C Designed for sensor network nodes Basic concepts behind nesC Separation of construction and composition Many components, “wired”(link) those you want Component provide a set of interfaces Interfaces are bidirectional Command (down call), event (up call) nesC compiler signals the potential data races 2011/9/30 Wireless Sensor Network And Labs fall 2011 70 Support Multiple Platforms Hardware platforms eyesIFXv2, ETH Zurich TI MSP430F1611, Infineon TDA5250 Intelmote2, Intel PXA271 XScale Processor, TI (Chipcon) CC2420 Mica2, UCB Atmel128, TI (Chipcon) CC1000 Mica2dot, UCB Atmel128, TI (Chipcon) CC1000 Micaz, UCB Atmel128, TI (Chipcon) CC2420 Telosb, UCB (Taroko) MSP430F1611, TI (Chipcon) CC2420 Tinynode, EPFL Switzerland MSP430F1611, Semtech radio transceiver XE1205 Three different microcontrollers, four different radio transceivers and many other peripheral ICs 2011/9/30 Wireless Sensor Network And Labs fall 2011 71 Contiki Contiki – a dynamic operating system for networked embedded systems Loadable modules, multiple network stacks, multiple threading models Open source; 3-clause BSD licence Small memory footprint Designed for portability 14 platforms, 5 CPUs in current CVS code Many pioneering features Provides IP communication, both for IPv4 and IPv6. 2011/9/30 Wireless Sensor Network And Labs fall 2011 72 Demo http://www.youtube.com/watch?v=ievpE6nkj0Q 2011/9/30 Wireless Sensor Network And Labs fall 2011 73 2011/9/30 Wireless Sensor Network And Labs fall 2011 74 Something To Note You won't get very far without at least a very rudimentary understanding of electronics But electronics is a vast and complex field What we provide here is just some very basic principles We assume you have some common sense about electronics We will try to make it as simple as possible 2011/9/30 Wireless Sensor Network And Labs fall 2011 75 Voltage, Current and Power Voltage Symbol: V Unit: Volt, (V) Current Symbol: I Unit: Ampere, (A) Power P=V*I Unit: Watt, (W) 2011/9/30 Wireless Sensor Network And Labs fall 2011 76 DC and AC DC: Direct Current Definition: current that travels in one direction we usually refer to constant voltage AC: Alternating Current Definition: opposed to DC we usually refer to varying voltage DC component vs AC component DC component: average of signal AC component: the varying signal 2011/9/30 Wireless Sensor Network And Labs fall 2011 77 Relationship between V and I Ohm’s Law V=I*R Resistor Most widely used element Symbol: R Unit: Ohm (Ω) Schematic symbol: Variable resistor 2011/9/30 Wireless Sensor Network And Labs fall 2011 78 Resistors in series Resistors in series R = R1 + R2 = I1 I 2011/9/30 V1 I2 V V2 R1 V1 V R1 R 2 R2 V2 V R1 R 2 I I1 I 2 Wireless Sensor Network And Labs fall 2011 79 Resistors in parallel Resistor in parallel R = I1 I2 I 2011/9/30 V1 V2 V 1 1 R1 1 R2 R1 R2 R1 R2 V V1 V2 V R2 I1 I R 1 R 1 R 2 V R1 I2 I R 2 R 1 R 2 I I1 I 2 Wireless Sensor Network And Labs fall 2011 80 Capacitors Capacitor store charge Symbol: C Unit: Farads (F) Typical range we use is from μF to pF Circuit symbols Bipolar: no polarity Unipolar: has a positive and a negative lead 2011/9/30 Wireless Sensor Network And Labs fall 2011 81 Charge and discharge Apply a voltage charging Remove voltage discharging Provide a temporary voltage and current source Decoupling Stable the DC voltage source 2011/9/30 Wireless Sensor Network And Labs fall 2011 82 Diodes Pass a current in one direction, block it from another Symbol: D Forward voltage drop Vanode Vcathode A voltage different between anode and cathode Example For a typical voltage drop of 0.7V If Vanode is 3.3V, than Vcathode is 2.6V This value will be specified in datasheet 2011/9/30 Wireless Sensor Network And Labs fall 2011 83 LEDs Light-emitting diode (LED) Limited amount of current can pass through Will damage if current is too large Need a current-limiting resistor I R 3.3V Vanode Vcathode Ground Vcathode 3.3V Vvoltage_ drop 1.7V R V 1.7 85 I 0.02 If voltage drop of this LED is 1.6V, and we want 20mA pass through 2011/9/30 Wireless Sensor Network And Labs fall 2011 84 Other components Crystals Symbol: X, Y Switches symbols: SW Inductors symbol: L 2011/9/30 Wireless Sensor Network And Labs fall 2011 85 Understanding Schematic Net Labels Component Power Ports 2011/9/30 Nets Crossing Wireless Sensor Network And Labs fall 2011 Nets Cross Multiple Sheet 86 Real Schematic -- Taroko 2011/9/30 Wireless Sensor Network And Labs fall 2011 87 Reading Datasheet Every component should have a datasheet Contain every information about the component If you are designing you own embedded system Read it thoroughly and feel you understand Go back and reread it Get the latest datasheets and errata Lets take a look at the MSP430F1611 datasheet 2011/9/30 Wireless Sensor Network And Labs fall 2011 88 Next Two Labs Lab 1: GPIO Control LEDs Reading switches, keypads input Lab 2: Timer Generate different time interval Generate PWM signal, control servo motor 2011/9/30 Wireless Sensor Network And Labs fall 2011 89 LEDs This is a typical connection When P1.1 set to high DVcc = VP1.1 no current flow DVcc Vanode Vcathode When P1.1 set to low VP1.1 = 0 Current flow through, turn on the LED R GPIO can use as an On/Off control 2011/9/30 Wireless Sensor Network And Labs fall 2011 90 Switches A B Operation Open: A and B are not connected in normal state Close: When you press the button, A and B are connected Typical circuit When the switch is open, voltage of USERINT stay at high When the switch is close, voltage of will be low 2011/9/30 Wireless Sensor Network And Labs fall 2011 91 Keypad This is a 3x4 matrix keypad When you press a button, a pin in X and a pin in Y is connected How to interface to MSP430? 2011/9/30 Wireless Sensor Network And Labs fall 2011 92 Next Two Labs Lab 1: GPIO Control LEDs Reading switches, keypads input Lab 2: Timer Generate different time interval Generate PWM signal, control servo motor 2011/9/30 Wireless Sensor Network And Labs fall 2011 93 Time Intervals Generate different time intervals Flash different LED with different time interval 2011/9/30 Wireless Sensor Network And Labs fall 2011 94 Robot Car Servo motors Robot Power (Vcc) Red Robot Ground (GND) Black Robot Signal White Battery Ground Black Battery Power Red 2011/9/30 Wireless Sensor Network And Labs fall 2011 95 Pulse Width Modulation Pulse width Pulse Period Pulse Width Modulation (PWM) varying the pulse width Usage of PWM Control motor, telecommunication, voltage regulation, and etc. 2011/9/30 Wireless Sensor Network And Labs fall 2011 96 Servo Motor A PWM input controls it angular position Pulse width = 1.5 ms; position = 90o (neutral) Pulse Example Pulse width pulse width = 1.25 ms; position = 0o pulse width = 1.75 ms; position = 180o Varies between brands and models The servo motor we used is Continuous Period ≈ 20 ms Rotation model Other models will just move to the programmed position and stop 2011/9/30 Wireless Sensor Network And Labs fall 2011 97 Control Servo Motor Pulse width Pulse Period ≈ 20 ms The servo motors we used are 1.5 ms neutral If pulse width = 1.5 ms stop If pulse width > 1.5 ms rotate in one direction If pulse width < 1.5 ms rotate in another direction 2011/9/30 Wireless Sensor Network And Labs fall 2011 98 Install IAR We will begin our labs next week Install the programming software ahead Go to www.ti.com Click Microcontroller In MSP430 menu, click Tools & Software Find IAR-KICKSTART and click on it Download software and install 2011/9/30 Wireless Sensor Network And Labs fall 2011 99