In this tutorial, we will learn how to make an Arduino Long-Range RC Car. This can be controlled up to a distance of about 500m. There are two-speed modes here. Flysky FS-i6 transmitter and 6-channel receiver controls this. Arduino Long-Range RC Car can use different types of transmitter and receiver.
You can watch the following video or read the written tutorial below.
Overview
Arduino Long-range RC car can be controlled up to 500m – 1000m away. There are also two-speed modes. I used a Flysky FS-i6 transmitter and 6-channel receiver. The receiver should have six PWM channels. Using this you can create complex robots. This is also very easy to control. The RC car can be controlled only by the stick on the right side of the Flysky FS-i6 Transmitter. Switch A (SwA) enables the motor of the car and switch B (SwB) changes the speed mode. Green LED will light up if the transmitter and the car are connected. The blue LED lights up if it is the first speed mode. The red LED lights up if it is the second speed mode.
Components Needed
Before we begin, make sure you have gathered all the necessary components. The purchase links are in the description of the my YouTube video.
- 4-wheel chassis kit with DC motors
- L298N motor driver module
- Flysky FS-i6 transmitter and IA6B receiver
- Two or three18650 Li-Ion batteries and a battery holder
- Jumper wires
- Arduino Uno or compatible board
- 3 x LED
- Screwdriver and assorted screws
- Soldering iron and solder (optional)
- Glue Gun
- USB cable for programming the Arduino
Assemble the Chassis
How to assemble the 4 Wheel Smart Car Chassis kit is explained in the post I have presented before. This can be assembled very easily. The link of that article is mentioned below.
Link – How To Assemble 4WD Robot Smart Car Chassis Kits
Long Range RC Car Circuit Diagram
The next stage is connecting the electronics. You may find this circuit diagram quite complex. This is due to the use of digital pins as well as analog pins on the 6-channel receiver and Arduino board. In addition to the four inputs of the L298N motor driver, the ENA and ENB pins are also used. As depicted in the circuit diagram, the procedure for connecting the module wires is further explained below. You can download this circuit diagram. For that, click on the Download button below and download it.
Connecting the four-gear motors to the l298N Motor Driver.
In this way, connect the wires of the gear motors to the motor power connectors of the l298N motor driver.
- Connect the two right motor Red wires to the “OUT4” terminals on the L298N motor driver.
- Connect the two right motor Black wires to the “OUT3” terminals on the motor driver.
- Connect the two left motor Black wires to the “OUT2” terminals on the motor driver.
- Connect the two left motor Red wires to the “OUT1” terminals on the motor driver.
Connect the power to the L298N Driver and Arduino Board
Use three 3.7V 18659 li-ion batteries to provide power. Do not use more than two batteries. It cannot use 9V battery. If a 9V battery is used Gear motor not working. The reason for that is that the 9V battery does not have enough amperage.
First, connect power to the L298N motor drive from the battery holder.
- Connect the Battery holder Red wire to the 12V IN connecter on the motor driver.
- Connect the Battery holder Black wire to the GND connecter on the motor driver.
The maximum voltage from three fully charged 18650 batteries is 12.6. If this voltage is given directly to the Arduino board, the Arduino board will be damaged in some cases. Therefore, initially 12.6 voltage is given to the L298N motor driver, which is regulated through the 7805 regulator and given to the 5V Arduino board.
- Connect the 5V OUT of the L298N motor driver to the VIN of the Arduino board.
- Connect the GND of the L298N motor driver to the GND of the Arduino board.
Connecting the four inputs of the L298N Motor Driver to the Arduino UNO board.
In this way, connect the digital pins of the Arduino board and the inputs of the L298N motor driver by jumper wires.
- Connect the IN1 pin of the motor driver to digital pin D2 on the Arduino.
- Connect the IN2 pin of the motor driver to digital pin D3 on the Arduino.
- Connect the IN3 pin of the motor driver to digital pin D7 on the Arduino.
- Connect the IN4 pin of the motor driver to digital pin D8 on the Arduino.
- Connect the ENA pin of the motor driver to digital pin D5 on the Arduino.
- Connect the ENB pin of the motor driver to digital pin D6 on the Arduino.
The Arduino board is powered by the L298N Motor driver.
- Connect the 5V Out connecter of the motor driver to VIN pin on the Arduino.
- Connect the GND connecter of the motor driver to GND pin on the Arduino.
Binding the receiver to the transmitter
Bind the IA6B receiver with the Flysky FS-i6 transmitter. Refer to the transmitter’s user manual for specific instructions on binding. I use IA6B receiver and Flysky FS-i6 transmitter for Arduino Long-Range RC Car. The video below explains how to bind the transmitter and the receiver.
Connecting the receiver to the Arduino board.
I am using the FlySky IA6B receiver. Its pins can be identified as shown in the figure below. In the diagram, the pins to be powered and the channel connection pins are clearly shown.
Power the receiver by connecting the positive (red) and negative (black) wires to the 5V and GND pins on the Arduino, respectively.
- Connect Channel 1 (CH1) of the receiver to analog pin 0 of the Arduino board.
- Connect Channel 2 (CH2) of the receiver to analog pin 1 of the Arduino board.
- Connect Channel 3 (CH3) of the receiver to analog pin 2 of the Arduino board.
- Connect Channel 4 (CH4) of the receiver to analog pin 3 of the Arduino board.
- Connect Channel 5 (CH5) of the receiver to analog pin 4 of the Arduino board.
- Connect Channel 6 (CH6) of the receiver to analog pin 5 of the Arduino board.
Connecting the indicating LEDs ( Optional )
If the LEDs are connected as follows, the green LED will light up if the transmitter and the car are connected. The blue LED lights up if it is the first speed mode. The red LED lights up if it is the second speed mode. Indicating LEDs are optional things of Arduino Long-Range RC Car. Arduino Long-Range RC Car can be made without indicating LEDs. No need to modify Arduino code.
I use 1W LED bulbs for the front and rear lights. No resistors are needed to connect these. An active buzzer is used as the horn of the vehicle. It emits a beep.
In this way, connect the indicating LEDs to the Arduino board.
- Connect the Red Led (+) wire to the “5V” Pin on the Arduino UNO.
- Connect the Red Led (-) wire to the Digital Pin D11 Pin on the Arduino UNO.
- Connect the Green Led (+) wire to the “5V” Pin on the Arduino UNO.
- Connect the Green Led (-) wire to the Digital Pin D12 Pin on the Arduino UNO.
- Connect the Blue Led (+) wire to the “5V” Pin on the Arduino UNO.
- Connect the Blue Led (-) wire to the Digital Pin D13 Pin on the Arduino UNO.
Connecting the channel to the switch of the transmitter
Connect channel 5 to the SWA Switch and channel 6 to the SWB Switch. Switch A (SwA) enables the motor of the car and switch B (SwB) changes the speed mode.
Upload the Arduino Sketch
Arduino Long-Range RC Car can be made without indicating LEDs. No need to modify Arduino code. Copy the following Arduino code and paste it into the new sketch in the Arduino IDE. Select the board and port and upload the code. If this is difficult to do, watch a tutorial video.
You can download the Arduino code and open it directly through the Arduino IDE. Click the Download button below to download the Arduino code
int enA = 5;
int in1 = 3;
int in2 = 2;
//M2
int enB = 6;
int in3 = 8;
int in4 = 7;
int receiver_pins[] = {A0, A1, A2, A3, A4, A5};
int receiver_values[] = {0, 0, 0, 0, 0, 0};
int res_min = 1100;
int res_max = 1900;
int working_range = 255;// motor driver range
boolean prt = true;
int mode = 0;
//-1 - transmeter not connected or out of range
//0- trans connected and ready
//1 - low speed
//2 = high speed mode
void setup() {
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
pinMode(enA, OUTPUT);
pinMode(enB, OUTPUT);
pinMode(in1, OUTPUT);
pinMode(in2, OUTPUT);
pinMode(in3, OUTPUT);
pinMode(in4, OUTPUT);
Serial.begin(115200);
//Staring delay with LED
setLED(1);
delay(300);
setLED(1);
delay(300);
setLED(2);
delay(300);
setLED(3);
delay(300);
setLED(0);
}
void loop() {
receive();
setModeLED();
int m1 = 0;
int m2 = 0;
int rot = receiver_values[0];
if (mode == 1) {
m1 = receiver_values[1] / 2 + (rot );
m2 = receiver_values[1] / 2 - (rot );
} else if (mode == 2) {
m1 = receiver_values[1] + rot / 2;
m2 = receiver_values[1] - rot / 2
;
}
mpower(1, m1);
mpower(2, m2);
}
int rp = 0;
void receive() {
receiver_values[rp] = map(pulseIn (receiver_pins[rp], HIGH), res_min, res_max, -1 * working_range, working_range);
rp++;
if (rp == 6) {
rp = 0;
}
boolean activevalues = true;
for (int i = 0; i < 6; i++) {
if (prt) {
Serial.print("CH");
Serial.print(i);
Serial.print(" : ");
Serial.print(receiver_values[i]);
Serial.print(",\t");
}
if (receiver_values[i] < -500) {
activevalues = false;
}
}
mode = 0;
if (!activevalues) {
mode = -1;
} else if (receiver_values[4] > -100) {
mode = 2;
} else if (receiver_values[5] > -100) {
mode = 1;
}
if (prt) {
Serial.println("");
}
}
void setModeLED() {
if (mode == -1) {
setLED(-0);
} else if (mode == 0) {
setLED(1);
} else if (mode == 1) {
setLED(2);
} else if (mode == 2) {
setLED(3);
}
}
void setLED(int led) {
for (int i = 1; i < 4; i++) {
if (led == i) {
digitalWrite(10 + i, LOW);
} else {
digitalWrite(10 + i, HIGH);
}
}
}
void mpower(int motor, int spd) {
int rotation = 0;
if (spd > 0) {
rotation = 1;
} else if (spd < 0) {
rotation = -1;
spd *= -1;
}
if (spd > 255) {
spd = 255;
}
int pwm;
int pA;
int pB;
if (motor == 1) {
pwm = enA;
pA = in1;
pB = in2;
} else if (motor == 2) {
pwm = enB;
pA = in3;
pB = in4;
} else {
return;
}
if (rotation == 0) {
digitalWrite(pA, LOW);
digitalWrite(pB, LOW);
} else if (rotation == 1) {
digitalWrite(pA, HIGH);
digitalWrite(pB, LOW);
} else if (rotation == -1) {
digitalWrite(pA, LOW);
digitalWrite(pB, HIGH);
}
analogWrite(pwm, spd);
}
Code language: JavaScript (javascript)
Conclusion
You’ve successfully built a long-range Arduino RC car using the Flysky FS-i6 transmitter and IA6B receiver. This project offers both entertainment and a valuable learning experience in electronics, radio control, and programming. You can further enhance your RC car by adding sensors, camera modules, or autonomous navigation capabilities.