How awesome would it be to have 6 or more channels to control your R/C car, and also customize each channel as per your choice?
I’ve been longing to make something so that I could make this possible so I started off with a little bit of research soon after my 8th grade exams. During my holidays last month, at the age of 14, I finally completed the project and now have a wonderful piece of circuitry which I can integrate on just any R/C car and use the airplane transmitter to control it after customizing every channel just the way I like.
I’ve been very excited about this ever since I completed it and wish to share with everyone how exactly I made it so you guys could enjoy too!! Well this tutorial explains exactly how I made this piece of circuit in detail. If you still happen to have any doubts, please feel free to post your queries and comments, and it’ll be my pleasure to answer!
Enjoy the instructable!! :-)
Step 1: Gathering Your Parts!
1. Flysky Transmitter and Receiver
2. L298n Motor Driver Shield (Parts list and tutorial for the shield is below)
3. Arduino Mega 2560
4. An R/C Car
5. 9v battery
6. 7v NiCd Battery
Step 2: The Transmitter
Pulse-position modulation (PPM) is a form of signal modulation in which M message bits are encoded by transmitting a single pulse in one of possible time-shifts. This is repeated every T seconds, such that the transmitted bit rate is M/T bits per second. It is primarily useful for optical communications systems, where there tends to be little or no multipath interference.
For more Information on PPM visit - http://en.wikipedia.org/wiki/Pulse-position_modulation
To use an airplane R/C transmitter with any microcontroller (in my case the arduino) we have to first decode the PPM signals. To decode these signals I will be using the arduino programming environment.
Step 3: The Motor Driver Shield
Now I will show you how to make your own L298 motor driver shield for the arduino.
1. L298N DUAL H-Bridge IC
2. IN4004 diodes
3. Burg Strips
4. A standard PCB (Printed Circuit Board)
5. Heat Sink
6. Basic Tools and some wire
The L298n H-Bridge
The basic principle of an H-Bridge was being able to control the direction of the motor i.e. forward or backward. This was achieved by managing the current flow through circuit elements called as transistors. The formation looks like an H and that’s where it gets its name – H-Bridge. The L298 uses this principle to control the motors.
I made my shield on a universal PCB with burg strips spaced to go into the arduino’s headers instead of separate wires, which made it easy to use.
Step 4: The Flysky Receiver
Connecting the receiver to the arduino
Connect any two channels of the receiver that you want to use to the arduino pins 9 and 10.
Connecting the battery to the Receiver
Connect the positive and negative terminals of the receiver to the 9v battery. Make sure all the grounds are connected (i.e. the arduino’s ground, the receivers ground and the ground of both the batteries). Usually, many problems occur when all the grounds are not connected.
Step 5: The R/C Car
So first of all, we have to remove the circuit from the R/C car.
Make sure you do not damage any component unless it’s an old car that’s spoilt :) .
Now Solder two wires to each motor and connect these wires to the
L298n shield as shown on the schematic in the previous step.
Step 6: Programming the Arduino
Below is the code which is self explanatory!!
/* This is the code for controlling any R/C car with an airplane transmitter written by Vishnu Chaitanya Karpuram. Enjoy!! */
int motor1Left = 5;// defines pin 5 as connected to the motor
int motor1Right= 6;// defines pin 6 as connected to the motor
int motor2Left = 7;// defines pin 7 as connected to the motor
int motor2Right = 8;// defines pin 8 as connected to the motor
int channel1 = 9; // defines the channels that are connected
int channel2 = 10;// to pins 9 and 10 of arduino respectively
int Channel1 ; // Used later to
int Channel2 ; // store values
void setup ()
pinMode (motor1Left, OUTPUT);// initialises the motor pins
pinMode (motor1Right, OUTPUT);
pinMode (motor2Left, OUTPUT);
pinMode (motor2Right, OUTPUT);// as outputs
pinMode (channel1, INPUT);// initialises the channels
pinMode (channel2, INPUT);// as inputs
Serial.begin (9600); // Sets the baud rate to 9600 bps
void loop ()
Channel1 = (pulseIn (channel1, HIGH)); // Checks the value of channel1
Serial.println (Channel1); //Prints the channels value on the serial monitor
if (Channel1 > 1300 && Channel1 < 1500 ) /*If these conditions are true, do the following. These are the values that I got from my transmitter, which you may customize according to your transmitter values */
digitalWrite (motor1Left, LOW); // Sets both the
digitalWrite (motor1Right, LOW);// motors to low
if (Channel1 < 1300) // Checks if Channel1 is lesser than 1300
digitalWrite (motor1Left, HIGH);// Turns the left
digitalWrite (motor1Right, LOW); // motor forward
if (Channel1 > 1500) // Checks if Channel1 is greater than 1500
digitalWrite (motor1Left, LOW);// Turns the right
digitalWrite (motor1Right, HIGH);// motor forward
Channel2 = (pulseIn (channel2, HIGH)); // Checks the value of channel1
Serial.println (Channel2); //Prints the channels value value on the serial monitor
if (Channel2 > 1300 && Channel1 < 1500 ) // If these conditions are true, do the following
digitalWrite (motor2Left, LOW);// Sets both the
digitalWrite (motor2Right, LOW);// motors to low
if (Channel2 < 1300) // Checks if Channel2 is lesser than 1300
digitalWrite (motor2Left, LOW);// Turns the left
digitalWrite (motor2Right, HIGH);// motor backward
if (Channel2 > 1500) // Checks if Channel2 is greater than 1500
digitalWrite (motor2Left, HIGH);// Turns the right
digitalWrite (motor2Right, LOW);// motor backward
/* NOTE - Check the values of the channels that you get in the serial monitor
and adjust the values in the if statements accordingly. In my case when the stick
was centered, my readings were 1400 to 1470. When the stick was raised, the readings were
above 1470 and when it was lowered, the readings were below 1300.