Home > Blog > Thunderheads > Thunderheads: July 2011

Thunderheads: July 2011

Project Log
— Internet-Enabled Arduino —
For this demo I wanted to show how easy it is to modify an existing Arduino project to receive serial commands through a mobile web application usingXBee® ZB modules and the iDigi® Device Cloud™. About the Author —
Mark Geller is an iDigi Application Developer. He has several years’ experience in programming and application development.

Parts List

  • 1 Arduino board
  • 5-8 LEDs
  • 5 220 ohm resistors
  • 1 breadboard
  • 1 XBee breakout board with headers
  • 1 XBee ZB OEM module
  • ConnectPort® X4 gateway
    (or ConnectPort® X2)
  • hook-up wire


Getting Started
I approach most iDigi projects by breaking them down into four milestones:

  • XBee-enable a remote device
  • Configure iDigi® Dia to talk to remote device
  • Use iDigi web services to talk to remote device
  • Build website that uses iDigi web services to talk to remote device

I do quick system checks at each milestone to make sure that everything is working as expected.

For this project, I started with the SwitchCase2 tutorial from the Arduino website. This example combines blinking LED lights, which are always fun, with simple serial communication.

XBee-Enable Remote Device
The first step for adding XBee communication to a project is configuring the XBee module. The ConnectPort X4 gateway is acting as the coordinator for this network, so the XBee module on the Arduino needed to have either router or end device firmware. Using X-CTU, I loaded ZigBee Router AT firmware (2270). We have a lot of XBee modules in use at Digi, so I configured the module with a unique PAN ID as well. I kept the default serial interfacing options:

Baud: 9600Data: 8 bitParity: NoneStop bits: 1Flow Control: NoneI didn’t need to modify the sketch running on the Arduino to enable serial communication over XBee; I just needed to connect four pins to the Arduino board. For power, I connected pin 1 on the XBee module to the 3.3 V output on the Arduino and pin 10 on the XBee module to the ground connection on the Arduino. I connected pin 2 (TX/DOUT) on the XBee module to digital pin 0 (RX) on the Arduino and pin 3 (RX/DIN) on the XBee module to digital pin 1 (TX) on the Arduino to establish the serial connection.

I hooked up a few extra LEDs to the XBee module to make it easier to confirm that it is powered and receiving data. An LED on pin 6 (positive lead to the XBee pin with negative lead to ground) will light when the module receives data that is addressed to it. An LED on pin 13 will light up when the module is on. An LED on pin 15 will stay on as it tries to join a network and blink once it has associated itself to an XBee network. Since I configured my ConnectPort X4 gateway with the same PAN ID as the XBee module, it automatically joined when I powered up the Arduino board.

Configure iDigi Dia to Talk to the Remote Device
I used a ConnectPort X4 gateway to handle communication with both the Arduino board and with iDigi Device Cloud. I went to www.idigi.com, created a free developer account, associated my gateway to my developer account and configured my gateway to connect to my account.

I decided to use iDigi Dia on the ConnectPort X4 gateway to handle sending and receiving commands to the Arduino. The iDigi Dia software is designed to make ZigBee communication with XBee ZB modules simple. Using Digi ESP™, which is an Eclipse-based development environment, I created a new iDigi Dia project named “XBee Serial Demo.” I added an XBee serial terminal device driver to my project, compiled the project and uploaded it to my ConnectPort X4 gateway. The dia.yml file for my project looked similar to what is shown below:

     - name:xbee_device_manager
     - name: xbee_serial_terminal0
          xbee_device_manager: ”xbee_device_manager”
          extended_address: ”00:13:a2:00:00:00:00:00!”
     - name:rci
     - name: idigi_db
          interval: 5
          sample_threshold: 20
          collection: ”collection_name”
          filename: ”file_name”
     - name: console0
     - name: web0
         page: ”idigi_dia.html”

Once I launched the python program on the ConnectPort X4 gateway, I was able to send serial commands to the Arduino using the built-in web console:


Coming Soon…
In the second part of this project log I will demonstrate how to use iDigi web services to connect to the Arduino board and how to build a mobile website that uses those web services.

Meet the iDigi Applications Team
— Mark Geller, Application Developer —

I started my career as a variable data print programmer at a print company in Lindon, Utah. While working at the print company, I learned how to create websites that leverage web services using ASP 3, ASP.NET and Adobe Flash.

Three years later I left the print company and joined MaxStream as a PHP web programmer and search engine marketing specialist. My first tasks were to redesign the MaxStream website, market our XBee modules and help organize the firstWaveForum Developer’s Conference. About one year after I joined MaxStream, Digi International® acquired us. I moved to the corporate headquarters in Minnetonka, Minnesota and continued working as a web and Flash programmer for our Digi® and Rabbit® websites.

I started working on iDigi applications just before we announced the launch of the iDigi Device Cloud at ESC a few years ago. Since then I have built a number of iDigi applications and demos using PHP, ASP.NET, Java, Python, HTML, and Flash. I look forward to building more iDigi applications and seeing how the iDigi Device Cloud evolves.

Share Your Ideas
One of the best parts of being part of the iDigi Applications Team is hearing about the interesting ways people are using the iDigi Device Cloud. If you have an application, story request or questions, please contact us at thunderheads@digi.com.

Upcoming Events
WaveForum Developer’s Conference
Westin Hotel, San Diego, CA
August 3-5, 2011

The WaveForum Developer’s Conference is coming to San Diego. Digi is offering three days of interactive education focused on communicating with remote devices and management solutions using device cloud networking.


Register today to take advantage of some great discounts off the price of registration and lodging.

Use coupon code JULY11 to save $100 at registration — that’s just $595 after discount for expert education, networking events, meals and more!
The Westin San Diego is offering a $155 per night room rate for WaveForum attendees — availability is limited. Visit the lodging section on the WaveForum registration page to lock in your rate.



iDigi Updates
— Projects, News & Notes —

First Prize — The iDigi Device Cloud received first prize in the Industrial IT category of the “Palmarès Technologique 2011” awards. This award recognizes the most outstanding innovation of the year in the industrial IT sector.

Smart Grid Application — Efficient Energy America, Inc.(E2America) is using theiDigi Device CloudConnectPort X4 gateways and XBee ZB modules to wirelessly enable the E2 intelligent commercial building control system. More >

Storage Tank Management — TankScan is using ConnectPort X cellular and Ethernet gateways with the iDigi Device Cloud, enabling access and management of remote tank information from anywhere in the world. More >

iDigi Garden — Our self-regulating, self-maintaining irrigation system uses XBee modulesConnectPort X gateways and the iDigi Device Cloud in combination with a variety of sensors, regulators and other monitoring and control devices to maintain optimum moisture levels, even in the July heat.


Stay up-to-date with the latest news and information.
Follow Digi on TwitterFacebook and YouTube.

Leave a Reply

Contact a Digi expert and get started today! CONTACT US

Desktop Site