Lights, Camera, Actuate! - Part II

Sometimes it's a good advice just to let one or two days pass and everything works. I started from scratch as I hit a roadblock while doing the "Direct Actuation Example". In the end everything worked, but it was a rocky road.

XBee Coordinator and three XBee Router (nodes) connected
As you can see in the picture I configured three nodes (XBee Router AT firmware 2270) with the following AT commands: ATID 2001, ATJV 1 and ATD0 4 (digital pin DIO 0 digital LOW, physical pin 20). Maybe it's a good habit to reset/ restore values after you used the XBees in other projects and to flash the firmware when starting a new project. That's what I also did for the Coordinator, which I programmed in API mode, with ATID 2001, and ATAP 2 (API mode 2). I'm not sure if this might be the source for the problems - in the past I only checked "Enable API" and "Use Escape Characters (ATAP =2)" in X-CTU on the "PC Settings"-Tab. and wrote the AT commands to the XBee. Everything seemed to work. This time I configured API mode 2 on the "Modem Configuration Tab" and then wrote the AT commands to the XBee.

In the picture at number "1" you can see a node queried and responding with the actual state DIO 0 (physical pin 20). Number "2" shows a pushed rocker switch and the toggled pin 20 on another node.

This was my Breadboard configuration where the 3.5mm jack plug goes to my power switch (see blog). I used a BC547A instead of the 2N3904 but many of the standard NPN-transistors will do. I took a 10k ohm resistor which fed about 0.5mA to the base of the transistor (Ibase = Vcc-Vbe/ Rbase). Enough to drive the minimum 6 mA needed by the power switch optocoupler to drive the relay in the power switch.

For testing purposes I configured a breadboard with only a LED to show if the XBee DIO 0 was LOW or HIGH. This was my breadboard configuration.
Breadboard with XBee Router, voltage regulator and transistor to drive LED
ALWAYS check the pin configuration of the electronic parts. For example the pin layout for 2N3904 is "EBC" (Emitter-Base-Collector from left). The BC547A I used has "CBE". A BD139 has "ECB". Confused?
In my breadboard layout above there is a BC547A and the voltage regulator is a LC33FV, which has Vin, GND and Vout (from left).

No comments:

Post a Comment