Posts Tagged ‘xbee’

XBee configuration software for Mac

January 11, 2014

I’m really glad that Digi has finally built a Mac version of their X-CTU software. XBees are fun, and it’s nice to be able to configure them without resorting to Windows via a virtual machine.

MoltoSenso is an alternative, but I couldn’t get it to detect my XBees.

Three XBee

Advertisements

Arduino/Xbee garage door indicator

September 23, 2012

A month or so ago, I created a garage door indicator using arduino and XBee: LEDs in my bedroom indicate whether my garage doors are open or closed. I was inspired by this project, though I didn’t want to get into the garage door opener itself, to remotely open or close the doors. I’d also been reading about thefts from garages in the neighborhood, and we do tend to leave one of garage doors open now and then, sometimes over night.

Remote sensors

To sense whether my two garage doors are open or closed, I use two magnetic contact switches (like this one, but I’m using the ones that came with my Make: Electronics Components Pack 2b). These are just encased reed switches: they switch on/off based on the proximity of a magnet. The magnet needs to be within about 3/4 inch.

I use a Series 2 XBee and a breakout board from SparkFun (to attach the XBee to a circuit board) to send information about the status of the garage doors to another XBee in my bedroom. The two magnetic contact switches are connected to digital input pins on the XBee, and the XBee is set up to send the status of the two pins every two seconds.

Here’s a picture of the interior of the remote:

And here’s the exterior (I used a project box I purchased from Radio Shack):

And here it is installed:

Indicators

A second XBee is attached to an Arduino (via an XBee shield from sparkfun). It listens for the open/closed status from the remote XBee and turns on one of a pair of LEDs for each door: red for open (bad) and green for closed (good). Since I have one large garage door and one small one, I use 10mm LEDs for the large door and 5mm LEDs for the small door.

Here’s the original version of the indicators, breadboarded (though with all 5mm LEDs, using a pairs of LEDs for the large door and single LEDs for the small door…the 10mm LEDs hadn’t arrived in the mail yet):

For the final version, I used a cigar box, which I thought would look nicer on my dresser than a plastic project box. I added a lot of bells and whistles. The trickiest part was that the walls of the cigar box are rather thick, and so you have to counter-sink the parts a bit, as they are generally designed for the thinner plastic walls of a project box. And if you counter-sink something, you have to use care in whether to drill the big hole or the small hole first (do the big hole first), and you have to get the size and depth right in the first place; you can’t go back and counter-sink after you’ve drilled the smaller hole.

Here’s the interior:

In addition to the red/green LEDs for the open/closed indicators, there’s a yellow LED to indicate that the XBee is getting a signal, a power jack, an on/off switch, a potentiometer (with a cap) to adjust the brightness of the LEDs, a photoresistor (light sensor), and a button to switch between using the pot or the light sensor to determine the brightness of the LEDs. The light sensor works really well, so I’m really just using that. I’d originally planned to attach the pot directly to the LEDs, but in the end I have everything connected to pins on the arduino and I just use software to read the button/pot/light sensor states and control the LEDs’ brightness.

Here’s the exterior of the indicator box:

Actually, those pictures are before I’d quite finished: the pot is just sitting inside, and I’d not yet added the button or the light sensor.

Here’s the completed interior:

Here’s the completed exterior. The photo sensor is on the top, toward the right rear. The pot and button are on the left side.

A few issues

Power jack

I drilled too big a hole for the power jack in the back. I guess I didn’t measure properly. But the toggle switch came with a metal plate that I wasn’t going to use and which worked perfectly to cover over my mistake. And it’s on the back, anyway. (One side of the plate is labeled on/off, but the other side is blank and so worked nicely.)

Upside-down XBee becoming detached

The remote XBee, which is hanging upside down in the garage, tended to become detached. I strapped it to the circuit board using a zip tie:

Stuck reed switch

One of the reed switches tends to get stuck, and so one of the garage door indicators has a tendency to say it’s closed when it’s really open, and this is the smaller garage door which tends to be the problem one and is really the whole reason for this project!

It took a while to figure this out. At first, I thought that the XBee was over-heating (it was really hot at the end of July), and so I drilled some holes on the side of the project box. But that didn’t help.

I then tried swapping the XBee pins for the two doors. (I should have tried that first!) The problem was still with the particular garage door, so this indicated that it was not the XBee but the reed switch for the small garage door.

I then flicked the reed switch with my finger, and that did it. And every time since, when the indicator stops working, if I give it a quick tap, that fixes the problem. So it’s clear that the reed switch is getting stuck with the circuit closed.

I’m ordering another reed switch, to replace it. For now, I’ve switched the connection to the reed switch from the “normally closed” connection to the “normally open” connection, and then revised the software to match. (Update: Changing the wire connection on the reed switch from “normally closed” to “normally open” didn’t seem to help, so I switched it back, but then swapped the reed switches between the two doors, so that the bad one is on the large door, which we seldom leave open accidentally.)

I also need to install some sort of screen inside, covering the holes I’d drilled, thinking that the electronics were overheating. I don’t want bugs or spiders to get inside.

Code

Here’s the code for the project. (It’s within my XBee repository.)