Program FIO over XBee in 3 XBee network?

by averen on Tue Feb 05, 2013 2:30 pm

Hey All,
I'm wondering if it's possible to program my FIO over the XBee link when there are multiple XBee devices (more than 2).

I can currently program my FIO just fine using the Adafruit tutorial and 2 Series 1 Xbees. However I generally use the XBee for communication with another device (Uno with the Adafruit adapter). So I'm wondering how I would go about programming the FIO via XBee when it's connected to the UNO via XBee. Or if I should just power down the UNO, program the FIO via XBee and then power the UNO back up.

The FIO will be in an enclosed box, so while it's not impossible to get to it to connect an FTDI cable, it's definitely an annoyance.

Any suggestions on how to do this without having to power the UNO down? Is this possible? The XBee that would be doing the programming would really only be used for just programming the FIO. In normal communication mode the UNO talks with the FIO via XBee and then the Uno communicates with the PC via the hardware serial (SoftwareSerial used for XBee communication on UNO)

Thanks,
Jared
averen
 
Posts: 8
Joined: Tue Feb 05, 2013 2:24 pm

Re: Program FIO over XBee in 3 XBee network?

by franklin97355 on Tue Feb 05, 2013 5:11 pm

Isn't the FIO a Sparkfun product? Perhaps asking over there would help.
User avatar
franklin97355
 
Posts: 4369
Joined: Mon Apr 21, 2008 1:33 pm

Re: Program FIO over XBee in 3 XBee network?

by averen on Tue Feb 05, 2013 5:16 pm

No, the Fio is manufactured by Arduino. Although, like the UNO and previous Arduino variants, many manufactures take the reference design and make their own re-branded versions.

http://arduino.cc/en/Main/ArduinoBoardFio

I asked here as the tutorial on Adafruit seems to have the most up to date information about programming the Fio via XBees.

http://www.ladyada.net/make/xbee/arduino.html

I also have the following adapters at my disposal as programming via XBee seems like it can be a little tricky:
https://www.adafruit.com/products/247
https://www.adafruit.com/products/126

Thanks,
Jared
averen
 
Posts: 8
Joined: Tue Feb 05, 2013 2:24 pm

Re: Program FIO over XBee in 3 XBee network?

by dennisma on Wed Feb 06, 2013 10:23 am

Some questions - did you also modify the Uno's Xbee adapter to allow it to be programmed over the network? If not, what happens when you try and update the FIO when the Uno is also online?
User avatar
dennisma
 
Posts: 31
Joined: Fri Feb 01, 2013 4:39 pm

Re: Program FIO over XBee in 3 XBee network?

by averen on Wed Feb 06, 2013 10:26 am

dennisma wrote:Some questions - did you also modify the Uno's Xbee adapter to allow it to be programmed over the network? If not, what happens when you try and update the FIO when the Uno is also online?


To be honest I have not tried this...I'm waiting on the 3rd XBee module to arrive at the moment. But that is a good point as the XBee on the Uno has not been modified.
averen
 
Posts: 8
Joined: Tue Feb 05, 2013 2:24 pm

Re: Program FIO over XBee in 3 XBee network?

by dennisma on Wed Feb 06, 2013 11:12 am

averen wrote:To be honest I have not tried this...I'm waiting on the 3rd XBee module to arrive at the moment. But that is a good point as the XBee on the Uno has not been modified.


Oh ok well then the Uno should just see that as data and not try and load the code then through the reset/bootloader process. Of course you probably don't want the Uno to see all that data coming over the net. It won't know what to make of it.

One thing to try is to set the PC's Xbee to unicast instead of broadcasting. You do this by setting your PC's Xbee destination address to be the address of the FIO's Xbee. That way the Uno's Xbee won't receive the FIO's code being uploaded. Look at the AT command reference for XBee and look up ATDH and ATDL. I did this quite a while ago and it works though never for uploading code so don't know if there will be any extraneous problems.

The other option would be to put some logic into your Uno so you can remotely tell it to not process data coming in over the network. Then it is just a simple matter of turning it off prior to uploading to your FIO.

Did any of that make sense?
User avatar
dennisma
 
Posts: 31
Joined: Fri Feb 01, 2013 4:39 pm

Re: Program FIO over XBee in 3 XBee network?

by averen on Wed Feb 06, 2013 11:21 am

dennisma wrote:The other option would be to put some logic into your Uno so you can remotely tell it to not process data coming in over the network. Then it is just a simple matter of turning it off prior to uploading to your FIO.

Did any of that make sense?


Yup!

Sounds like I have 2 options:
1 - Unicast to the FIO with the programmer (probably the easiest method assuming this works). I'll look into setting this up this evening. The Uno is polling the Fio fairly often...it would probably not like this but there is protection in the Uno for when that happens...so I don't think it would be that problematic.
2 - Broadcast to both devices but make the Uno not listen. I think I would need to send a command to the Uno to disable the radio for X amount of time and then have the Uno re-enable the radio. Currently I'm not sending any AT commands to the XBees, they're just acting as UARTs as there are normally only 2 devices. This would take a little more coordination.

Another option would be to power down the Uno when programming the FIO. Not really ideal but that's likely the simplest of all. The UNO is actually connected to the PC through the hardware serial. The Uno relays commands to the Fio over the XBee.

Thinking a little outside the box here...would it be possible to program the Fio through the Uno? So only requiring the 2 XBees...seems a little far fetched.

Thanks!
Jared
averen
 
Posts: 8
Joined: Tue Feb 05, 2013 2:24 pm

Re: Program FIO over XBee in 3 XBee network?

by dennisma on Wed Feb 06, 2013 11:32 am

averen wrote:
dennisma wrote:
Another option would be to power down the Uno when programming the FIO. Not really ideal but that's likely the simplest of all. The UNO is actually connected to the PC through the hardware serial. The Uno relays commands to the Fio over the XBee.



Oh so the Uno is directly connected to the PC you are programming from? I was thinking both the FIO and the Uno were external somewhere and you had an Xbee hooked up to your PC through an FTDI cable.

So the PC talks through the Uno to the FIO?
User avatar
dennisma
 
Posts: 31
Joined: Fri Feb 01, 2013 4:39 pm

Re: Program FIO over XBee in 3 XBee network?

by averen on Wed Feb 06, 2013 11:45 am

dennisma wrote:So the PC talks through the Uno to the FIO?


This is correct. Both controllers work together to automate my observatory dome. The Fio controlls the shutter and a permanent light panel that will be mounted on the wall. The Uno controls the rotation of the dome and acts as a go-between for the Fio.

The Uno uses the hardware serial for the PC connection (through USB). The Uno also uses 2 SoftwareSerial objects. One to talk to the Fio via XBee and the other to control a Pololu motor controller over serial.

PC <--> Uno (Rotation Controller) <--> Fio (Shutter/lightbox controller)

The Fio uses the hardware serial for the XBee and also has a SoftwareSerial object to talk to another Pololu motor controller that will open and close the dome. The lightbox is controlled via PWM and a boost converter.

The Uno is directly connected to the PC and the XBees are only used for the Uno and Fio to communicate...but when I need to change the software on the Fio that means unplugging the XBee and hooking up a FTDI cable. Right now it's not a big deal. But eventually the Fio will be installed in my dome, in a case, at the top of the dome over all my astronomy equipment...so getting to it will be a pain! Thus the desire to program wirelessly.

I also wrote a little WCF server that exposes the interface to the Dome and Lightbox so that I can call it from multiple applications. On the left is the Dome Server which is interfaced with the Uno (which gets the Shutter and Brightness from the Fio). On the right is another application (Sequence Generator Pro) which is used for image capture and automation...here it is talking with the lightbox and adjusting it accordingly.

Image
DomeDuino Server and SGPro

Thanks again!
Jared
averen
 
Posts: 8
Joined: Tue Feb 05, 2013 2:24 pm