Easy Basics: Project 040b How to build the 4WD smart robot car Part 2 - IR controled, L298N H-Bridge

of Lex C in UNO

Basics: Project 040b

 Project name:  How to build the 4WD smart robot car Part 2 - IR controled, L298N H-Bridge

Tags: Arduino, 4WD smart robot car, Arduino Uno R3, VS1838B IR receiver, L298N H-Bridge motor driver module, IR controlled robot car

Attachments: library and sketch

In this project, you need these parts :

1.Aruduino Uno R3 (you can also use the other version of Arduino)

2.Arduino IDE ( you can download it from here  )

3.Jumper cables M-F, M-M, F-F

4. 4WD smart robot car set 1pc

5. VS1838B IR receiver

6. LED 1 pc (Red)

7.Resistor 1 pc (220 Ohm)

8. Medium size or small breadboard 1pc

9. L298N H-Bridge motor driver module (as you see they can be a little bit different but have the same working principle) 1pc

10. 6 x 1.5V AA Battery Box Case Holder with 6 pcs 1.5V AA batteries or Rechargeable 9V Power Supply (8 x 1.2V 1900 mAh) for motor driver module supply 1 pc


11. Arduino board power supply, can be from +7 to +12V DC (we used 9V battery with 9V Battery Clip and Barrel Jack) or +5V DC


12. IR remote control Arduino Car Mp3 with CR 2032 3V battery or old remote control (any) - we used AKIRA DVD with 2 AAA 1.5v batteries




We will learn how to connects different components and make IR controlled 4WD smart robot car. Note: This IR controlled 4WD smart robot car has a disadvantage of not work outside in sunlight.


Robot is an electromechanical device which is capable of reacting in some way to its environment, and take autonomous decisions or actions in order to achieve a specific task.

A robot is consists of following components:

1. Structure / Chassis

2. Actuator / Motor

3. Controller

4. Inputs / Sensors

5. Power Supply

The Structure consists of physical components. A robot has one or more physical components that move in some way to perform the task. In our case the Chassis and wheels are the structure of the robot.

An “Actuator” can be defined as a device that converts energy (in robotics, that energy tends to be electrical) into physical motion. Most of the actuators produce either rotational or linear motion. In our case the actuator is DC gear motor. It is basically a DC motor combined with a gearbox that works to decrease the motor’s speed and increase the torque. Example: A DC motor having speed 3000 rpm and torque 0.002 Nm. Now we add a gear to it with gear ratio 1:48. The new speed is reduce by a factor 48 (resulting 3000/44 = 68 rpm) and the torque increased by a factor of 48 (resulting 0.002 x 48 = 0.096 Nm).

Structure and Actuators without Controller means nothing. Your robot will still sit in one place. Its just like a human without life. So a Controller (brain) needed to move the robot from one place to another. It is a computing device capable of executing a program and is responsible for all computations, decision making, and communications. In our case, we are using an Arduino Uno microcontroller as a Controller. The Controller takes input (sensors, remote etc), process it and then gives a command to the actuator (motor) to do the desired task.

Unlike humans, robots are not limited to just sight, sound, touch, smell and taste. Robots use different Sensors to interact with the external world. A sensor is a device that detects and responds to some type of input from the physical environment. The specific input could be light, heat, motion, moisture, pressure, or any one of a great number of other environmental phenomena. The Inputs may be from sensors, IR remote control or smartphone/tablet/PC. We will use IR remote control as a input device to control the 4WD smart robot car.

A robot needs a Power source to drive the actuators ( motors ) and the controller. Most of the robots are powered by a battery. When we talk about battery, there are lot of options:

  • AA Alkaline Battery ( Non Rechargeable )
  • AA NiMh or NiCd Battery ( Rechargeable )
  • Li Ion Battery
  • LiPo Battery

So according to the requirement choose the suitable one. In our opinion, always choose a rechargeable and sufficient capacity battery.

Build the circuit

The following picture shows the needed connections with the Arduino Uno

Useful information about components

1. You can find information on how to assemble 4WD smart robot car set in How to build the 4WD smart robot car Part 1.

2. Understanding the IR receiver and LED

You can read more information here.

Signals and connections of IR receiver and LED

There are 3 connections : Signal (Output), GND (0V) and VCC (+5V)

Connect the long leg of the LED (the positive leg, called the anode) to the other end of the resistor. Connect the short leg of the LED (the negative leg, called the cathode) to the GND. Resistor connected for long leg.

3. Understanding the L298N H-Bridge motor driver module

You can read more information here.

4. Understanding the DC motor

You can read more information here.

Step by Step instruction

  1. Assemble the 4WD robot car chassis (base). See How to build the 4WD smart robot car Part 1 (STEPS from 1 to 19).
  2. Attach L298N H-Bridge motor driver module to lower part of robot chassis using two medium size and two small size bolts.
  3. We will make four DC motors configuration without speed control (constant maximum speed only). The L298N H-Bridge motor driver module logic and all DC motors will be powered from 9V power supply. Set the jumpers on ENA and +5V, ENB and +5V on the motor driver board and the 5V_EN (5V) regulator jumper too. You can check the motor polarity by connecting it to the battery pack.If it rotates in forward direction (red wire with positive and black wire with negative terminal of the battery) then the connection is ok).
  4. Attach 4 jumper cables F-M to IN1, IN2, IN3, IN4 pins of motor driver board.
  5. Attach to power terminal of motor driver module 1 pc of positive jumper cable M-M (male to male) and 2 pcs of negative (GND) jumper cable M-M (male to male
  6. Attach the top of robot chassis with four medium size bolts. Put the jumper cables out.
  7. Attach Arduino Uno board to top part of robot chassis using two copper collars, two medium size bolts and two small size bolts.
  8. Attach blue jumper cable (IN1) to Arduino Uno digital pin 7, orange jumper cable (IN2) to Arduino Uno digital pin 6, yellow jumper cable (IN3) to Arduino Uno digital pin 5, green jumper cable (IN4) to Arduino Uno digital pin 4, one negative (GND) jumper cable from motor driver board to Arduino Uno GND pin.
  9. Prepare the poer supply for motor driver board.
  10. Attach power supply with tape or two bolts and two nuts to the top of robot chassis and connect to the power supply jumper cables.
  11. Do wiring for IR receiver and LED on medium size board. You will need IR receiver,  resistor, LED and 7 pcs of jumper cables F-F. See on the picture below.
  12. Open Arduino IDE on your PC/laptop.
  13. Plug your Adruino Uno board into your PC/laptop and select the correct board and com port
  14. Open up serial monitor and set your baud to 9600 baud
  15. Verify and upload the sketch to your Adruino Uno board.
  16. This IR controlled 4WD smart robot car can be moved around using practically any type of IR remotes TV, LCD, LED, DVD player, AC, Blueray player, etc. It makes use of the fact that the remote emits IR (infrared). Press the IR remote control (any manufacturer) in front of IR receiver then you will see the decode hex code in Serial monitor (for example : FF30CF). The code will vary depending on the remote manufacturer. Write it down on the paper for different movement in order to modify the sketch with your remote control codes. (Note that the values will not be obtained with 0x which represents hexadecimal also some values are obtained in middle like FFFFFFFF, ignore them). We have obtained the values of our remote control: 
  18. Modify the sketch with you remote control codes, verify and upload it to your Adruino Uno board.
  19. Unplug your Adruino Uno board from your PC/laptop.
  20. Connect 9V battery with 9V Battery Clip and Barrel Jack to Arduino Jack.
  21. You IR controlled 4WD smart robot car is ready. Congrats!!!
  22. Test the robot is running correctly or not by pushing button as wanted direction. If motor turn on wrong direction - interchange power o/p of motor drive module. If sleep L298N motor drive module - check GND connection between Arduino controller and motor drive module.


We learnt how to connects different components and make IR controlled 4WD smart robot car.


  • See attachment on the begining of this project description.


  • See attachments on the begining of this project description - all libraries included.
    Used IRremote library for this project which is included in attachment.
    See attachments on the begining of this project description - all libraries included.
  • Used IRremote library for this project which is included in attachment. Download, unzip and add to libraries in our PC, for example C:\Users\toshiba\Documents\Arduino\libraries. This link you can find in Preferences of Adruino IDE program which installed in your PC.

Other projects of Lex C
Easy Basics: Project 057a ACR122U NFC Reader of Lex C, Not selected 17-01-2018

Published at 28-10-2017
Viewed: 7118 times