This tutorial will show you how you can convert an old (or new) Radio Controlled car, in order to control it via the PC. Of course a laptop is preferable for controlling the car outdoors!This F40 is actually very slow! It has 2 motors. One is used for forward and reverse and the other for steering. Newer RC cars use a servo for steering. In this case, you will need a motor controller that has also the option for connecting a servo. A useful web store is Pololu Robotics which has a variety of motor controllers.
This is the old transmitter but still operational!
For this project you will need:
1 motor controller. I used a Qik Dual Serial Motor Controller but any other motor controller that accepts TTL (Transistor Transistor Logic) commands will do fine also. If your RC car has a servo for steering you need to find a suitable motor controller that accepts a servo connection. When buying a motor controller make sure that the motor controller is able to handle the current (Ampere) output of the motors.
2 XBee 2.4GHz modules. I used two XBee 2.5 Series.
1 XBee Explorer regulated. This board will have attached the XBee that will be on the car-side.
1 XBee Explorer USB. This board will have attached the XBee that will be on the PC-side.
1 XBee Explorer Serial from Sparkfun too. This board is useful for updating the firmware of the XBees and setting configuration parameters so as to create the wireless link.
Processing. To learn more about Processing and download the development environment click here.
X-CTU for configuring the two XBees so as to communicate with each other.
Configuring the wireless link first
For establishing a wireless link between the two XBee modules first you must set the correct parameters for each one. I used the information on this link for configuring the two modules.
Connecting the components together
Let's start by connecting the motors to the motor controller. This link will help you in the process ...
You only need to pay attention to the polarity of the power supply (in that case the batteries of the RC car) for the motors. The input voltage must be between 6 to 16 volts. You can check with a multimeter how much voltage the batteries supply.
Let's connect now the XBee Explorer regulated to the motor controller.
this picture will help you a lot! The objective here is to make the following connection from the XBee Explorer to the motor controller:
Xbee > Motor controller
GND > GND
5V > 5V (regulator output)
DOUT > RX (TTL serial input)
DIN > TX (TTL serial output) This connection basically is not needed as we will not read anything from the motor controller. You can leave it disconnected.
After you have made the connections, insert the XBee module into the Explorer regulated and you have almost completed the hardware part! Picture below shows an overall view of the connected components.
Before proceeding to the next step, power up the RC car (via its switch) and notice the blinking rate of the green status led of the motor controller. This is important as the status led shows whether the motor controller's TTL port is connected to the XBee's TTL port. In normal operation the green led must blink every 1.3 seconds according to the data sheet.
In my case, the XBee communicates with the motor controller at 9600 bps (baud rate). The baud rate of the XBee has been set (at 9600 bps) using the X-CTU software. The baud rate of the motor controller is set via the three jumpers. As it is shown in the picture above jumpers 1 and 2 are shorted so as to enable the 9600 bps baud rate on the motor controller. This information can be found in the data sheet of the motor controller.
The next step is to connect the XBee Explorer USB (with the attached XBee) to your computer. If the Wizard asks for drivers, then download the FTDI drivers. You can also find the drivers on the FTDI website or inside the Arduino editor zip file (under the "drivers" folder). Below you can see the other XBee connected to the PC.
Now, go to Device Manager and notice that a new COM port has appeared under "Ports (COM & LPT)". If you have many COM ports this may be difficult to notice, so disconnect the XBee Explorer USB, notice the existing port numbers and then reconnect the XBee Explorer USB.
In my case, the XBee module is accessible via ComPort 4. In your case, this number may be different. Now that we know the ComPort number let's move on to the Processing code.
The Processing code
Below is the full Processing code. Copy and paste it into an empty Processing sketch.
Running the sketch
comPort = new Serial(this, Serial.list(), 9600);
In my case, this number is the "1". In your case the number may be different.
When the sketch is running the user can control the car with the following keys:
'e' for forward and increasing speed
'c' for braking and reducing speed
'x' for instant braking
'q' for reverse
'left' key for turning left
'right' key for turning right
'up' and 'down' keys for centering the steering
Of course, if you like you can change the code so as other keys can be used.
Exporting the sketch
Processing has also an option for exporting the sketch to run as a stand alone .exe application.
That's all! Hope you liked the project :)
For any questions or comments you can post them below or contact me at email@example.com