Shop Learn
Joystick Rc transmitter using C — Parallax Forums

Joystick Rc transmitter using C

iseriesiseries Posts: 964
edited 2015-04-02 07:12 in Robotics
I thought I would get this quick project out there.

While it is possible to build a RC transmitter and receiver the cost to do so is not. The parts here cost more than just going out and buying an RC transmitter for less than $100.

Bill of materials:

Qty Description Cost Total
1 Propeller Mini Board 24.99 24.99
1 Radio Shack PC Bd 2.49 2.49
1 Radio Shack Switch 3.49 3.49
1 Radio Shack Box 6.49 6.49
1 AA Battery Holder 2.49 2.49
2 Gimbal Joy Sticks 24.99 49.98
2 13 Pin SIP Sockets .99 1.98
4 220 Ohm Resistors .10 .40
4 .47 uf caps .10 .40
1 XBee ZigBee Pro 31.99 31.99
1 Xbee Adapter Board 3.99 3.99
Total 128.69

I've included inside and outside photo's of the completed project as well as the C project file.

The code generates a position between 1000 and 2000 that would correspond to a normal PWM transmitter that is creating a pulse between 1m second and 2m seconds.
For Throttle it starts at 1000 and goes up to 2000. The Yaw, Roll and Pitch are centered at 1500 and move up or down from there. The code only sends changes that happen and don't constantly send all the axes each second.
It also includes a dead man switch so that if you switch the unit off or the batteries go dead the receiving unit senses that and shuts down.

One of the problems I ran into was the limited movement of the gimbal. I had to multiple the axes to get the desired range I was interested in. This is done by not dividing the rolling average by the total value. So instead of dividing by 4 it only divides by 2.

One fix that needs to be done is the Pitch axes is upside down and needs to be changed. This can be done be subtracting this axes from 3000.

While I don't show the receiver part of this project I have built that as well and tested it. I have hooked it up to a Frankenstein quad rotor and check that all the axes worked.




  • arlandiantoarlandianto Posts: 8
    edited 2015-03-29 23:46
    Hi Mike,

    I'm wondering if you can show me how to receive the array char Buff on the receiver side?
    I'm working on a similar project on my xbee wireless joystick and I can't quite figure out on the receiver side..

    Thank you
  • iseriesiseries Posts: 964
    edited 2015-04-02 07:06
    Here is a snippet of the receive side:

    void ReadXbee(void *par)
    fdserial *xbee;
    int C;
    int Val = 0;

    xbee = fdserial_open(Rx, Tx, FDSERIAL_MODE_NONE, Baud);

    while (1)
    C = fdserial_rxChar(xbee);
    if ((C >= '0') && (C <= '9'))
    Val = Val * 10 + C - '0';
    switch (C)
    case 'T' : Thr = Val;
    AThr = Thr - 1000;
    if (AThr < 0)
    AThr = 0;
    Val = 0;
    case 'Y' : Yaw = Val;
    AYaw = (1500-Yaw)/10;
    Val = 0;
    case 'R' : Roll = Val;
    ARoll = (Roll-1500)/15;
    Val = 0;
    case 'P' : Pitch = Val;
    APitch = (Pitch-1500)/15;
    Val = 0;
    case 'X' : DeadManSet();


  • PublisonPublison Posts: 11,891
    edited 2015-04-02 07:12
    Hi MIke,

    Try this to post your code. It will look much better:

Sign In or Register to comment.