In this article we will learn how to make a RC Car using Arduino:
Prerequisites:
- Arduino UNO with cable
- L293D Motor Driver
- Car Frame Kit
- Flysky Radio Receiver
- Flysky Radio Transmitter
- Batteries
Libraries used:
- AFMotor - For Motor Shield
- IBusBM - For Flysky Receiver

Caution- Remove jumper PWR if providing additional power supply to Arduino rather than taking power from shield.
Implementation
We have to connect components as described in imaghe above. Code is given below which you will have to upload to Arduino.
#include <AFMotor.h>
#include <IBusBM.h>
IBusBM ibus;
AF_DCMotor motor1(1, MOTOR12_64KHZ);
AF_DCMotor motor2(2, MOTOR12_64KHZ);
AF_DCMotor motor3(3, MOTOR12_64KHZ);
AF_DCMotor motor4(4, MOTOR12_64KHZ);
void setup() {
Serial.begin(115200);
ibus.begin(Serial);
motor1.setSpeed(200);
motor2.setSpeed(200);
motor3.setSpeed(200);
motor4.setSpeed(200);
}
void loop() {
double ch1Value = readChannel(0, -100, 100, 0);
double ch2Value = readChannel(1, -100, 100, 0);
if((ch1Value==0)&&(ch2Value==0))
{
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
}
if((ch1Value<30)&&(ch2Value<-50))
{
motor1.run(FORWARD);
motor3.run(FORWARD);
motor2.run(FORWARD);
motor4.run(FORWARD);
}
else if((ch1Value<30)&&(ch2Value>50))
{
motor1.run(BACKWARD);
motor3.run(BACKWARD);
motor2.run(BACKWARD);
motor4.run(BACKWARD);
}
else if((ch1Value<-50)&&(ch2Value<30))
{
motor1.run(FORWARD);
motor4.run(FORWARD);
motor2.run(BACKWARD);
motor3.run(BACKWARD);
}
else if((ch1Value>50)&&(ch2Value<30))
{
motor1.run(BACKWARD);
motor4.run(BACKWARD);
motor2.run(FORWARD);
motor3.run(FORWARD);
}
else
{
motor1.run(RELEASE);
motor2.run(RELEASE);
motor3.run(RELEASE);
motor4.run(RELEASE);
}
delay(200);
}
int readChannel(byte channelInput, int minLimit, int maxLimit, int defaultValue) {
uint16_t ch = ibus.readChannel(channelInput);
if (ch < 100) return defaultValue;
return map(ch, 1000, 2000, minLimit, maxLimit);
}
Full video of Making RC car is below.
Comments:
which libary is used in this code please provide it
Hi Sandesh, You can install libraries mentioned above from Arduino Library manager.