Jan 222010
XBee - API Mode

After playing a bit in the transparent (AKA AT) mode, it became apparent that it’s quite limited if you plan to do more than just using 2 XBee’s as a wireless serial connection. E.g. it’s not possible to receive the state of the digital and analog inputs from a remote XBee endpoint. The biggest drawback of the API mode is that it’s quite difficult to interactively use it. It’s made for programs to use, not for humans.

After looking for a usable API library, I found this blog which not only pointed me to the right direction, but also to a Python library which is easy enough to use. Easy enough for me who’s not used to Python.

Here a short program included in the library and meant as a sample, which I I slightly modified to make D4 of the endpoint blink, and it sends back the status of D1 and D2 once in 0xf000ms. That part does not work though. I always seem to get the same values back regardless of the I/O status.

from xbee_api import *

class myXbeeApi(XbeeApi):
def onData(self,pkg):
#get header for IO data
if pkg["code"]==0x92:
  print "Samples %s-> D:%s/%s" % (pkg["data"]["mac"],pkg["data"]["dmask"],pkg["data"]["dsamples"])





while 1:

 #set led status
 led=not led
 if led:

Several things I learned while using those XBee radios:

  1. When flashing new firmware on the XBee using the X-CTU program, keep 9600 baud. It makes your life easier as it will always default back to 9600 which is when you will lose your connection to it again and again. When everything is set and working, change baud rate to what you like.
  2. Digi’s documentation is not bad, but more examples would make life easier. Luckily those XBees are popular enough that there are lots of examples in the wild.
  3. I still have no idea what the firmwares for digital and analog endpoints do. The endpoint with API interface seems to be able to handle everything.
  4. Watch out for sleep mode. For endpoints, you cannot turn off sleep mode. Instead use Pin 9 and set it to GND to disable sleep (and SM=1).
  5. Connect the RSSI and Associate pin to LEDs. Helps a lot while debugging.
  6. Have the Commission pin connected. It turns the radio on for 30s so sleep mode is not an issue for 30 seconds.
Jan 172010
XBee - Working

I’ve got those XBee Series 2 modules for quite some time, and I finally managed to make two talk to each other. That was more complicated than I expected, but in the end it was not difficult at all, if you know what to change and how to configure them.

I use the XBee Series 2.5 (AKA ZB) models. There is a lot of documentation about the older Series 1 models. They are easier to use and need no configuration to make 2 talk to each other. The ZB models are a bit more complicated.

  1. Program one via X-CTU as a ZIGBEE COORDINATOR AT (that’ll allow transparent use)
  2. Configure a PAN ID (actually this is optional), configure a Node Identifier (“CO3” in my case), and the Destination High and Low address is the serial number of the end device XBee. Unless you do this, no characters will go around.
  3. Program the other XBee as ZIGBEE END DEVICE AT”
  4. Configure PAN ID to the same one as before, configure a Node Identifier (“EP1”). Leave Destination High and Low to 0, which is the Coordinator.

That’s it.

What you will see then is:

  1. On the Funnel I/O board there are 3 LEDs. CHG for Charge (when USB is connected and the LiPo battery is charged), ON which blinks about twice per second, and RSSI which is green when you send characters via the Coordinator via the X-CTU Terminal.
  2. On the X-CTU Terminal connected to the Coordinator, when you enter command mode (+++), and ATDB, you’ll get a number back which is the direct dB value in hex. The more, the weaker the signal. 0 means that no character ever was received.

Here the link which gave me the “Ah! Got it!” effect. It’s one of the few ones which write about the 2.5 firmware (which is similar to the ZB one I use).

Jan 082010
LED Lamps

Sharp built a LED based lamp with a remote control named DL-L60AV in Japan. As the name implies, it’s supposed to be comparable bright to a 60W incandescent light bulb. That alone is quite impressive for a LED lamp.

I bought one of those for my wife. Since  you cannot only control the brightness but you can also control the color temperature it did look really nice to have.

It did not take long that it occurred to me that the IR remote control ability means that by using an computer connected IR sender, any computer can control a 100V lamp. No need to twiddle with 100V electronics, no need to use any power electronics like triacs. Being hit by a charged elko once (that was back in Germany, so it was probably 325V)  I have a lot of respect for 100V.

Kuroutoshikou has such an IR controller/sender named KURO-RS. I am tempted to buy one, but I unlikely will have time to play with this.