Hi,
I have 2 arduino AT mega 168, and 2 xbee 1mW wire anteenae modules........i powered both the xbee's using 3V supply with the grounds connected to arduino ground and also, i wired the tx and rx pins to the arduino as well.My devices were working properly before at 19200 baud rate, with no difficulty, but as i changed the serial. begin command to 9600 baud rate, from that point on, the communication is not happening at all, i.e., there is no information at all at the receiving arduino, i tried changing the baud rate back to 19200, but it doesnt seem to work, there is no information being displayyed in the serial monitor...............please help............!!
Did you change the XBee serial baud rate as well? Are these series 1 XBees, or series 2?
XBees cannot tolerate 5V signals. If the Arduinos are 3.3V models, all will be well, but if they are 5V models, wiring the XBees' RX/TX pins directly to the Arduino's is definitely not recommended. Use a level-shifting adapter like Adafruit's or Sparkfun's. I hope your XBees are OK, but the symptoms don't sound good.
In Faludi's book page 14 he has a circuit that connects the rx and tx from the Arduino directly to the rx, tx on the XBee. I hooked mine up that way when I first started working with them as well. I haven't lost any. It's different if you hook the XBee up to 5V for VCC, but I haven't done that one.....yet. My suspicion is that there is some little minor thing like different baud rates or a miswiring somewhere. Heck, he could have accidentally reprogrammed it somehow. These little things can be touchy.
Of course, I've never worked with a series 1 so that may be different.
I would also recommend checking the XBees baudrate with X-CTU. Chances are, they are still configured with 19200 baud. Check the "always update firmware" box if you try to write new firmware to your XBee.
I used XBees Series 2 (no PROs) a lot w/o level-shifting connected to 5V TX Arduinos and never had any issues with it - but digi says you HAVE TO level shift. So for some time now I use a voltage divider or voltage translator ICs to get the appropriate levels for TX/ RX. And if you want to do it really proper you also have to step-up the 3.3V DOUT to Arduino RX to 5V. The are a lot of voltage translator ICs available for that.
markbee
mine is a 802.15.4 i.e., series 1 i guess, but i just used the ardino serial.begin command to change the baud rate(from that point on , it doesnt work), i havent touched the xctu software till now.... Will upgrading with latest firmware make it alright again?
draythomp:
In Faludi's book page 14 he has a circuit that connects the rx and tx from the Arduino directly to the rx, tx on the XBee. I hooked mine up that way when I first started working with them as well. I haven't lost any. It's different if you hook the XBee up to 5V for VCC, but I haven't done that one.....yet. My suspicion is that there is some little minor thing like different baud rates or a miswiring somewhere. Heck, he could have accidentally reprogrammed it somehow. These little things can be touchy.Of course, I've never worked with a series 1 so that may be different.
Then again, Faludi hooks LEDs directly to the Arduino without dropping resistors. Don't get me wrong, I love his book, helped me out a lot, but that sort of thing does make me wonder a bit.
Having said that, I may have been laboring under a misconception. Just spent some time both on Digi's web site and in the S2 product manual, and if there's the typical "Absolute Maximum Ratings" section, I'm not finding it. I'd be really interested to know Digi's guidance on the signal levels because it'd make things easier for me if I don't need to bother with level shifting! But if 5V signals are OK then I have to wonder why the adapters sold by AFI and SFE bother with level shifting the signals. I too have only used S2 modules, maybe the S1 modules are different in this respect? I'll continue to research, but if you do happen to come across more information, please let me know!
Jack, I did things exactly like markbee. Started out the easy way, got a little scared and went to level shifting. Now, I level shift everything, but I certainly hooked a lot of pins up directly. I suspect I was operating at the lower end of the gray area where something might have gone out, but didn't.
ars, Yep, you HAVE to change the baud rate on the XBee to match the serial port on the arduino. I always use XCTU for this. Get it working with XCTU at the baudrate you want to use long term and then hook things up. XCTU is my way of troubleshooting the various XBee options as well. Think of the XBee as a separate little computer that has to be configured to work (that's exactly what it is). There's folk on here that have experience with the series 1 device, I'm not one of them though.
But, I have beaten several of the series 2 into submission.
Spent some time digging through datasheets, and I can't find anything conclusive that says whether an XBee will or will not be damaged by driving its signal pins with a 5V logic signal. Both the S1 and S2 product manuals say the following:
- RF Module Operation
Serial Communications
Through its serial port, the module can communicate with any logic and voltage compatible UART; or through a level translator to any serial device (for example: through a RS-232 or USB interface board).
"Compatible" isn't defined, so sort of a gray area there. Also both S1 and S2 manuals show the Max Input High Voltage as "-" which is also a bit fuzzy. I might interpret that as meaning 5V is OK, but there is an assumption there.
The real reason to level-shift may be going the other direction. Technically the XBee's output high voltage is below the ATmega328P's minimum input high voltage by a bit, see table below. Having said that, I certainly am also not surprised that it works, as draythomp found. I guess if it didn't work, then I just couldn't go crying to Digi ![]()
So my grand conclusion (and assumption) is that it's OK to drive an XBee with a 5V logic signal, but an XBee's output signals aren't technically compatible with an ATmega328P running at 5V.
I'm glad to be corrected on this if anyone has information to the contrary, but as Jeff Cooper said, I will need to be convinced ![]()
Device Symbol Characteristic Min Max
XBee S1 V[sub]IH[/sub] Input High Voltage 0.7*Vcc -
=2.31V*
XBee S1 V[sub]OH[/sub] Output High Voltage Vcc-0.5 -
=2.80V*
XBee S2 V[sub]IH[/sub] Input High Voltage 0.8*Vcc -
=2.64V*
XBee S2 V[sub]OH[/sub] Output High Voltage 0.82*Vcc -
=2.71V*
ATmega328P V[sub]IH[/sub] Input High Voltage 0.6Vcc Vcc+0.5
=3.00V**
ATmega328P V[sub]OH[/sub] Output High Voltage 4.2V
* Calculated with Vcc=3.3V
** Calculated with Vcc=5V
References:
Series 1 XBee, e.g. XB24-AWI-001:
Product Manual:
http://ftp1.digi.com/support/documentation/90000982_D.pdf
Electrical Characteristics, p10
Series 2 XBee, e.g. XB24-Z7WIT-004:Digi XBee and XBee-PRO Zigbee RF Modules | Digi International
Product Manual:
http://ftp1.digi.com/support/documentation/90000976_G.pdf
Electrical Characteristics, p17
ATmega328P:
29.2 DC Characteristics, p317
I imagine the information is
on display in the bottom of a locked filing cabinet stuck in a disused lavatory with a sign outside the door saying "Beware of the Leopard."
![]()
EmilyJane:
I imagine the information ison display in the bottom of a locked filing cabinet stuck in a disused lavatory with a sign outside the door saying "Beware of the Leopard."
Ha! Another Douglas Adams fan! You don't happen to know where I can get one of those beach towels that say DON'T PANIC in big, bold letters?
Back to bidness for just a bit ... I've used XBee adapters from both Adafruit and Sparkfun, and both seem to work fine. Now I've just looked at their schematics seriously for the first time, and I find that Adafruit's level-shifts the input signals (DTR, RX, RTS, Reset) but not the output signals (CTS, TX); Sparkfun's has an unnamed diode on the RX input (I guess to drop a little voltage) and that's it. Maybe they know something we don't. Still curious about the XBee output signals. Maybe they're "close enough" for most garden-variety applications...
draythomp:
Jack, I did things exactly like markbee. Started out the easy way, got a little scared and went to level shifting. Now, I level shift everything, but I certainly hooked a lot of pins up directly. I suspect I was operating at the lower end of the gray area where something might have gone out, but didn't.
draythomp, how do you do your level-shifting? Inputs only, or outputs as well?
Sorry, no. I never go anywhere without my towel, though. ![]()
Sounds like the inputs need level shifting:
http://www.digi.com/support/kbase/kbaseresultdetl.jsp?id=2160
Although, at least the S4 (900) XBees have a 5V-tolerant UART:
http://www.digi.com/pdf/ds_xbeepro900.pdf
I was incorrect on the diode in the Sparkfun adapter. It's reversed-biased with a high level input, and there is also an LED and a pullup resistor to 3.3V on the DIN pin. So a low level input pulls the pin low, or at least down to the diode's forward voltage drop, which should be fine, and with a high level input, the LED and resistor pull it up to 3.3V.
Probably will have nightmares about this tonight :~
I level shift every signal I send in but not the ones coming out. I've found myself building a circuit using the same chip as the Adafruit board (I forgot the number, but I have them in my XBee box) They're actually pretty easy to use and I've never needed more that two of them at a time. Mostly, I just use an Adafruit board, I bought a number of them without parts and ordered the parts for it from Digi to save myself a buck or two. That's how I wound up with the chips to stick in places where they were needed. However, I started out just jumpering the XBee directly to the arduino. Actually, now that I think about it, I may have one device that is still running with the XBee connected direct. I may have to fix that.
The exception to this is when I tack a component right on the XBee like a temperature sensor or something. These cases are rare, but I have a couple of temperature sensors that I move around to see what's happening in the barn, up on the roof, under the fan on the patio, etc. In those cases, I just hook the device right to the XBee and go for it.
Regarding towels, check out http://www.thinkgeek.com/geektoys/dd8a/
Ooh, not bad, I've been known to check out ThinkGeek but missed that one! Ah nuts, out of stock! Will keep an eye on it though, thanx!