Wednesday, April 20, 2011

A Wireless Control Project Using Zigbee for Temperature Control





About
This is an effort for me to explore wireless communication for embedded systems. This project targets on wireless control using Zigbee modem. The theme is temperature feedback control. Special thanks to Raymond.Y and Ajay.K who were my partners working on this project in April, 2011; also thanks to Avnish.A for this advice on this project and the knowledge of wireless communication protocols.


The idea of zigbee is that it is a wireless communication protocol with low-power consumption targeting on the usage such as home/factory automation. I have a separate post to compare different wireless protocols.




Project Specifications
  • Automatically detect and configure Zigbee nodes
    • Analog IO at rate of one sample per 10 secs.
    • End nodes must sleep for maximum battery life
  • Maintain database of nodes
  • Report to the console every minute
    • Data reported by ND
    • Latest temperature for nodes
    • Flag nodes with temperature change in past minute
    • Flag nodes with temperature above threshold




Hardware Design
This is a brief video walk through of the hardware design:




Software Design
Display (every 20 seconds) :
  • MY  MY address
  • SH  SH address
  • SL  SL address
  • TEMP  Most recent temperature in deg Celcius
  • CHG  1: change in 1 deg at any time since last print
  • Alert  1: temperature > 35 at any time since last print
  • IR  1: node acknowledged sample rate program
  • D0  1: node acknowledged ADC program
  • Retries number of retry attempts for failed IR or D0
  • UPD  1: node gave a temp update since last print
  • ACT  1: node is alive and active
System Internal Loop :
Packet Processing Flow Chart:
Database Structure for a Single Node:
  • SOURCE_ADDRESS
    • 10 byte address  MY:SH:SL
  • TEMP
    • Temperature in Celcius
  • NUM_RETRIES
    • Number of retries to program node
  • Flags
    • ACK_IR
      • Node successfully programmed Sample Rate
    • ACK_D0
      • Node successfully programmed ADC
    • UPD
      • Node updated in last minute (since last console print)
    • ACT
      • Node responded to ATND in last minute
    • CHG
      • Temperature changed by greater than 1 deg since last reading
    • ALERT
      • Temperature above threshold


System Scalability

  • For large number of nodes ATND network maintenance may take away from sensor bandwidth
    • Trade-off of how often you want to keep network list current
  • Currently static array of 1024 nodes
  • Number of nodes limited by update cycle time
    • Update cycle must have enough time for all nodes to get back to coordinator
    • Coordinator assumes nodes that don’t respond in that time are inactive
  • Star network limited to bandwidth of coordinator
    • More nodes could be supported if routers had intelligence to monitor their own children and update coordinator only periodically.


Challenges

  • Hardware does not always maintain settings after power off and power on
    • D0 value reset to 0
  • Frame sizes change for ATIR depending on the range of the sample rate.
    • 1 byte for 255ms
    • 2 bytes for greater than 255ms (we needed this for 10 secs)
  • Printf for hex values interpreted as signed values add ffffffff before
    • Corrected by changing packet data to unsigned
  • Nodes sometimes take a very long time to respond to ATND


DEMO