Just a quick note, because this was a silly problem but I didn’t expect it:
I used Digital pins 0 and 1 on the YUN to communicate with DIO0 & DIO1 on the Xbee. Don’t do this! It made some funky stuff happen:
Setting up the system:
Adding Xbee endpoints to the system was difficult because they are “dumb.” For Arduino to identify which Xbee was sending, I have Button 1 Xbee connected to pins 0, 1, 2 — Button 2 Xbee to 3, 4, 5 etc. That way, the YUN could send or receive data on a specific pin and the code could identify which Xbee was sending by the pin number:
Pin numbers, oh the pin numbers!
I have the Xbee Explorer USB from Sparkfun. (The red board below) Look at the pins on the right side of the board: DIO12, DIO11… even DIO9 on the other side. Well, these are not DIO pins. Unfortunately, I counted the I/O pins listed on the board (9) which was exactly the pins that I needed! But alas, no that’s not true. On the right, I have a picture of the Parallax USB Adapter Board, which seems to have an accurate label.
The Parallax board matches the data sheet:
Important things about addressing the radios:
To use the DIO pins, you have to set each one as Input or Output according to the chart (I copied it from the data sheet below on the right.) For example, to set Pin 0 as an Input it would be “ATD03″. Also important is setting the I/O Address, ATIA to FFFF so that all radios listen to I/O from other Radios. I set myself up a big old chart to keep these things straight:
Unfortunately, since Pins 9, 11, and 12 were not actually DIO pins, I can’t program them, and my third button will be on the sidelines until I find a better solution.
To make multiple smaller buttons, I’m using Xbees to send button presses and light up LED’s. First, I was having a lot of trouble configuring them. Thanks to Matt Richardson for recommending these tutorials:
It seems the thing that made it work was to set the i/o input address (ATIA) to FFFF so that all radios would receive it. Funny thing, however as none of the other documentation that I found mentions “ATIA.”
I had to make a chart for myself to make sense of it all. I will fill out the rest once I get more of the radios going:
Here are some resources that helped me make it work:
I have many ideas for my internet connected button, but the next two steps are clear: I would like to develop a more approachable user interface for the button’s website, including a set up form to name and configure the buttons. Then, I would like to transform my large button into a “hub” that will serve as the center of communication for smaller buttons connected via Xbee.
Getting a feel for a smaller button:
A rough sketch of the button’s presence on the web: