Introduction: Arduino Controls Cheap RC Car Transmitter


OBJECTIVE

Cheap Chinese RC toy cars can be had for about 5 Euros in the local market. The wireless brains behind the majority of these cheap RC toys is a pair of very cheap ICs the TX2 and the RX2. Yup, that's what they are called. So this tutorial is focused on the TX2/RX2 based remote controlled toys. 

I bought one RC toy car a while ago and used the Arduino with an IR sensor to drive it. Then I figured why not use the Arduino to drive the radio control mechanism of the car. You can see a video of the steps involved and the final  operational circuit here:



WHY?

I mentioned in my other projects how hard it is for most people in Jordan to afford buying electronic components because of the very low income,  absurdly high tariffs (mostly to feed rampant government corruption), and arbitrary security procedures. So scavenging parts from cheap gadgets is the way for most young makers I know to sustain their passion for electronic innovation.

CREDITS
Special thanks to Eng. Jafar Quttaineh for his invaluable assistance.

FEEDBACK
Your feedback is most welcome to help me improve my future projects.

Let's get started...

Step 1: Getting Started

APPROACH

In this project, I will use the Arduino to drive the transmitter's LEFT and RIGHT functions. So instead of the user pushing the remote control's joystick to turn the car (or my test rig) , the Arduino can be connected and programmed instead to send these commands via the RC car's transmitter. The same steps can be duplicated to enable the Arduino to drive the transmitter's BACK and FORWARD function pins.

I extracted both receiver and controller circuits from the RC car but you may find it easier to just work with the transmitter + Arduino while leaving the receiver and the car intact. This might be simpler for some of you since you have to only worry about dissecting and wiring the transmitter to the Arduino. Also, the intact receiver + car will act as your test platform. It's also more fun to end your project with your Arduino controlling your RC car instead of just looking at two naked circuits and a blinking LED. Your call.


COMPONENTS

The car has three main components.

1) Mechanical: For steering and locomotion, the car has 2 DC motors and associated gear. One motor provides locomotion from the back of the car, the other DC motor in the front provides steering left and right. I won't be using the motors in this project but these toy cars are a great source of motors, gears, h-bridges, and other parts. So I am not throwing anything away.

2) Electronic: There are three main circuits. a) the transmitter b) the receiver c) the H-bridge. The transmitter and receiver are driven by the venerable TX2 encoder and RX2 decoder ICs. The h-bridge to drive the DC motors uses power transistors. Refer to the datasheet for more details.

3) Power: The transmitter is powered by 2 AA batteries (3V) and the receiver/car comobo is powered by 4 AA batteries (6V).

PARTS NEEDED FOR THIS PROJECT

- Arduino Uno or clone.

- 2 X  10K Ohm resistors. I use each in a series to connect the transmitter's pin to the Arduino's digital pin.  If you want to connect all steering functions (Left, Right, Back, Front) to the Arduino you will need 4 of those. 10K might be overkill but the circuit works.

- 2 X breadboards to place the transmitter and receiver for wiring. It just makes for easier handling and wiring. But you can do without the breadboard.

- Wires and alligator clips.

- 4 X AA (6V) battery source to supply the receiver.

- Multimeter to test your connections.

- DC motors, small DC lamps, or relays to test your final TX2/RX2 system depending on what you plan to use it for.

OPTIONAL LED TESTBED

I know some of you will be tempted to just use LEDs to test the rig. LEDs are nice and cheap and accessible. Since the receiver's h-bridge (geek term for circuit that drives motors) switches between positive and negative voltage depending on whether it's driving the motor in one direction or the other (e.g. Forward vs Back), we can't just use LEDs as-is since an LED passes current in one direction only but not the other. But if you insist on using LED's , I came up with a quick and dirty test circuit based on LEDs. I won't describe it in detail because it's not relevant to his project.

My LED testing circuit was put together on the fly. It's a mini breadboard made up of two LEDs, two diodes, and two resistors both in parallel but rigged for opposite polarities. When the voltage is positive, one LED will turn on, when it's negative, the other LED will turn on. 

This is to simulate a motor turning one way (e.g. Right) or the other (e.g. Left).  You don't need to do this test circuit. Just connect a small DC lamp or a DC motor to test your circuit. I am sure there are better ways of doing this but it was the quickest at the time. I might add two more LEDs to simulate the 2nd  motor's Forward and Backward functions.

WORKING WITH DIFFERENT RC GADGETS

There's a good chance your RX2/TX2 based RC gadget was made by a different vendor with different wire colors and based on different schematics. You should be able to apply the techniques from this project to other RX2/TX2 based RC projects with a modest effort.

Step 2: Taking the RC Car Apart and Re-wiring It With the Arduino


THE SHOWDOWN

And now for the fun part. Putting the pieces together to give Arduino control over the transmitter.

For the purposes of this project, I am only connecting the Arduino to the Right/Left function pins of the TX2, pins 1 and 14. But the process is very similar to connect Arduino to the Forward and Back pins 5 and 4.

Keep the antenna connected to the receiver for better results. In a production environment, attach the original antennas back on the receiver and transmitter, to squeeze in every extra feet of transmission range.

The receiver circuit is also integrated with an h-bridge circuit used to drive the 2 motors. The yellow, green, and blue cables supply positive or negative voltage to spin the motor clockwise or counterclockwise. The RX2 receiver decides, based on the transmitter function signal, which DC motor spins and in what direction. In the final production, you can use the h-bridge output to drive relays or wheels, etc.

A NOTE ABOUT THE REMOTE CONTROL/JOYSTICK

For the remote control, note the two black levers on each joystick. All they do when you turn the joystick is to push two contacts together, one connected to a TX2 IC function pin (Left/Right/Forward/Back pins) and the other to GND. When you turn the joystick and make contact between GND and one of the TX2 unction pins, the transmitter sends a function signal to the receiver. The transmitter's joysticks basically are on/off switches. There's no potentiometer or any mechanism to send variable signals. When no switches are on, the car is motionless.

From an Arduino digital pin perspective, when a TX2 function pin is set to LOW, it's ON. When it's HIGH it's OFF. Confusing but I needed to keep this in the back of my mind to avoid sending wrong pin signals. Which I did on numerous occasions then wondered what went wrong.

WIRING THE TRANSMITTER TO THE ARDUINO

- Connect the transmitter's red power wire to the Arduino's 3.3V pin.

- Connect the transmitter's black GND wire to the Arduino's GND pin.

- And now for the tricky part. Connecting the TX2 function pins for Left (pin 14) and Right (pin 1) to the Arduino's 8 and 9 digital pins. It might be difficult for you to see how I pulled the orange and yellow wires from the TX2 function pins unless you view this related photo in full resolution. I connected the yellow and orange wires to the contacts on the circuit board and not to the metal contacts on top. The metal contacts above are GND while the contacts beneath them are the TX2 function pins. Each time the joystick is turned, it will press the GND plate contact against one of the function pins beneath it, which in turn transmits one of four function signal to the receiver. Between each of the Arduino's digital pin and the transmitter's function pin, I placed a 10K Ohms resistor for protection.

- I powered the Arduino via USB but you can power it via wall wart or battery. Refer to Arduino's datasheet for more info on alternative means to power the Arduino.

WIRING THE RECEIVER

- Connect the RX2 circuit to a 4 X AA (6V) power source. Consult the datasheet for other power options.

- Connect the receiver's white wire to the antenna that came with the RC car.

- Connect the Green and Yellow pairs (initially connected to the front steering motor) to your test load such as DC lamp, a DC motor from the car, or a relay. These two wires are controlled by the Left (pin 14) and Right (pin 1) TX2 function pins on the transmitter. I used a small LED based polarity test circuit but you don't have to do this.

- Make sure the small switch is on before you start testing, if you have a switch that it.  I know this is elementary but with so many little things to keep track of, sometimes I forget the to turn on the switch and just stare at the circuit not knowing what went wrong when just a moment ago everything was working fine. Maybe it's the solder's toxic fumes.

Step 3: Explaining the Arduino Test Program


While the TX2/RX2 IC datasheet refers to the function pins in terms of directions, e.g. Left, Right, Forward, and Back pins, I use this naming convention for consistency. But in reality, you decide what those functions should be named or what they do because all we are doing is activating IC pins and deactivating them. What those pins do depends on what we want them to do.

First, I allocate and initialize 4 digital pins on the Arduino to support the 4 function/direction pins on the TX2 I want to transmit from. The numbering scheme on TX2Pin01,  TX2Pin14, TX2Pin05, TX2Pin04 correspond to the function pins on the TX2 IC encoder we want to control. This is again for consistency with the TX2 IC datasheet. In this project, I only control Right and Left or TX2 pins 1 and 14 respectively.

//===========================================

int TX2Pin01 = 8;  // Right  (or whatever you want this pin to do. Same for other pins below.)
int TX2Pin14 = 9;  // Left
int TX2Pin05 = 10; // Forward
int TX2Pin04 = 11; // Backward


void setup() {               

// The 4 Arduino digital pins should be connected to the TX2 IC function pins 1,14,4,5 via 10K Ohms resistor.
// The TX2 GND is connected to Arduino Uno's GND pin.
// The TX2  VDD is connected to the Arduino Uno's V3.3 pin.
// Set the 4 Arduino digital pins to OUTPUT since we will be using them to control the TX2.

  pinMode(TX2Pin01, OUTPUT);  // Right
  pinMode(TX2Pin14, OUTPUT);  // Left
  pinMode(TX2Pin05, OUTPUT);  // Forward
  pinMode(TX2Pin04, OUTPUT);  // Backward


/*
IMPORTANT:  Deactivate all TX2 function/direction pins by setting them to HIGH before you start. This is to prevent accidental activation of Left and Right at same time (or Front and Back concurrently) which will confuse the RX2 on the receiving side.

Each TX2 function/direction pin is activated/turned on by setting it to GND/LOW.

Again, Please remember that opposite directions/functions are mutually exclusive. Meaning, we can't have both RIGHT and  LEFT set as LOW(GND) at the same time since LOW turns on both function pins. By the same token, we can't set both FORWARD and BACKWARD as LOW(GND) since LOW turns the function pins on. A motor can't spin forward and backward at the same time. Sorry if I sound like a broken record but this can be confusing to some

*/

  digitalWrite(TX2Pin01, HIGH);   // set the TX2 pin 1 on (Right)
  digitalWrite(TX2Pin14, HIGH);   // set the TX2 pin 14 on (Left)
  digitalWrite(TX2Pin05, HIGH);   // set the TX2 pin 5 on (Forward)
  digitalWrite(TX2Pin04, HIGH);   // set the TX2 pin 4 on (Backward)


  Serial.begin(9600);  // for debugging
}


void loop() {
 
/*  We can cut and paste below code and change TX2pinXX variables to control remaining 2 function pins for Forward and Back.

The next code segment activates Right/TX2 pin01 function for 2 seconds than stops Right/TX2 pin01 for 2 seconds.
*/

  Serial.println("TX2Pin01, LOW/GND/GO RIGHT");
  digitalWrite(TX2Pin01, LOW);    // Turn ON  TX2 pin 1 (Go Right)
  delay(2000);                                // wait for a while

  Serial.println("TX2Pin01, HIGH/STOP");
  digitalWrite(TX2Pin01, HIGH);   // Turn OFF  TX2 pin 1 (Stop Right)
  delay(2000);                                // wait for a while

 
// This code segments activate Left/TX2 pin 14 function for 2 seconds than stop Left/TX2 pin14 for 2 seconds.

  Serial.println("TX2Pin14, LOW/GND/GO LEFT");
  digitalWrite(TX2Pin14, LOW);    // Turn ON TX2 pin 14 (Go Left)
  delay(2000);                                // wait for a while

  Serial.println("TX2Pin14, HIGH/STOP");
  digitalWrite(TX2Pin14, HIGH);   // Turn OFF TX2 pin 14 (Stop Left)
  delay(2000);                                // wait for a while
}



Step 4: The Venerable TX2/RX2 Datasheet

My RC car uses the TX2-G/RX2-G ICs for wireless communication. But the datasheets I found are for TX2-C/RX2-C still I found the datasheets useful just the same.

Comments

author
maciejlampart (author)2017-05-09

Hi,

I like yor project, but , I was wondering, if it is possible to achive the same thing without the transmitter, by physically connecting an Arduino's pin to the RC car antenna and giving commands by stimulating the antenna with current.

author
cliffyd (author)2016-02-17

i don't get what benefits this has, unless it adds channels otherwise why bother? I'm just asking?

author
cliffyd (author)2016-02-17

i don't get what benefits this has, unless it adds channels otherwise why bother? I'm just asking?

author
kesha9 (author)2015-11-03

Hey, how much more info pdf includes? Should I go pro an purchase it?

Thank you

author
AndreiG6 made it! (author)2015-09-26

I did this project with the "help" of my little cousins(7 and 4) and they were amazed at the end but got really bored during the process. Kids these days... :))

Nice and easy project :)

car.jpg
author
MohsinI1 (author)2015-09-14

help me the transmitter is switched ON as soon as i plug in the control wires in the breadboard.I cant give HIGH or LOW input to the TXpins plss help iit is always high

author
sathyacse67 (author)2015-08-11

I didn't disturb the power supply(2 AA Size Batteries) to transmitter!
All that I have done is connecting the pin 8 of arduino to pin 1. That's All!
But, the car turns Right in both the cases(LOW and HIGH of Pin 1).
Why?

author
sathyacse67 (author)2015-08-10

hi there, need some help with orange and yellow wires?

author
DhruvMC (author)2015-04-26

Well gonna post a rewritten code for this with some goodies on www.XYZDuino.tk

author
partout.tout (author)2015-03-13

yes engineer with experience we can build the future

sharing your help for the best future

https://www.facebook.com/pages/SAB-CHelectronique/542380939227486

author
DhruvMC (author)2014-09-09

Was My First Arduino Project

Quite Easy To Make

I Made It!!!!!

Rewriting Its Code For Use With PyGame For Keyboard Control

author
emdarcher (author)2012-05-03

it looks like you could use this for cheap arduino to arduino control of you connected the reciever outputs to another arduino, and that arduino would have a code that translates those signals to a usable command. it would require a bit of coding, but is way cheaper than xbee.

author
codegamc (author)emdarcher2014-02-05

that is what i plan to do. this is super useful none the same!

author
techbitar (author)emdarcher2012-05-04

It's possible with some additional tweaking and coding.

author
dempap (author)2013-12-10

Nice work! I 'm working on a similar project and your post is really helpful. My RC car makes use of the same TX2G-RX2G ICs. However, are you sure that they are manufactured from "Actions Semiconductor Co., Ltd."? I noticed the logo on the ICs and is not the same.

author
Yassine Atide (author)2013-07-14

Ramadan mobarak said ,it's always a pleasure to meet maker on the arab world, thanks for highlighting to me these sweet tx2/rx2 for little fun projects , it will be always nice to get some for really cheap.

I have been going though the datasheet , and i can't figure out how did you adapt the max input voltage from arduino output pin voltage , i think i will be using optocoupler to avoid any problem , but still interrested to know why using 10 k resistor.

Cheers , Yassine

author
awesomeroks (author)2013-03-06

I am making a voice recognition rc car. so would it be possibe to use this code?

author
gramhex (author)2012-08-03

Hi,

I have connected the forward and backward terminal of the TX2[TX-2B] to
respective digital pins TX2Pin05, TX2Pin04. Then added the following lines
of code to the existing code you have attached,

digitalWrite(TX2Pin05 , LOW);
delay(2000);

digitalWrite(TX2Pin05, HIGH);
delay(2000);

digitalWrite(TX2Pin04, LOW);
delay(2000);

digitalWrite(TX2Pin04, HIGH);
delay(2000);

After uploading the code to arduino, Only Right functionality in the car
is working other functionality are not working [Left/Forward/Backward].
Please help to solve this issue.

Regards,
Vicky