How to make an IR-controlled car using the Arduino Nano R4 board

Hello and welcome back! In this project, we will learn how to make an IR-controlled car using the Arduino Nano R4 board. This is a simple 2WD car, and we can control it using any IR remote available in your home, such as a TV remote. So, you don’t need any special controller for this project. For this project, I used the latest Arduino Nano board. Also, I have designed a custom PCB in the shape of the car chassis. Because of this design, we don’t need any additional chassis or jumper wires.
In this car, I have used two DC motors with an L293D motor driver to control forward, backward, left, and right. Also, the IR receiver is used to receive signals from the remote and send commands to the Arduino. Additionally, I have added headlights and a horn to make the car more attractive. You can turn the lights on or off and control the horn using the remote.
Ok, let’s do this project step by step. The required components are given below.
- Arduino Nano board x 1 — Our Store / Amazon
- IR Receiver x 1 — Our store / Amazon
- 5mm white LED x 2 — Our store / Amazon
- 100 ohm Resistor x 2 — Our store / Amazon
- L293D motor driver IC x 1 — Our store / Amazon
- IC base x 1 — Our store / Amazon
- Barrel jack socket x 1 — Our store / Amazon
- Two-pin terminal x 2 — Our store / Amazon
- Female header x 2 — Our store / Amazon
- Gear motor x 2 — Our store / Amazon
- 65mm Robot wheel x 2 — Our store / Amazon
- Cater wheel x 1 — Our store / Amazon
- Li-ion battery x 2 — Our store / Amazon
- Li-ion battery holder x 2 — Our store / Amazon
Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.
Step 1
Firstly, identify these components.














Step 2
Secondly, let’s order PCBs for this project.




- Click the “Instant Quote” button and upload the Gerber file, which you can download from the link below.
- Gerber file – Download
- For this project, I ordered five White PCBs. Next, select the build time and shipping method. Finally, click “Save to Cart” and complete the payment.






Step 3
Thirdly, unbox the PCB package and carefully remove the PCB.




Step 4
Next, solder all the components onto the PCB in the correct positions.






Step 5
Afterward, connect the wheels to the motors and mount them on the chassis. Then, put the wires through the holes.





Step 6
Next, install the caster wheel on the backside of the chassis. After that, connect the motor wires to the motor terminals.





Step 7
Now, mount the battery holder and connect it to the DC input port.



Step 8
Afterward, connect the L293D IC, IR receiver, and Arduino Nano R4 board to the PCB chassis. Then, connect the Arduino board to the computer.




Step 9
Next, open the Arduino IDE and copy the program below. Make sure to install the IR remote library file.
#include <IRremote.hpp>
#define IR_RECEIVE_PIN 3
#define ENA 5
#define ENB 6
#define IN1 7
#define IN2 8
#define IN3 9
#define IN4 10
#define LED1 11
#define LED2 12
#define Buzzer 13
#define Speed 180
// Remote button codes (replace if needed)
#define up 0
#define down 0
#define left 0
#define right 0
#define stop 0
#define lights 0
#define turbo 0
#define horn 0
int currentSpeed = Speed;
void setup() {
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(Buzzer, OUTPUT);
pinMode(ENA, OUTPUT);
pinMode(ENB, OUTPUT);
Serial.begin(115200);
IrReceiver.begin(IR_RECEIVE_PIN, ENABLE_LED_FEEDBACK);
}
void loop() {
if (IrReceiver.decode()) {
unsigned long command = IrReceiver.decodedIRData.decodedRawData;
Serial.println(command);
IrReceiver.resume();
if (command == up) {
Forward();
}
else if (command == down) {
Backward();
}
else if (command == left) {
Left();
}
else if (command == right) {
Right();
}
else if (command == stop) {
Stop();
}
else if (command == lights) {
digitalWrite(LED1, !digitalRead(LED1));
digitalWrite(LED2, !digitalRead(LED2));
}
else if (command == turbo) {
// Toggle turbo mode
if (currentSpeed == Speed)
currentSpeed = 255;
else
currentSpeed = Speed;
}
else if (command == horn) {
digitalWrite(Buzzer, HIGH);
delay(200);
digitalWrite(Buzzer, LOW);
}
}
}
// Movement Functions
void Forward() {
analogWrite(ENA, currentSpeed);
analogWrite(ENB, currentSpeed);
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}
void Backward() {
analogWrite(ENA, currentSpeed);
analogWrite(ENB, currentSpeed);
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void Stop() {
analogWrite(ENA, 0);
analogWrite(ENB, 0);
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
}
void Left() {
analogWrite(ENA, currentSpeed / 2); // slower left motor
analogWrite(ENB, currentSpeed);
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}
void Right() {
analogWrite(ENA, currentSpeed);
analogWrite(ENB, currentSpeed / 2); // slower right motor
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}Step 10
Now, select the board and port. Then, click the upload button.



Step 11
Then, open the Serial Monitor and use your IR remote to read the button values. Copy each value and paste it into the program. You can use any button you like for this. Finally, click the upload button again.



Step 12
Now, disconnect the USB cable and place the batteries into the battery holder. After that, you can test your car with the IR remote.



Ok, enjoy this project! The full video guide is below. We hope to see you in the next project.
How to make an IR-controlled car using the Arduino Nano R4 board