Wireless Remote Control Robot Car With NRF24L01

by Abdulslam in Circuits > Arduino

1600 Views, 9 Favorites, 0 Comments

Wireless Remote Control Robot Car With NRF24L01

IMG_2410.JPG
IMG_2411.JPG

As kids we all loved toys and as a boy I loved remote controlled toys especially. My dad would get me a new toy every time he travelled and they were mostly remote controlled cars or trucks.

Playing with these toys in a way got me interested in tech. When I started learning Arduino and C++, I saw this as an opportunity to build my own toys and make some advancements I couldn't get from the said toys.

Therefore, in this project I will be walking you through how to make your own simple remote controlled robot car.

Supplies

Testing the Motors Directions

IMG_2266.JPG

After putting together the chassis and attaching the wheels, decide which side of your chassis will be the front for the forward direction.

Connect each motor to a battery (3.7 - 4.2 volts) and note which polarity (+ve and -ve) causes each one to rotate in the forward direction.

Connect the left side motors in parallel and right side motors in parallel (i.e +ve wires together and -ve wires together), each side independent of the other.

Mount the L298n Motor Driver on the Chassis

IMG_2269 - Copy.JPG
IMG_2270.JPG

Using the hot glue gun mount the motor driver on the chassis with its back (black heat sink) facing the back of the vehicle / front of the vehicle facing away from you or (i.e Out1 and Out2 on the right side and Out3 and Out4 on the left side) and glue it down.

Note: The blue arrow in the picture above indicates the forward direction of the car and how the motor driver should be placed.


Keep in mind that this orientation will make it easier for us to program the car later.

Connecting the Motors to the Motor Driver

IMG_2268.JPG
L298n_pinout.jpg

With the front of the vehicle facing the same direction as you;

For the right side motors, (assuming they are already connected in parallel as specified in step1) connect the +ve to Out1 and -ve to Out2.


For the leftside motors, connect the +ve to Out3 and -ve to Out4.

Connecting the Motor Driver to Arduino

Wiring-L298N-Motor-Driver-Module-with-DC-TT-motors-and-Arduino-UNO.png

Using the male-to-female jumper cables, connect the motor driver IN pins and power pins to the Arduino as follows;


Motor Driver ---------> Arduino

IN1 ---------> pin 2

IN2 ---------> pin 3

IN3 ---------> pin 4

IN4 ---------> pin 5

5 V (Volts) ---------> Vin

GND (Ground) --------> GND


Connect jumper wires to the GND and 12V of the Motor driver (to supply power to the driver from a 7 -12 Volts battery). So that the Motor driver and the Arduino share a common GND.

Also, short-circuit the ENA (Enable A) and ENB (Enable B) pins on the motor driver.

Remember to hold the Arduino down to the chassis using some hot glue.

Connecting the NRF24L01 Transceiver to Arduino

nrfl2401_pinout.png

Basically, the NRF can act as both a receiver and a transmitter although not simultaneously but one at a time.

This particular NRF24L01 will be serving as the receiver, receiving instructions from the remote controller.

Using the picture above as a guide, connect the transceiver to the Arduino keeping everything the same except CE/SS and CSN.


Connecting the NRF pins starting from the left, bottom row first.

NRF24L01 ---------> Arduino

GND(boxed pin)---------> GND

CE / SS ---------> pin 7

SCK ---------> pin 13

MISO ---------> pin 12

Top row next;

Power (3.3v) ---------> 3.3V

CSN ----------> pin 8

MOSI ---------> pin11

Building the Remote Controller

IMG_2277.JPG

Firstly, connect the Joystick module to the Arduino (second Arduino);


Joystick ---------> Arduino

VRx ---------> analog pin A1

VRy ---------> analog pin A2

GND ---------> GND

+5V ---------> 5V


Then connect the second NRF24L01 to the aforementioned Arduino following the steps stated in step 5.

Connect a 9V battery to the Arduino to power the remote controller.


The code for both the car (receiver) and the controller (transmitter) can be found on my Github.

Testing the Robot Car and Control

Remote Controlled Robot Car

Hooray!!! everything works.

This car was made purely for educational purposes. You can cut out some cardboard and make yours a lot prettier.