Introduction: Wireless Programming of Arduino

About: I am an application engineer for an industrial distributor. I help to support our sales team in programming of new projects for our customers. I enjoy working on hobby electronics in my free time, mostly with …
I have been building robots for a few years now and one of the things that I have found most frustrating is during testing and debugging. There always seems to be a need for a USB cable which can get in the way and limit the distance that your robot or other project can go or you will have to chase it down just to change one little line of code. I have been using cheap HC-06 bluetooth modules for control and debug but I have not been able to use them to actually program an Arduino. I have heard of using Xbee modules for wireless programming and have found a couple good tutorials for it on SparkFun and Adafruit, but both of these seem a little dated so I am going to attempt to make things a little simpler and more up to date.

Step 1: Materials Needed

Step 2: Setting Up the Receiving Xbee

The Receiving Xbee is going to be the one that will eventually plug into the Xbee Explorer Regulated which will be attached to the Arduino. After you have the X-CTU software installed, insert your receiving Xbee module onto the Xbee Explorer Dongle and insert it into an available USB port on your computer. Windows should automatically find and install the driver for it. Keep note of what COM port the installer says that the module is on.
After the device has successfully installed, open the X-CTU software.
  1. Choose the COM port from the list that corresponds to your Xbee Explorer Regulated.
  2. If this is a new Xbee, select the baud rate option for 9600, otherwise choose the appropriate.
  3. All other parameters should be the same as default.
  4. Click the 'Test / Query' button to check that you have a good communication with the device.
  5. If you get an error message, check your COM port and make sure that your Xbee module is plugged in properly.
  6. Click on the 'Modem Configuration' tab in the X-CTU software.
  7. Click the 'Read' button to load in all of the current parameters for your Xbee module.
  8. Before changing anything, we need to find out what the upload speed is for our specific board. You can find that information here on my Blog Spot. Once you have this information, we can reconfigure our Xbee module.
  9. In the X-CTU software, we will want to create a personalized PAN ID. This is any 4 digit HEX number that will be used to link your two Xbees. Remember the number that you use here as you will need it again for the transmitter.
  10. Set the 'Interface Data Rate' to the baud rate that we determined in step 8.
  11. Set the 'Packetization Timeout' parameter to 10.
  12. Turn DIO3 into an input by setting 'DIO3 Configuration' to 5 - DO HIGH.
  13. Change 'I/O Output Enable to 0 - DISABLED.
  14. Set 'I/O Input Address' to FFFF.
  15. Click the 'Write' button and the new settings will be loaded onto your Xbee Module. To check that the settings were loaded you can go back and change the baud rate on the main screen of the X-CTU software then do another read for your module.
Now it's time to program the transmitter. Unplug the dongle and replace the receiver Xbee with the transmitter one.

Note: Each Xbee can be either a transmitter or a receiver, there are NOT different modules for each.

Step 3: Setting Up the Transmitting Xbee

Once you have the transmitting Xbee in your Xbee Explorer Dongle and it is plugged into your computer, go ahead and read the data from it as we did with the previous one. The default baud rate will be 9600 unless it has been previously changed.
  1. The 'PAN ID', 'Interface Data Rate', and 'Packetization Timeout' settings are all going to be the exact same as we did for the receiver.
  2. Set 'DIO3 Configuration' to 3 - DI.
  3. Set 'DIO Change Detect' to 8.
  4. Once this is done we can go ahead and click 'Write' to update the module.
  5. We will need a jumper between pin D3 and RTS. What I have done instead of soldering a jumper is I have put right angle headers on my Dongle and just used a pin head jumper but any method of connecting the two pins will work.
  6. Once your module is plugged back into your computer, we will need to change some settings in the Device Manager so go ahead and open your computers Device Manager. This step is only for Windows users.
  7. Find your device under the Ports (COM & LPT) section, right-click and select properties.
  8. Go to the Port Settings tab and click the 'Advanced...' button.
  9. In here all that you need to do is make sure that the check box for 'Set RTS On Close' is checked.
  10. Save the changes and you're done.

Step 4: Programming Your Wireless Arduino

Programming on the Pro series of Arduino is very simple. If you are using the Sparkfun Xbee Explorer Regulated then you will not need to do anything to this module except to put some headers on the programming end of the board. Pin D3 is already tied to DTR so we don't need any jumpers here. Just plug in your Xbee Explorer Regulated with the receiver Xbee into your Arduino Pro. I use cheap Arduino knock offs from eBay so I have to plug mine is upside down, just check the silkscreen to make sure that you are plugging it in correctly. All you should need to do now is plug in power to your Arduino and check that the Xbee module is getting power.
In the Arduino IDE everything is the same as programming normally, just make sure that the COM port that you are using is the one that corresponds to the Xbee Explorer Dongle.

Enjoy your new wireless programmer!!

Step 5: Using Non-pro Series Arduino

If you are not using an Arduino Pro or Pro Mini then you will need a little bit of extra hardware. An NPN transistor, a 10k resistor and a 0.1uF capacitor. Connect this in the way shown on the Adafruit website. Check the picture for a simple schematic.