180 likes | 289 Views
Data Collection U sing Z igbee Network. Timothy Melton Moscow, ID. Introduction. Problem: I wanted a way to monitor analog inputs to microcontrollers using a zigbee wireless network with a central gathering point
E N D
Data Collection Using Zigbee Network Timothy Melton Moscow, ID
Introduction • Problem: I wanted a way to monitor analog inputs to microcontrollers using a zigbeewireless network with a central gathering point • Solution: Using three xbee brand transceivers and two pic32 microcontrollers I was able to setup a short range network for data monitoring and collection
Hardware • 3 Xbee 1mW w/Chip Antenna zigbeetranceivers • 1 XBee Explorer USB • 1 Personal computer w/serial terminal • 2 pic32mx4 microcontroller experimenter boards
Xbee Transceiver • RF Data Rate: 250 kbps • Indor/Urban Range:100 ft (30 m) • Transmit Power: 1 mW (+0 dBm) • Frequency Band: 2.4 GHz • Interfaces: I2C, SPI, UART • Uses Zigbee communication standard • IEEE 802.15.4
PIC32MX4 • Max Speed MHz: 80 • Program Memory Size (KB): 512 • RAM (KB): 32 • A/D channels 16 • RTCC Yes • UART 2
Microcontroller layout Transmitter 2 (z2) Transmitter 1 (z1)
Collection layout Collection Unit
Configuration • Microprocessor recievers • Set as endpoint device on network • Harcoded to send to router • UART to transceiver • 9600 BAUD • No flow control, 8-bit, no-parity, 1 stop bit • UART receive interrupt • Collector • Set as router • Broadcast messages • Transceiver to serial • Matching serial configuration in terminal
Method • Microcontroller units • Addressed z1 and z2 • Read ADC measurements every second • Attach time to the measurments • Use fprintf statement to write to a buffer • Record past three readings • Wait for go signal from collector • Broadcast last three readings • Collector • Broadcasts go command with specific address • Recieves data from zigbee through uart into terminal • Displays readings in terminal
Method Continued • Since the microcontroller has a realtime clock and calendar getting the time was a matter of initalizing the time and then polling and storing it to a variable for the printf function • A polling timer was setup to check whether the one second ADC sample delay was met • To put the packet together for sending: fprintf(uartbuff, “z1:: %d:%d - r1:%5.3f r2:%5.3f r3:%5.3f\r\n” hour, min, adc1, adc2, adc3); “z1:: 14:22 – r1:01.334 r2:02.454 r3:05.287” • packet is generated each time the adc is read • Uartbuff3 = uartbuff2; uartbuff2 = uartbuff; • then assign to uartbuff each time through to keep track of last three readings.
Method Continued • The Collector will send out command: zx go where x is the microcontroller address • A UART receive interrupt is generated in both receivers • Receivers parse which receiver is getting the go signal • Appropriate receiver sends three buffers to collector
Problems • Configuring XBEE transceivers • Firmware flashing issues • Only certain available firmwares were able to be flashed • Working firmware limited network setup • Only able to implement router and endpoint configuration • Support for newer firmware hidden
Areas for Improvement • Buying better xbeetrancievers • Newer models • Support more features (xbee pro, encryption, mesh networks) • More expensive models • Support longer ranges and have more antennae options • Collector time logging • Takes the burden off of the micro for keeping track of time • Prevents transmitting data from interfering with time information • Would keep track of when received instead of when gathered • Writing a program to collect data • Enables better storage options • Terminal outputs to screen • Enables parsing of data for better usage/readability
Conclusion • Zigbee provides many options for setting up wireless networks • UART communication is an effective means to interface with transceivers • PIC32MX4 is very capable of receiving analog inputs and packetizing the data to be transferred over Zigbee.