Shop OBEX P1 Docs P2 Docs Learn Events
XBee Serial Communication — Parallax Forums

XBee Serial Communication

fireman508fireman508 Posts: 19
edited 2011-12-15 10:22 in Accessories
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

Comments

  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-12-14 14:26
    I'm pretty sure a Series 1 will do this. I think a ZigBee version will also do this if both XBee's have been configured correctly (PAN IDs set and serial numbers set correctly (at least that's the way I know how to do it)).

    Edit: I've had better luck with XBees when I use pull-up resistors (10K) on the com lines.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2011-12-14 16:30
    Series 1 (XB24-A..) devices with the standard 802.15.4 firmware come from the factory programmed with both the MY address and the destination address set to zero, and also always the same channel (C) and pan id ($3332). So if you send data into the serial port of either one, it will appear on the serial port of the other without any other preparation.

    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.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-12-14 17:36
    "TTL"? 0/5V levels? No!
    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.)
  • fireman508fireman508 Posts: 19
    edited 2011-12-14 18:53
    Thanks PJ, that makes perfect sense. I don't suppose you have any suggestions as to how to lower the TTL levels to 0/3 V?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-12-14 19:38
    fireman508 wrote: »
    Thanks PJ, that makes perfect sense. I don't suppose you have any suggestions as to how to lower the TTL levels to 0/3 V?

    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.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2011-12-14 20:09
    The pullup resistors can be turned off or on individually on 8 of the XBee i/o pins, but the factory default is that all of them are on. The value is around 20kΩ but is not well controlled.

    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!
  • fireman508fireman508 Posts: 19
    edited 2011-12-14 20:49
    Thanks Tracy! The adapter PCB sounds perfect and much more reliable than a voltage divider.
  • sylvie369sylvie369 Posts: 1,622
    edited 2011-12-15 03:17
    fireman508 wrote: »
    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

    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.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-12-15 04:52
    Duane Degn,
    "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.)
  • fireman508fireman508 Posts: 19
    edited 2011-12-15 09:37
    The pullup resistors can be turned off or on individually on 8 of the XBee i/o pins, but the factory default is that all of them are on. The value is around 20kΩ but is not well controlled.

    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!

    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
  • Mike GreenMike Green Posts: 23,101
    edited 2011-12-15 09:45
    Probably. Different Bauds are completely incompatible with each other. The xBee (at 9600 Baud) sees the data from the GPS unit (at 4800 Baud) as complete garbage. The X-CTU terminal shows anything it doesn't understand as periods. You can use X-CTU to change the Baud setting of the xBee to 4800 Baud and things should work better.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2011-12-15 09:55
    PJ Allen wrote: »
    Duane Degn,
    "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.)

    Thanks PJ.

    I found this circuit here.

    attachment.php?attachmentid=87713&d=1323963926

    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.
    395 x 193 - 12K
  • fireman508fireman508 Posts: 19
    edited 2011-12-15 10:22
    Hi Mike,

    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
Sign In or Register to comment.