Building the Arduino Xbee Receiver

3689485705?profile=original

Building the Arduino Receiver. The whole board and micro weighs in at 22 grams. The supply will be a 3C Lipolly

 

The Xbee Vin (max 16V) and Arduino VIN (max 20V) hare both powered from the supply battery 11.1 V directly as the both have internal regulators.  This helps isolate any noise from the Arduino and ore servos from being superimposed on the Xbee supply rail.


The Xbee need around 220mA and the Arduino say 100 mA driving the servo PWM signals, and not the motors. All up say 750mA in a 750mAh 3C

 

Working on Yellow Plane

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • Some practical code that seems to work with the servos I have

    void UpdateServos()
    {

    //Throttle TxVal[1]
    //Rotary pot TxVal[2]
    //Joy 1 X TxVal[3]
    //Joy 1 Y TxVal[4]
    //Joy 2 X TxVal[5]
    //Joy 2 Y TxVal[6]
    //rssi TxVal[7]
    //digital TxVal[8]
    //micros() TxVal[9]

    int Flaps = 0;

    //Apply flaps
    if((TxVal[9] & 0x8) != 0)
    Flaps = 25;

    //Throttle
    val = TxVal[1] / 10;
    val = map(val, 1, 179, 30, 179);
    val = constrain(val, 1, 165); // scale it to use it with the servo (value between 0 and 180)
    servo[0].write(val); // sets the servo position according to the scaled value


    //Elevator Joy 1 Y TxVal[4]
    val = TxVal[3] / 10;
    val = constrain(val, 15, 165); // scale it to use it with the servo (value between 0 and 180)
    servo[1].write(val); // sets the servo position according to the scaled value

    //Left Flaperon
    val = (TxVal[4] / 10) + Flaps;
    val = map(val, 0, 179, 15, 165); // scale it to use it with the servo (value between 0 and 180)
    servo[2].write(val); // sets the servo position according to the scaled value

    //Right Flaperon
    val = (TxVal[4] / 10) - Flaps;
    val = constrain(val, 15, 165); // scale it to use it with the servo (value between 0 and 180)
    servo[3].write(val); // sets the servo position according to the scaled value

    //Joy 2 X
    val = TxVal[5] / 10;
    val = constrain(val, 1, 179); // scale it to use it with the servo (value between 0 and 180)
    servo[4].write(val); // sets the servo position according to the scaled value

    //Joy 2 Y
    val = TxVal[6] / 10;
    val = constrain(val, 1, 179); // scale it to use it with the servo (value between 0 and 180)
    servo[5].write(val); // sets the servo position according to the scaled value

    }

  • Better loss of signal code

    The Movie


    void NullServos()
    {

    //Throttle TxVal[1]
    //Rotary pot TxVal[2]
    //Joy 1 X TxVal[3]
    //Joy 1 Y TxVal[4]
    //Joy 2 X TxVal[5]
    //Joy 2 Y TxVal[6]
    //rssi TxVal[7]
    //digital TxVal[8]
    //micros() TxVal[9]

    //Throttle
    val = 0;
    val = map(val, 1, 179, 30, 179);
    val = constrain(val, 1, 179); // scale it to use it with the servo (value between 0 and 180)
    servo[0].write(val); // sets the servo position according to the scaled value


    //Elevator Joy 1 Y TxVal[4]
    val = 90;
    val = constrain(val, 1, 179); // scale it to use it with the servo (value between 0 and 180)
    servo[1].write(val); // sets the servo position according to the scaled value

    //Left Flaperon
    val = 90;
    val = map(val, 0, 179, 1, 179); // scale it to use it with the servo (value between 0 and 180)
    servo[2].write(val); // sets the servo position according to the scaled value

    //Right Flaperon
    val = 90;
    val = constrain(val, 1, 179); // scale it to use it with the servo (value between 0 and 180)
    servo[3].write(val); // sets the servo position according to the scaled value

    //Joy 2 X
    val = TxVal[5] / 10;
    val = constrain(val, 1, 179); // scale it to use it with the servo (value between 0 and 180)
    servo[4].write(val); // sets the servo position according to the scaled value

    //Joy 2 Y
    val = TxVal[6] / 10;
    val = constrain(val, 1, 179); // scale it to use it with the servo (value between 0 and 180)
    servo[5].write(val); // sets the servo position according to the scaled value

    }


  • APC220 Wireless GPRS DTU Data Communication Module USB Adapter Kit For Arduino

    • US $29.90
    Sold by 
    99.7% Positive feedback | 
    Ships from Mongkok, Hong Kong
  • Any time My TX Video

    IMG_1611.JPG

    I bought and cannibalised an old dead park flyer 27 Mhz box for joystick 1

    Untitled.png

    Got a Xbox joystick fro Sparkfun 

    Product COM-09032
    Thumb Joystick
    1

    $5.00

     

    But have found that I can buy complete Playststion remotes for $5 bucks on Ebay with 2 joysticks and some buttons which is good value

    Here are most of my part I have http://kiwitricopter.blogspot.co.nz/p/parts.html

     

     

  • 1 more question. I was looking into making my own tx instead of using a pc joystick recently and had a hard time finding the gimbals. Where did you get your stick? I was going to break down and use the ps2 joysticks from sparkfun  but decided they might be to small of a range.

  • My APC-220's are in the post from Hong Kong now these are 100mW allegedly and at 400Mhz ish band should have inherently better signal propergation

    I have the 60mW 1500 meter Xbee's presently

  • Heres the HK Arduino page

  • I'm actually about to switch my setup to use an APC230 as well. I've only got the 100 meter XBees and a couple WiFly's and I'm looking to get better range. $10 is way cheap for a nano, but the extracore is still like half the size. 

  • Matt looks interesting I will give you a proper read this evening I am buying Nano's for US$9.99 from Hobby King

    I also have two  APC-220 wireless link in the post for 32 bucks see if they can do the job cheaper than Xbee's

    http://kiwitricopter.blogspot.co.nz/2012/11/crius-aio-pro-v1-quadco...

     

    I will look at tindie.com also

  • I have run into this problem with larger packets best to keep them small as you say.

    Yes I send a time code and packet count and dropped packet count as 12 bit values.

    I have seen the 10 packet catchup scenario in MMORG games on occasion when I was working on a proxy service for the games industry. 

    Some things I have learned about Xbee from hands on experimentation.

    1) Keep the packet size to < 100 bytes in either direction

    2) Allow for 50% dead air on 20mS at 38,400 my TX packet is sent in 8mS so 12ms dead air, this value is sent in the TX packet header in a single byte

    3) Only send back a telemetry packet every other TX cycle minimum or you will crowd the airwaves, this causes drop oust and variable latency. I have chose (packcount %5) which is a good margin, and a packet size limit that keeps the transmission clear of the next TX update by 5mS minimum.

    4) Not really Xbee but have another CPU handle the telemetry packets not the TX micro. I am re-using my Netduino Plus as it has Ethernet & TCP/IP and a flash card socket just because i have one.

    5) Have your own checksum, the 802.15.4 will handle things in the air but you still have a wee bit of wire between you micro and the Xbee. Belt an braces is the best approach here.

    6) The Xbee should be treated as a simplex regardless device as I do it gives you better real-time behaviour overall 

    7) Learn about the Xbee config and configure sensibly, to many items to list here, however is set the 802.15.4 retry limit to 3 and the packetiztsion threshold to 3 also

     

    My timing chart

    3692540006?profile=original

    The above timing will only cause an issue if there are lots of retries in the 802.15.4 protocol. I set the retry limit to 3 in the Xbee config

    Thanks for the advice much appreciated, its nice to see others have seen the same issues

This reply was deleted.