SparkFun Forums 

Where electronics enthusiasts find answers.

General project discussion / help
Did you make a robotic coffee pot which implements HTCPCP and decafs unauthorized users? Show it off here!
By Jcm1965
#171528
I am totally new to this and have very little if any electronic background, so please be gentle :) Here is what I am attempting to do: I have 4 magnetic reed switches, each independent of the other. I am using a Series 1 XBee (actually I have multiple if needed). There will be one "receiving" XBee (or at least that is my hope). The idea is that when one of the reed switches is deactivated (magnet removed) a corresponding LED on the receiver will illuminate. It could be done really either way, either all 4 LEDs are on and the deactivated switch LED turns off, or on, as long as all act in the same manner. Now it seems as though I should be able to wire a reed switch to I/O 0, 1, 2, and 3 and respectively a LED to 0, 1, 2, and 3 and have this work. But it doesn't seem to be working. Is there code I need to write to make all of these work? If so can someone help me with that? I had been told by one person that I needed 4 sending XBees and on "receiving", is that what I need? As an additional note, it needs to be so that one or multiple reed switches can be deactivated and turn on one or more of the LEDs at the same time. So if lets say reed switch A's magnet it removed, LED A turns on (or off), and then if B's magnet is removed, LED B turns on (or off), likewise with C and D. I followed the sparkfun tutorial for the "doorbell" and it worked for one, though the LED turned on when the reed switch was deactivated which seemed backwards, but as mentioned, as long as they all work the same way I don't really care as long as I have 4 indicators that work alike off of one receiving XBee. I was using CoolTerm as a writing program. Thanks in advance for any help you can give...fighting a time crunch on this project.
By Jcm1965
#171551
I actually finally resolved this issue (for the most part) on my own after many more hours of searching the internet. The issue was code and the fact that one must activate the I/Os, something that I had not found clearly mentioned and something that tech support at sparkfun also failed to mention when I called. Once the I/Os were turned on in the code writing, the additional LEDs turned on and off via the respective switches. Failure of the CoolTerm program was my own blindness in a half lit room of placing the XBee in the Explorer the wrong direction...duh. For each switch and each LED the respective I/O must be activated by using ADTn 3 for sending, and ADTn 5 for receiving with n= 0 thru 7 as the number I/O pin you are wanting to use. Thanks to this video http://www.youtube.com/watch?v=6BjV6WNwc40 which finally spelled out for me in more detail as to what the various lines of code meant and pointed out the code for the I/O which then led me to search and find this: https://sites.google.com/site/xbeetutorial/link which explained the I/O codes that needed to be written.

Now onward with the projects! :)
By stevech
#171571
I didn't read all you posted, but without writing any code, four reed switches can connect to the remote XBee S1's I/O pins. Then you configure it to do "virtual wire" mode. The remote gets set to sample the reed switch pins and report either/or change of state or sample at fixed time intervals. You tell it which XBee address to be the other end of the virtual wire - the "base station" if you will. Then configure that base station end to match. Now the reed switch on/off states will be replicated at the base station's I/O pins. You connect these as you wish - say, to LEDs. Or relays, or whatever.

Beyond this, you can connect the base station XBee to a microcontroller or PC and get messages via serial data about state changes.

The key to this is to re, re-read, re-re-read the XBee S1 OEM Guide document. It's daunting at first, and moreso to a non-geek.

I've worked with these a long time and can help.