This documentation explains how to set up a working wireless connection between an Arduino Circuit and a computer, using the popular XBee Radios. On a computer side, a Jitter patch is running on MaxMSP application. This application is going to talk to an Arduino Circuit that is sending values from its attached sensors. Hopefully they can talk to each other without any wires between them!
Wired to Wireless
I have successfully established a serial communication between an arduino circuit and a Jitter patch on a Mac. For the serial communication, my Arduino circuit is connected to the Mac via a USB cable. Problem is that my Mac is also connected to a projector and there are too many wires! I’d like to remove the USB cable so that the computer and the projector can stay together and Arduino circuit can be placed with some distance from them.
My trial with Bluesmirf was not so successful. It could very well be because of my ignorance but it seemed that I had to establish the pairing between the circuit and the computer every time. In other words, it didn’t support plug and play (for me). 🙁 I wanted the serial communication to be simpler and easier, just like any other USB communication so I thought of giving it a shot at XBees, to see if it works better for my purpose.
A Computer with
1. Arduino Software Installed
2. In my case, Max MSP Jitter Installed
3. FTDI Driver Installed
4. Coolterm Installed
Above is the software setup for my mac. If you have a(n extra) PC with you, it’s good to have X-CTU software (PC only) installed for troubleshooting. But you won’t need it unless your Xbees dont seem to respond, so let’s not worry about it right now.
I have an Arduino Diecimila.
(Photo from Sparkfun)
I got two XBee Pro 60mW Chip Antenna – Series 1. ($37.95/each)
One downside is that you have to solder a total of 42 pins ( (10+11)x2 ) that are spaced very narrowly and it takes some time and skills to do it correctly. This document shows how to solder the pins but in I found that it’s easier to solder the 11 pin headers before getting into the narrower 2 mm sockets.
Here, I’m including the wiring of Xbee Adapter to Arduino, since the 10 pins (XBee) to 11 pins (Apapter) conversion was a little bit confusing to me. You can click it to see a bigger image.
If you are not interested in building this, you can get an XBee Shield, ($19.95) which you can directly mount on top of your Arduino Unit. This sparkfun product doesn’t come with 0.1″ headers, so you have to order them together, unless you already have them.
Now, let’s get onto the Xbee configuration!
Xbee Configuration (This part not complete)
1. First, let’s connect one Xbee to Mac using Xbee Explorer.
2. Open up a Coolterm application and Configure the Xbee. In fact, this part is so well covered in ashleyhughesarduino page, so I recommend you to please follow the page’s instruction on Xbee configuration.
Among everything that counts:
– Both Xbees should have the same Pan ID(ATID).
– Make sure “My address” (ATMY) and “Destination address” (ATDL) are pointing each other correctly. For example, if you set Xbee0’s my address to 0 and destination address to 1, then Xbee1’s my address should be 1 and destination address should be 0.
3. When you are done configuring, plug one Xbee to the Xbee adapter. Make sure the other Xbee is connected to your Mac via the Xbee explorer.
Check the serial communication using a serial monitor
1. To check whether the Xbee wireless serial communication is working, open up a serial monitor from Arduino software. Make sure you choose the correct Serial Port for Xbee Explorer under Tool-> Serial Port. If you previously had a working Arduino Code getting the serial data, then you should be able to see that your Xbee Wireless module is successfully replacing your USB serial connection.
Code to get the serial data in (Arduino – MaxMSP)(This part not complete yet)
This is for people who are curious how to code the arduino to get the serial data in.
1. In my case, I am interfacing Arduino to MaxMSP, so I got the sample code from this Arduino + MAX/MSP page. Among the examples, I used the code from Arduino2Max (Version .5) example. Arduino Code and a max patch was included as a part of the example package. I made a few changes to the arduino code and the Max Patch (Code by Daniel Jolliffe, based on Thomas Ouellet Fredericks’s original work) to make things simpler and meet my own needs. You may just use the original code provided from the above link.
– This is the code I used. In my circuit, I had four digital inputs (switches) connected to 2-5 pins of Arduino, and one LED is connected to pin 13. (Here, Arduino Code will be included and explained)
– You can download my arduino code and max patch here (Here, sample code will be zipped and included so people can download)
2. After you uploaded the code to arduino, open up the arduino serial monitor to see if you are successfully seeing the serial data displayed. If so, close arduino program and open up a MaxMSP patch that comes with my example to see if you can get the data into MaxMSP as well.
3. (Here, explain the max patch, if necessary)