XBee Serial Communication
fireman508
Posts: 19
Hello,
This may be a stupid question, but I figured I might as well ask...does anyone know if the XBee must be connected to a microcontroller in order to work or can a serial (TTL) signal be simply connected to the din pin of the transmitting XBee? Thanks!
-Matt
This may be a stupid question, but I figured I might as well ask...does anyone know if the XBee must be connected to a microcontroller in order to work or can a serial (TTL) signal be simply connected to the din pin of the transmitting XBee? Thanks!
-Matt
Comments
Edit: I've had better luck with XBees when I use pull-up resistors (10K) on the com lines.
Pullups on the XBee i/o input lines are enabled by default including those on Din, DTR and RTS/SLEEP_RQ.
Setup is potentially more difficult with the series 2 (XB24-B..) devices with the ZB (Zigbee) firmware. One of the devices has to be programmed as Coordinator before any communication can take place, and when you order them from the distributor they usually come programmed as end-points, so you have to go into XCTU to burn the coordinator firmware.
The XBees aren't "5V tolerant", all signalling (etc.) must be 0/3V.
(They don't have clamping diodes on the inputs, either: so, none of that "series resistor" jive will suffice.)
What do you know, or should I say what do I not know? I thought TTL just meant communication with 0V and Vcc. I didn't realize the TTL referred to 5V devices only.
After visiting Wikipedia, I see 0V to 3.3V are CMOS devices (which I knew) but I don't see CMOS used to describe communication between devices like I see TTL used.
The Scribbler 2 uses a GTL2003 level translator. Phil posted the datasheet here.
I would think, since you don't need a bi-directional shifter, you could probably use a simpler circuit. If a series resistor wont work, would a series diode lower the voltage enough? Maybe two diodes in series or a green or blue LED? Would a simple voltage divider work?
I've only used my XBee's with Propeller chips so I haven't had to worry about level shifting.
@Tracy, I'm surprised to hear about the internal pull-ups. I had an XBee transmitting a bunch of garbage with only the power connected. Adding an external pull-up solved the problem. I wonder if I had done something to damage mine?
@Matt, What type of XBee's are you using? If you're using Series 2, I could pass along what I learned from the Digi tech support guy on how to configure the XBees.
Edit: I'm still confused. Can TTL refer to 0V to 3.3V logic levels? I did a Google search on 3.3V TTL which left me very unsure about this.
Provided the XBee has regulated 3.3 V power, the input to Din can come via a voltage divider from a 0--5V source, but the resistors have to be chosen with the presence of the pullup in mind..The low low level at the XBee has to be less than 1V and the high greater than 2.5V. A 4.7k / 4.7k divider will usually work. It is better to use an official level shifter.
Matt, Parallax sells an adapter PCB that has a socket for the XBee, the 3.3V supply and all of the necessary level translation for use in 5V systems.
Duane, maybe the pullups had been disabled on your module, or could it have been near some strong fields. The internal pullups are not very strong. The times I have had extraneous garbage from the XBee, with the Prop, have usually been the result of forgetting to wait for the tx buffer to flush before switching over to RCslow, so it sits there forever sending the residual buffer contents at the 20kHz clock rate!
To go back to the original question, I have a device that connects the serial output of a device directly (well, through a level translator to take care of the 5V/3.3V thing) to the DIN pin of an XBee (Series 1). It works perfectly.
"TTL" is a 5V scene.
Some TTL ICs will "work" with lower voltages, that's a side issue.
The 5V-to-3V level-shift, properly done, requires only three components: 2 resistors and a 2N7000 (or sim.)
Hi Tracy,
So I hooked up the 5V/3.3V adapter to level translate the TTL signal from my PMB-648 GPS module and all I'm receiving through the X-CTU terminal is carriage returns (periods). Any idea why this is? Thanks!
Also, would it have anything to do with the PMB-648 baud rate being 4800bps and the XBee transmitting/receiving at 9600bps?
-Matt
Thanks PJ.
I found this circuit here.
The site says it's bi-directional. It (the site) suggests other resistor values for I2C lines.
Edit: I thought I had posted this a while ago but I just found this new message box still open in my browser.
Thanks for the reply. Turns out I was not writing the new baud rate to the XBees memory so every time I turn the power off and on it restored to the default baud rate of 9600...oy.
Anyways, works great at 4800 Baud. Thanks again.
-Matt