Arduino+ XBee

Hello, I am working on a simple wireless project involving a couple of Xbee modules.

I currently have two Xbees,

one XBee Explorer Dongle (http://www.sparkfun.com/commerce/produc … ts_id=9819),

and one XBee Explorer Regulated (http://www.sparkfun.com/commerce/produc … ts_id=9132).

I have got the XBees configured properly, but I am a little confused as to how to connect the “XBee Explorer Regulated” to my arduino (mega) board.

I have read a bit about 5v->3.3v problems and that perhaps this board only regulates the power supply and not the TX/RX signals, which I am supposed to regulate myself?

Is this true or do I simply only need to connect the 5v pin to 5v, GND to GND, DOUT to TX, DIN to RX?

Any advice is greatly appreciated, as I am new to the hardware side of things.

I’ve had success using the circuit in this product:

http://www.sparkfun.com/commerce/produc … ts_id=8745

This works with the 5v supply on the Arduino as it uses a voltage divider for the RX side and a MOSFET on the TX side as an Amplifier up to 5v. Check the schematic for Channel 1 and you’ll be up and running in no time!

Note: I’m using a 2n7000 MOSFET because that’s all I had laying around…

Most XBees have 5 V tolerant inputs, so before you start building a level shifter you might want to read through the datasheet and see if it’s even necessary. I know from personal experience that “XBee-PRO® 868 MHz OEM Module” and “XBee-PRO® 2.4 GHz 60 mW Module” are specified to be 5 V tolerant and work absolutely flawlessly when connected directly to the 5V Arduino UART.

EDIT: Yes, it’s true that all you need are those 4 pins. GND to common ground, VCC to a 3.0-3.6V source (capable of handling relatively high current spikes), DIN to TX and DOUT to RX (and not the other way around). Sometimes it might be wise to hook up the RST pin so that you could reset the XBee if it goes bananas.

The modules that I am using are the “XBee 1mW Wire Antenna” (http://www.sparkfun.com/commerce/produc … ts_id=8665).

I can’t seem to find anything on the spec page about the DOUT, DIN voltages.

Hm, that’s a non-PRO unit, and its datasheet doesn’t specify max voltages explicitly, so (unless you have a disposable unit to test it on) I’d recommend using a voltage divider to bring it down from 5 to 3ish.

You’ll only need one voltage divider - 2 resistors. The line that goes from TX to DIN will need to be pulled down. A simple divider looks like this:

http://www.raltron.com/cust/tools/image … ivider.gif

and with

R1 = 150 Ω

R2 = 280 Ω

it will pull 5 V to 3.25 V.

There’s no need to push the DOUT up to 5 V - Arduino will still consider a 3 V high signal as high, so you can wire that one directly.

teh:
The modules that I am using are the “XBee 1mW Wire Antenna” (http://www.sparkfun.com/commerce/produc … ts_id=8665).

I can’t seem to find anything on the spec page about the DOUT, DIN voltages.

The XBee specs are in the XBee document #90000982_B.pdf on page 8.

VIL Input Low Voltage All Digital Inputs: Max (0.35 * VCC) V

VIH Input High Voltage All Digital Inputs: Min (0.7 * VCC) V

VOL Output Low Voltage: IOL = 2 mA, VCC >= 2.7 V, Max 0.5 V

VOH Output High Voltage: IOH = -2 mA, VCC >= 2.7 V, Min (VCC - 0.5) V

These XBee modules are not 5V tolerant! Look at the supply voltage spec of 2.8 - 3.4V and the Input voltage spec.

Both SparkFun regulated explorer boards have a sort of 5V to 3.3v level shifter. Look at the schematic for these boards and you will see a diode in series with the XBee’s DIN pin. This also requires that the XBee’s internal pull-up is enabled on the Din pin (see command PR on page 51).

Search this forum for more discussion about the series diode on the regulated XBee boards.

waltr:

teh:
Both SparkFun regulated explorer boards have a sort of 5V to 3.3v level shifter. Look at the schematic for these boards and you will see a diode in series with the XBee’s DIN pin. This also requires that the XBee’s internal pull-up is enabled on the Din pin (see command PR on page 51).

Search this forum for more discussion about the series diode on the regulated XBee boards.

That diode is an incorrect design and causes problems - because it prevents achieving a reliable “0” (low), due to the diode’s voltage drop.

I am disappointed that SFE has not, in these many months, corrected this or put an errata out. Lacking such, many users struggle with an unreliable circuit.

A work-around would be to use a Schottky diode - but even that’s marginal.

The two-resistor divider is fine, as is using a proper IC for level-shifting.