Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 6 of 6

Thread: Xbee and teensy 3.2 communication

  1. #1
    Junior Member
    Join Date
    Nov 2016
    Posts
    2

    Xbee and teensy 3.2 communication

    I want to have my data sent remotely (one-way communication) to my computer from the teensy at distances up to half a mile. I am using anteensy3.2 and an Xbee Pro. here is the link for it.
    http://www.sparkfun.com/products/10420

    I have both XBees configured so they are talking to eachother in the XCTU software when just hooked up to the computer through an XBee explorer.

    I need help making the jump to the teensy now.
    Is it possible to have one xbee connected to the teensy sending the data to the second xbee by only using the XCTU software and explorer?
    Also, can the xbee attached to the arduino be powered by the teensy or is it best to use another power source?

    I am new to wireless communication so take it easy on me!
    Thanks

    Here is my comm. info!
    Click image for larger version. 

Name:	xbee1.PNG 
Views:	99 
Size:	33.1 KB 
ID:	8924Click image for larger version. 

Name:	xbee2.PNG 
Views:	81 
Size:	32.7 KB 
ID:	8925

  2. #2
    Member
    Join Date
    Jul 2013
    Location
    Colorado
    Posts
    86
    So the Quick answer to number one is yes, the question is what do you do with the received data at the XCTU terminal? but if you have the XBEES set up direct link mode whatever is sent to one would be repeated at the other. That is the simplist mode of using the XBee (I have only worked with S1 and S2.

    As far as power goes, you'll need to read up on the specs of max and average power draw. The T2 was enhanced to have a more robust power supply but you'll need to review that I have not looked in a while.

    If the power is 'just enough' you might have problems and might need an external power supply. perhaps you should set it up for testing both ways?

    Cheers Kb

  3. #3
    Junior Member
    Join Date
    Nov 2016
    Posts
    2
    Thanks for the reply!
    I figured out the power issue. I'm going to power using a 9V battery with a voltage regulator.

    All I want to do is mirror what's coming up in the arduino serial port. I'm writing all the data to an SD card wired to the teensy. No issues there. Can you explain how to set up the xbee in direct link mode? It seems like that will give me what I want. Does this provide 1 way communication only (that's what I want-- doesn't necessarily have to do it though).

    Another question that has came up since I've been playing around with them is the proper setup. When I move the the xbee to the teensy, do I need to keep to disconnect it from the xctu software for it to work properly? Hope that makes sense!

  4. #4
    Member
    Join Date
    Jul 2013
    Location
    Colorado
    Posts
    86
    Wow I posted a response and must've hit the wrong button. Probably was TLDR but when I refreshed the forum my response was gone wo I will reply again but briefer as I am out of time.

    Check into AT mode for the XBee, it makes the point to point comm transparent.

    You'll need some sort of adapter for the XBee I get mine from sparkfun:
    https://www.sparkfun.com/search/results?term=Xbee

    Here's a link to an old project I did using AT mode to provide a remote control for Vex.
    https://www.vexforum.com/index.php/8...ler-for-pic/0/

    Well hopefully that'll get you going enough to succeed, I need to run to work.

    Cheers Kb

  5. #5
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    3,652
    It has been awhile, but I have used several XBees with Teensys.

    As mentioned, you need some form of adapter and as mentioned, I have some from Sparkfun probably some from Adafruit....

    XCTU - When I used it, I only typically used it to setup the XBees. That is I would make sure that the two were setup to talk to each other. Assuming Series 1,
    Things, like the baud rate I want, they both are on the same channel and the DL of one points to the MY of the other and likewise the other way.

    Then after that, once on the Teensy, simply wire it up to one of the Serial ports, like Serial1. And then simply do things like: Serial.println(...)
    If on PC, again any app that can write to a Serial port should work. Just need to configure it for the right port, and baud rate...

  6. #6
    Quote Originally Posted by 123catz View Post
    Another question that has came up since I've been playing around with them is the proper setup. When I move the the xbee to the teensy, do I need to keep to disconnect it from the xctu software for it to work properly? Hope that makes sense!
    All XCTU does is communicate over Serial to the XBee. Which is the same method you will be communicating with the XBee on your Teensy. So once you have it configured in XCTU, you ought to be able to just unplug it from the computer and connect it to your Teensy. or perhaps I misunderstood your question?

    If all you want to do with the XBee is mirror Serial data, then you can do that via software easily. Just spit out to the Xbee's Serial port whatever comes in on the main Serial port. Something like the below code I have used to reconfigure XBees that were permanently soldered to an Arduino board. I just loaded this code onto the Arduino, then connected XCTU via the Serial port on the computer the Arduino was using, and I was able to talk to the XBee just fine!

    (Note this was on a ATMega640, the XBee was on Serial2, and I was echoing out on Serial3. I also echoed the reverse direction - Xbee to Serial - you can just do it 1-way if you want)
    Code:
    void setup()
    {
      Serial2.begin(9600);
      Serial3.begin(38400);
    }
    void loop()
    {
      if (Serial2.available())
      {
        Serial3.write(Serial2.read());
      }
      if (Serial3.available())
      {
        Serial2.write(Serial3.read());
      }
    }

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •