I've had a few days to play with the Iris switch <link> and I like it. However it doesn't play well with others. In that I mean I tried to bring it up on the network with my other devices and managed to kill my network of XBees. Yes, I was down with all my devices not talking to each other and I had to visit each device and fix it. This is totally avoidable, I was an idiot. Do not follow in my footsteps in this.
First there are some things to know. As I pointed out in my last post <link> about this switch, it takes special settings on the XBee for it to work with an Iris switch:
ZigBee Stack Profile 2
Encryption Enable 1
Encryption Options 1
API Enable 2
API Output Mode 3
Some Encryption Key
XBee Modem XB24-ZB, ZIGBEE Coordinator API, Version 21A7 (or better)
This is radically different from what I have been using in the past. First, the Zigbee Stack Profile is 2, which means use the ZigBee Pro stack; I normally use a 0 in that spot. When I changed it to profile 2, it stopped passing all the messages from my existing XBees through to the serial port. Naturally, I thought that I could simply change the other devices to use the same profile parameter and everything should be fine. Not so.
It seems the API Output Mode has a similar effect. When you change API Output mode to something other than 0, you lose all the messages from other XBees except the ones that are explicitly allowed. The message: ZigBee Explicit Rx Indicator (frame id=91) comes through fine, but you lose the ZigBee Receive Packet (frame id=90) which is what you normally get. That means my remote XBees were happily sending messages and the receiver didn't pass them on to the serial port. Like I said, I was an idiot because the setting clearly indicates either 'traditional' or 'explicit'. I should have gotten a clue from this before I messed with the controller.
So, I couldn't see anything that was being sent by my other devices. Naturally, I found this out AFTER I had reprogrammed my XBee controller. My whole network was down. The various XBee devices had saved their connection with the controller as it was set up before and I had to visit each one of them and make them drop the connection and establish a new one. What a royal pain in the behind.
While I was doing that I decided there had to be a way to keep from having this happen in the future. It turns out there is. By adjusting some of the parameters, the remote XBees will sense that the controller is gone and automatically hunt for a new controller. This is a mixed blessing because if your controller dies, your remote devices will stop talking to each other. I've had exactly zero problems with the XBee controller, so I decided to set the network up this way so that future experiments like this won't mean taking things apart to get to the XBee and forcing it to initialize the network. The parameters are:
Network Watchdog Timeout 1
Channel Verification 1 (enabled)
The watchdog timeout causes the XBee to reestablish the network connection if it hasn't heard from the coordinator in three minutes. Since my coordinator is sending the time repeatedly, all devices will hear from it often enough that the network shouldn't ever have a problem. The Channel Verification being enabled means that any time the power fails the XBee will check to be sure there is an XBee controller out there when the power comes back on. If it can't find the controller, it'll go looking for one.
These changes mean that if my controller dies, the network dies. Fine, I can live with that. It also means that there may be a very slight pause whenever the power comes back on from a failure. When I tested that by unplugging a device, it took less than a second for it to find the controller and get back online. So, now if I mess up the controller with some experiment, I won't have to go visit each darn XBee and make it talk to the new controller set up. They'll do it by themselves after a three minute timeout, or I can unplug the power and make them do it right now. Too bad I didn't discover this a couple of years ago.
Now, these changes may not be the right thing for you to do. However, if you have an XBee in a hard to get to location, or setting way out there in the field hooked to a solar charger, it might be a good idea. So, you understand your needs better than I can; make an informed decision.
All this information means something else: The Iris switch and my network won't work together. Simple, I'll just set up a controller for the Iris Zigbee devices I may eventually have separate from the network I am using now and control them separately. I should be able to interface an Arduino that has the code for Iris to anything I want to and go merrily on my way. That may be the next project.
So, there was something good that came out of messing up my network of devices. I learned a lot about modifying the network in general. I also got to visit each of my XBees and clean out the spider webs and dead flies. There was live scorpion in one of them, but since it's cool right now and the arthropod couldn't move very fast, I won. I also decided to retire the separate Arduino for the Acid Pump and move the code and connection over to my Pool Controller. Since I was already in the code for the Pool Controller, I hooked in the Septic Tank Float so I can get an alarm in the house if the tank has problems. These were chores that I've been putting aside for months now.
How many people do you know that have a septic tank that can send them email?
First there are some things to know. As I pointed out in my last post <link> about this switch, it takes special settings on the XBee for it to work with an Iris switch:
ZigBee Stack Profile 2
Encryption Enable 1
Encryption Options 1
API Enable 2
API Output Mode 3
Some Encryption Key
XBee Modem XB24-ZB, ZIGBEE Coordinator API, Version 21A7 (or better)
This is radically different from what I have been using in the past. First, the Zigbee Stack Profile is 2, which means use the ZigBee Pro stack; I normally use a 0 in that spot. When I changed it to profile 2, it stopped passing all the messages from my existing XBees through to the serial port. Naturally, I thought that I could simply change the other devices to use the same profile parameter and everything should be fine. Not so.
It seems the API Output Mode has a similar effect. When you change API Output mode to something other than 0, you lose all the messages from other XBees except the ones that are explicitly allowed. The message: ZigBee Explicit Rx Indicator (frame id=91) comes through fine, but you lose the ZigBee Receive Packet (frame id=90) which is what you normally get. That means my remote XBees were happily sending messages and the receiver didn't pass them on to the serial port. Like I said, I was an idiot because the setting clearly indicates either 'traditional' or 'explicit'. I should have gotten a clue from this before I messed with the controller.
So, I couldn't see anything that was being sent by my other devices. Naturally, I found this out AFTER I had reprogrammed my XBee controller. My whole network was down. The various XBee devices had saved their connection with the controller as it was set up before and I had to visit each one of them and make them drop the connection and establish a new one. What a royal pain in the behind.
While I was doing that I decided there had to be a way to keep from having this happen in the future. It turns out there is. By adjusting some of the parameters, the remote XBees will sense that the controller is gone and automatically hunt for a new controller. This is a mixed blessing because if your controller dies, your remote devices will stop talking to each other. I've had exactly zero problems with the XBee controller, so I decided to set the network up this way so that future experiments like this won't mean taking things apart to get to the XBee and forcing it to initialize the network. The parameters are:
Network Watchdog Timeout 1
Channel Verification 1 (enabled)
The watchdog timeout causes the XBee to reestablish the network connection if it hasn't heard from the coordinator in three minutes. Since my coordinator is sending the time repeatedly, all devices will hear from it often enough that the network shouldn't ever have a problem. The Channel Verification being enabled means that any time the power fails the XBee will check to be sure there is an XBee controller out there when the power comes back on. If it can't find the controller, it'll go looking for one.
These changes mean that if my controller dies, the network dies. Fine, I can live with that. It also means that there may be a very slight pause whenever the power comes back on from a failure. When I tested that by unplugging a device, it took less than a second for it to find the controller and get back online. So, now if I mess up the controller with some experiment, I won't have to go visit each darn XBee and make it talk to the new controller set up. They'll do it by themselves after a three minute timeout, or I can unplug the power and make them do it right now. Too bad I didn't discover this a couple of years ago.
Now, these changes may not be the right thing for you to do. However, if you have an XBee in a hard to get to location, or setting way out there in the field hooked to a solar charger, it might be a good idea. So, you understand your needs better than I can; make an informed decision.
All this information means something else: The Iris switch and my network won't work together. Simple, I'll just set up a controller for the Iris Zigbee devices I may eventually have separate from the network I am using now and control them separately. I should be able to interface an Arduino that has the code for Iris to anything I want to and go merrily on my way. That may be the next project.
So, there was something good that came out of messing up my network of devices. I learned a lot about modifying the network in general. I also got to visit each of my XBees and clean out the spider webs and dead flies. There was live scorpion in one of them, but since it's cool right now and the arthropod couldn't move very fast, I won. I also decided to retire the separate Arduino for the Acid Pump and move the code and connection over to my Pool Controller. Since I was already in the code for the Pool Controller, I hooked in the Septic Tank Float so I can get an alarm in the house if the tank has problems. These were chores that I've been putting aside for months now.
How many people do you know that have a septic tank that can send them email?