Wireless Arduino Programming

Remotely program an Arduino using a XBee wireless connection.

For an upcoming project (some Christmas lights) I need to place an Arduino in an out of the way place (attached to the soffit/fascia of my house) and be able to continue to modify the code running on it from the comfort of my desk. Time for a wireless programming link!

I've tried several approaches to this and found the simplest solution yet. If you have an Arduino Duemilanove (not an UNO!) and a XBee with shield you can use the XBee to reprogram the Arduino with only one small hardware modification.

Required Parts

1 Arduino Duemilanove
1 XBee shield (XBee Shield)
2 XBees (XBee 1mW Chip Antenna - Series 1)
1 USB to XBee serial board (USB XBee Adapter)

Required Software

Arduino IDE
X-CTU (simplest method, Windows only),
OR a terminal client (difficult method, all other platforms)

Please read Limor Fried's XBee Adaptor - Connecting, Configuring & Upgrading if you aren't familiar with using either X-CTU or a terminal client to configure XBee adaptors.

Configure the Receiver

  • Put one of the XBees in the USB to serial board and hook it up a computer.
  • Using X-CTU or a terminal client make the following changes to the XBee's settings:
    X-CTU Description X-CTU Setting Terminal Command
    Reset to defaults - ATRE
    Interface Data Rate 6 - 57600 ATBD 6
    PAN ID 1324 ATID 1234
    16-bit Source Address 0 ATMY 0
    Destination Address Low FFFF ATDL FFFF
    DIO3 Configuration 3 - DI ATD3 3
    DIO Change Detect 8 ATIC 8
    XBee Retries 3 ATRR 3
    Packetization Timeout 10 ATRO 10
    Write Changes - ATWR
    Exit Command Mode - ATCN
  • Now remove the XBee from the USB to serial board and place it on the XBee shield and connect the shield to the Arduino.

Configure the Transmitter

  • Solder a jumper between DIO3 and RTS on the USB to serial board.
  • Connect the other XBee to the USB to serial board and connect it to a computer.
  • Using X-CTU or a terminal client make the following changes to the XBee's settings:
    X-CTU Description X-CTU Setting Terminal Command
    Reset to defaults - ATRE
    Interface Data Rate 6 - 57600 ATBD 6
    PAN ID 1324 ATID 1234
    16-bit Source Address 1 ATMY 1
    Destination Address Low 0 ATDL 0
    DIO3 Configuration 5 - DO HIGH ATD3 5
    I/O Output Enable 0 ATIU 0
    I/O Input Address FFFF ATIA FFFF
    Packetization Timeout 10 ATRO 10
    Write Changes - ATWR
    Exit Command Mode - ATCN

Upload Some Code

  • Connect the USB to serial board to the computer and the Arduino to an external power source.
  • Run the Arduino IDE and open a sketch to upload.
  • Select the correct model of Arduino and serial port from the 'Tools' menu.
  • Click the upload icon to start the transfer.
  • If the first attempt fails, click the upload icon while holding the shift key to start a transfer in debug mode, which sometimes can work when a normal upload doesn't.

What's Happening With DIO3?

In order to reset the Arduino, DIO3 needs to be tied to RST with a capacitor. I found out through trial, error and help that the Sparkfun XBee shield already has this set up. So if your using the Sparkfun shield no additional wiring is necessary, but with other shields you'll need to add the capacitor.

What About the UNO?

For an approach using the UNO, please see Justin's comment below.

I've tried this approach with the UNO and the Duemilanove and found that only the Duemilanove works. My best guess is that this either has to do with the UNO's higher programming speed 115200 vs 57600 or the UNO's new USB-to-serial chip which might somehow interfere.

I've already tried setting up the XBees with the higher baud rate so I'm thinking that there is something else compounding the problem, like the aforementioned USB-to-serial chip. If you have any insight on how to get this working with the UNO please let me know.

Resources

30
Apr 2011

Arduino GPS System Version 2.0

I've been working on the code for my Arduino GPS System over the past couple of days and am pleased to announce some new features.

The one thing which has been bugging me is that the system lacked any ability to store location data. This was annoying since if you wanted to save some coordinates you needed to write them down, and key them in manually if you wanted to visit the location later.

In order to remedy this, you can now input up to 20 way-points into memory so you don't need to write anything down. The way-points are held in the Arduino's EEPROM so they are persistent between power cycles. This means I no longer need to carry a pen and paper inside the case with my GPS receiver.

To further support using way-points, I also implemented a simple backup routine so you can save your way-points and configuration settings to a computer.

The updated code can be downloaded at the Arduino GPS System project page.

24
Jan 2011

Another Year, Another Freeday

After last year's wildly successful (for me at least) Freeday, Sparkfun electronics once again decided to give away a large portion of their inventory. This year they raised the amount up for grabs to $150,000 but you had to earn your discount by answering a series of questions about electronics. Before the money was all claimed, I managed to answer six questions correctly and earned $60 of credit at their store.

This year I purchased a shield and two XBee radio modules so that I could create some wireless Arduino projects. Currently the plan is to create a fully programmable Christmas light display for the house where you can set the colour and brightness of each individual bulb and create your own animations. I really look forward to having the best Christmas light display in the neighbourhood next Christmas.

24
Jan 2011

2011 Freeday Order

9
Jan 2011

Sparkfun Free Day Order

15
Nov 2010

The Beat Blender

Please take a moment to consider the Beat Blender.

Matti Niinimäki found a blender at a flea market and noticed that the mixing modes corresponded to DJing terminology. He added an Arduino controlled RFID reader to the blender so he could DJ by inserting felt fruit pieces with embedded RFID chips into the blender. The buttons on the blender were also re-purposed to control the mixing modes. The Arduino relays the information regarding the fruit in the blender to a computer which then does the corresponding audio work.

The end result of this is simply stunning: DJing using nothing more than kitchen appliances.

3
Sep 2010

Geocaching is Fun

On Wednesday Amara, Ben, Emily and I went geocaching in the wilderness of Charleswood.

Geocaching is a "sport" where people hide containers in parks and other places and place the coordinates of the containers online. Other people then download the coordinates and use GPS receivers to attempt to locate the containers and sign an enclosed guest book. Some containers have small toys which you can exchange assuming you had the presence of mind to bring one with you when you left.

To make this extra nerdy, we used my home built GPS receiver. We set out with the locations of four caches written down and managed to locate two of them. We didn't spend much time looking at each location due to an abundance of mosquitoes, but managed to find the easier caches.

I enjoyed the hunt and would definitely like to go geocaching again. If you want to learn more about geocaching, I recommend you visit http://www.geocaching.com which has excellent explanations and a huge databases of caches waiting to be found.

1
Sep 2010

Geocaching with Arduino

12
Jul 2010

Arduino Stacking Example

12
Jul 2010

Technologic