Voltage Conversion Necessary for xBee Output???

I'm connecting an xBee to a 5V Arduino Uno, and want to use the logic levels on the xBee pins to talk to the Arduino. Specifically, I've made a five switch keypad that connects directly to an xBee transmitter that has pins D0 through D4 connected to the switches as Digital Input (DI). The switches connect the pins to ground when they are closed (pull them LOW). I have the xBee transmitter configured to update once per second, but to immediately transmit when there is a logic change on any of the input pins (DIO change detect set to watch all five pins). All that works and it sends the proper packet to the receiver, updating immediately when I push or release any button. I can see in the recvr connected to the terminal of X-CTU that: Switch data byte No switch pressed 0001 1111 right 0001 1101 left 0001 0111 center 0001 1110 forward 0000 1111 back 0001 1011

So now I need to hook the receiving xBee up to the Arduino. My concern is the difference in operating voltage. It seems that if I set the Arduino input pins to low and the Reciever xBee has it's pins set as DH in default and they go low to show a result that I won't have a voltage concern. But I wonder what happens when the system is first powered up. I read the pin voltage on the arduino with a pull down resistor added to each input pin, and didn't see anything, but my sketch didn't work right away, so I'm wondering if I'm thinking about this incorrectly.

One issue that has me wondering what I'm missing is that when I connect a voltmeter to the recvr xBee it shows 3.3V on the output pins regardless of whether or not I have the pin set high or low, and when I push the associated button on the transmitter the rcvr pin goes low--again, whether I have it set to DL or DH.

I read the pin voltage on the arduino with a pull down resistor added to each input pin

Is the Arduino going to be reading the switches, or is the XBee? If the XBee is, there doesn't need to be a connection to any Arduino pins, except TX and RX (hardware or software).

If the Arduino is reading the switches, then they won't be connected to the XBee, so the XBee voltage is irrelevant.

The TX output of the XBee is 3.3V, which is sufficient for the Arduino to understand. There should be a level conversion between the Arduino and the XBee's RX pin.

Ah, so you are suggesting that I read the data from the serial port and parse that for the switch positions. For some reason I hadn't thought of that, I intended to use the corresponding pins on the xbee as direct input to the Arduino. To answer your question, the transmitting xBee reads the switches in as inputs to pins DIO-0 through DIO-4. I had intended to connect the corresponding pins on the receiving xBee (DIO- through 4) as digital output (DH) to four Arduino pins to be read as input with the arduino pins set LOW.

It's pretty easy to convert the voltage of the TX/RX pins, I have a couple of xBee Explorer regulated boards from Sparkfun. I may have been over-complicating this.

still seems like it should be simpler to use the corresponding pins, and perhaps more responsive.

still seems like it should be simpler to use the corresponding pins, and perhaps more responsive.

then do it. what's the problem?

Besides your broken shift key.

Apparently the shift key problem is contagious.

Actually it turns out it does work, and the voltage issue isn't (an issue, that is). I just needed to use external pull-down resistors. I also realized I could protect the xBee from goof-ups with the Arduino input pins with just a diode for each pin to enable an xBee output pin to set the arduino input pin high, but not permit a high ardunio pin from toasting the xBee output pin.

ponobill: Apparently the shift key problem is contagious.


As for the question of responsiveness, your bee could transmit the pattern of keys when it sees a change. That way you would always capture the switch state changes in your Arduino serial buffer which means these changes wouldn't be lost regardless what your Arduino code is doing at that particular moment.

It depends of course largely on what else your project is doing, but there are always many ways to achieve what you need.

Cheers ! Geoff

Thanks, I did set the xBee to transmit immediately whenever there is a change in the input pins. I didn't realize that setting the input pins on the transmitter to DI sets the pins high. though it should have been obvious from the packets. I set the transmitter up to send it's state every second, whether or not there is a change, mainly so I could debug, but that over-rode the logic level I had set on the receiver pins since the data segment of the packet with none of the keypad switches pressed is 0001 1111, which sets pins DIO-0 through DIO-4 to high, which added to my confusion--they were HIGH whether or not I had set them to be high or low.

I happened to have a voltmeter attached to one of the pins I had set as an output LOW when I disconnected power to the transmitter, and the pin dropped to 0 volts and the lights came on.

So, I'm back on track, I seem to be learning more from my mistakes than my successes.

Now I'm trying to get tilt compensation working properly on my magnetometer/accelerometer (LSM303DLHC), and devising a way to let manual control override the autopilot smoothly