Shop OBEX P1 Docs P2 Docs Learn Events
Xbee Prop help. — Parallax Forums

Xbee Prop help.

VbGuruVbGuru Posts: 35
edited 2013-05-07 22:00 in Propeller 1
I have a homemade remote and a rover that I am trying to get to work with the Xbee modules. I have the code working that controls the motors using the code at the object exchange. I also have the servos working with some code from there as well for my pan/tilt. I cannot seem to get the Xbee modules to pass data between them though. Currently I want to send four variables to the rover. Nothing fancy. When I have everything hooked up nothing is ever received by the rover Xbee. I have the serial terminal running and it shows that the variables I’m sending out are not empty. I have attached my code.

R-Code = Rover Code
R-Controller = Rover Controller


Any thoughts?

Comments

  • Tracy AllenTracy Allen Posts: 6,664
    edited 2013-02-24 15:05
    Always have to ask,
    --have you gotten the XBee demos to work?
    --which type of XBees are you using (802.15.4 or zigbee)?
    --any special configuration settings in XCTU or elsewhere?

    In your receiver program one thing that jumps out is the condition,
    [SIZE=1][FONT=courier new]    if xb.Rx =="!"[/FONT][/SIZE]
    

    Better I think to use RxCheck to get the two in sync.:
    [SIZE=1][FONT=courier new]    repeat until XB.RxCheck == "!"[/FONT][/SIZE]
    

    I don't think that is the problem though, not receiving anything. Best to try a stripped down program with XBees only until the wiring and configuration checks out.
  • VbGuruVbGuru Posts: 35
    edited 2013-02-24 19:09
    Tracy,
    Thanks for the quick reply. I have two series 1 Xbee's. I cut all the code down to just the xbee object and the fullduplex. I have Xbee1 send the "!", then send "200", and after a two second wait repeat. Xbee2 is setup the same except that it is waiting for the Dec. I threw in a pst "terminal is working" to make sure that the serial terminal is working and it does indeed print that when i start it up. the only thing i have done to the Xbee modules since i used them last (about a year ago with my BS2) was to update the firmware last week sometime.

    I also made the change in the receive where it waits for the delimiter to start.
    Should i be running the receive code in its own cog? I


    Thanks for the feedback!
    Mat
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2013-02-25 12:08
    No need to run the simple XBee code in its own cog. Ideally it operates just like a cable connecting the two props. As a matter of fact, you might try that just to be sure your code is working right.

    It is a good idea to check the XBee settings with X-CTU. Return them to the defaults with both MY and DL addresses set to zero. There are a lot of settings that could mess things up. Maybe your previous project left them with incompatible settings? You can also change the settings programmatically using the XBee_object, but I did not see any of that in your code. Please post the code. Recheck the wiring!
  • JonTitusJonTitus Posts: 193
    edited 2013-02-25 14:17
    If you want to get deeply into the XBee Series-1 modules, I recommend "The Hands-On XBee Lab Manual," that includes C-language source code for an Arduino and an ARM mbed. (You can download C code and X-CTU configuration files.) Sorry, no Propeller code, but examples include flow charts and lots of comments. The book includes 22 experiments that go from basic digital I/O control through networks and sleep modes. No APIs to worry about, so you don't get confused by what calls do what operations. The biggest problem people seem to have involves using the X-CTU program. I always recommendt resetting XBee-module parameters before programming new ones so you know you start with a "clean" module. When configuring a module, it's easy to forget to check all the settings. One parameter set in the wrong state can take a lot of debugging to detect. Also, you can save X-CTU settings in files so you can always go back and use one that worked before.

    I assume you want "base station" to "rover" communication of data, and not rover-to-rover comms. Is that correct?

    p.s. You cannot run XBee modules in full-duplex mode. One transmits and the other receives. A module cannot transmit and receive at the same time.--Jon
  • VbGuruVbGuru Posts: 35
    edited 2013-04-28 20:56
    Hey all,
    Sorry for the long delay in getting back in touch with this. I did get it all working. I took everything off of everything and re-wired it all. I still need to do something with my power sources but that i will come with the next revision. I am also interested in making a dead-mans switch so if it looses the signal from the controller it will just stop (right now it stops about 10% of the time), any ideas how i can implement that?

    So far:
    I had to change how i controlled my pan and tilt though... i had the pan and tilt directly connected to the value of the joystick. If you pushed the joystick halfway to the left then the camera panned halfway to the left. This turned out to be too jittery and i had to change it so the joystick just gave the servo a value that was the speed to move at in the given direction. I have a few videos i took. I have been working hard on it since them but font have an updated video yet.


    http://www.youtube.com/watch?v=xPDT9aWC0qw&list=PLBG76VnJE54IQh5PoTmgcP5CjLzmIPTkX

    Thank you all for your helpful feed back.

    Mathew
  • FalconFalcon Posts: 191
    edited 2013-04-30 18:32
    I agree completely with the comments on "The Hands-On XBee Lab Manual". Excellent reference. Highly recommended. Lots of info that is probably in the Digi documentation but is nearly impossible to find and you might be half asleep by the time you stumble upon it.

    I, too, have a rover project using Props (and XBees when the code is worked out) in the works but much more to do. My rover is bigger and uses power chair motors, Sabertooth 2x25 and two 12V SLA batteries. I had to go with continuous rotation servos from ServoCity for the pan and tilt since I wanted to allow my camera to stay pointed in one direction instead of snapping back to the neutral (strait ahead) position when I let go of the joystick. It still uses RC-format PWM signals. I have it all working with a Futaba/FrSky combo for now while I complete the mechanical components.

    I'd appreciate seeing you latest code to see how it's structured. It might help get my code moving forward again.

    falcon
  • VbGuruVbGuru Posts: 35
    edited 2013-05-05 19:35
    I haven't gotten a hold of a copy of that book yet, I'm hoping by later this month. I have found that most of the Digi documentation is a real page turner :).

    My next base for a rover will be a lot bigger and probably similar in size to yours. I still like track and other then a tri-star wheel system its my first choice for mobility. I have a link that might interest you if you want to do a tracked vehicle. it covers several home made designs and their pro's and con's.

    http://www.rctankcombat.com/articles/track-systems/

    I have attached the code for my rover and for my remote. My remote does all the grunt work and the rover just accepts the values and applies them to the correct variables. The code that i have attached for the remote is a fresh build from tonight. It has the camera pan / tilt and proportional motor control. This build has the code setup so that the camera on the rover is now properly mapped to the right joystick (ie. when you push left it pans left, the old one was inverted for R/L). This code is also set up so that the joystick moves the camera when the joystick is moved and is no longer setup for the camera to be attached to the joystick location (it was neat but too hard to control and jittery as heck). I would think that it would be much harder to do this pan/tilt with continuous rotation servo's as there would not be a way to tell when you have gone too far. with non-modified servos they have a stop point and you just setup for center to be point dead ahead. Also you dont have to worry about winding your wires up and tearing them loose with a regular servo.

    A large portion of my code uses object that other people made (such as the motor, servo control and the xbee handling). Mostly what i have is just a single cog that tells them what to do and passes variable between. there isnt much else other then a some code to set limits on vales (such a servo max rotation) there is also two small chunks of code that invert one track control as well as the L/R pan. this is so that they are going the correct direction.

    cheers!


    Also check my youtube link over the next few days.. I have one new video thats getting uploaded and I am leaving right now to go film another that will show how far my range is now that my remote has a 60mW Xbee in it.
  • FalconFalcon Posts: 191
    edited 2013-05-06 04:59
    VbGuru,

    I'd love to build a tracked robot using a snowblower but I can't find the parts here in the Mid-South. I do cruise the Minnesota Craig's list adds from time to time hoping to see a snowblower carcass that would be reasonable to ship.

    I am using a ServoCity Pan http://www.servocity.com/html/spg785a_top_mount.html and TIlt http://www.servocity.com/html/spt400_tilt_system.html Both use the continuous rotation servos. They move while the joystick is displaced from center, and stop when the joystick is released. I, too, had problems trying to hold the joystick still.

    I use a slipring http://www.ebay.com/itm/300Rpm-Capsule-Compact-Tiny-Slip-Ring-12-Circuits-12-5mm-2A-240V-Test-Equipment-/321101098230?pt=LH_DefaultDomain_0&hash=item4ac31decf6 between the tilt servo/camera assembly and the platform it sits on. I pass the three tilt servos wires, camera power, video, audio and RS-485 for zoom control through the slipring. It happily rotates endlessly without having to worry about the wires. I was apprehensive about the quality of the video suffering from the slipring but it is rock solid. See the slipring wires that will connect to the camera in this pic:
    CIMG0376.jpg


    Future improvements include an RC Helicopter stability gyro to give my tilt servo/camera assembly some compensation similar to what full size tanks have on their barrels when the tank traverses rough terrain.


    For a larger rover, you might be interested in the Kangaroo X2 by Dimension Engineering http://www.dimensionengineering.com/products/kangaroo An easy way to integrate encoder feedback, and works with differential steering arrangements.

    I appreciate the code. It's always useful to see how others approach a silmilar goal.

    falcon
    1024 x 768 - 88K
  • VbGuruVbGuru Posts: 35
    edited 2013-05-07 22:00
    Thank you for the link. I had seen the X2 a bit ago and didn't have the money for it at the time ( I since couldn't remember what it was called). I was throwing around the idea of using stepper motors instead. precise control and lots of torque. I want to get my sensors up and running on my current platform along with my gps before i upgrade size though. My next big hurdle will be with video overlay for feedback. One nail at a time.


    might be a bit off the topic (maybe not)...
    I found a website that might interest you. Its all about unusual locomotion.


    http://www.unusuallocomotion.com/

    Cheers
Sign In or Register to comment.