Arduino Nano and L298N Motor Driver Controlled DC Motors with NRF24L01 Wireless Communication
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to control multiple DC motors using an L298N motor driver, an Arduino Nano microcontroller, and an NRF24L01 wireless module. The power is supplied by a 18650 Li-Ion battery. The Arduino Nano is programmed to control the motor driver and communicate wirelessly via the NRF24L01 module.
Component List
DC Motor
- Description: A standard DC motor used for various applications.
- Pins: pin 1, pin 2
L298N DC Motor Driver
- Description: A dual H-Bridge motor driver that allows control of the speed and direction of two DC motors.
- Pins: OUT1, OUT2, 12V, GND, 5V, OUT3, OUT4, 5V-ENA-JMP-I, 5V-ENA-JMP-O, +5V-J1, +5V-J2, ENA, IN1, IN2, IN3, IN4, ENB
Arduino Nano
- Description: A small, complete, and breadboard-friendly microcontroller board based on the ATmega328P.
- Pins: D1/TX, D0/RX, RESET, GND, D2, D3, D4, D5, D6, D7, D8, D9, D10, D11/MOSI, D12/MISO, VIN, 5V, A7, A6, A5, A4, A3, A2, A1, A0, AREF, 3V3, D13/SCK
18650 Li-Ion Battery
- Description: A rechargeable lithium-ion battery commonly used in portable electronics.
- Pins: Positive, Negative
NRF24L01
- Description: A wireless transceiver module for short-range communication.
- Pins: IRQ (not used), MOSI, CSN, VCC (3V), GND, CE, SCK, MISO
Wiring Details
DC Motor
Motor 1:
- pin 1 connected to L298N DC motor driver OUT4
- pin 2 connected to L298N DC motor driver OUT3
Motor 2:
- pin 1 connected to L298N DC motor driver OUT2
- pin 2 connected to L298N DC motor driver OUT1
L298N DC Motor Driver
- 5V connected to Arduino Nano 5V and NRF24L01 VCC (3V)
- GND connected to 18650 Li-Ion Negative, Arduino Nano GND, and NRF24L01 GND
- 12V connected to 18650 Li-Ion Positive
- IN1 connected to Arduino Nano D2
- IN2 connected to Arduino Nano D3
- IN3 connected to Arduino Nano D4
- IN4 connected to Arduino Nano D7
- ENA connected to Arduino Nano D5
- ENB connected to Arduino Nano D6
- OUT1 connected to DC Motor 2 pin 2
- OUT2 connected to DC Motor 2 pin 1
- OUT3 connected to DC Motor 1 pin 2
- OUT4 connected to DC Motor 1 pin 1
Arduino Nano
- 5V connected to L298N DC motor driver 5V and NRF24L01 VCC (3V)
- GND connected to 18650 Li-Ion Negative, L298N DC motor driver GND, and NRF24L01 GND
- D2 connected to L298N DC motor driver IN1
- D3 connected to L298N DC motor driver IN2
- D4 connected to L298N DC motor driver IN3
- D5 connected to L298N DC motor driver ENA
- D6 connected to L298N DC motor driver ENB
- D7 connected to L298N DC motor driver IN4
- D8 connected to NRF24L01 CE
- D9 connected to NRF24L01 CSN
- D11/MOSI connected to NRF24L01 MOSI
- D12/MISO connected to NRF24L01 MISO
- D13/SCK connected to NRF24L01 SCK
18650 Li-Ion Battery
- Positive connected to L298N DC motor driver 12V
- Negative connected to L298N DC motor driver GND, Arduino Nano GND, and NRF24L01 GND
NRF24L01
- VCC (3V) connected to L298N DC motor driver 5V and Arduino Nano 5V
- GND connected to 18650 Li-Ion Negative, L298N DC motor driver GND, and Arduino Nano GND
- CE connected to Arduino Nano D8
- CSN connected to Arduino Nano D9
- MOSI connected to Arduino Nano D11/MOSI
- MISO connected to Arduino Nano D12/MISO
- SCK connected to Arduino Nano D13/SCK
Code Documentation
Arduino Nano Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
This code is a basic template for the Arduino Nano. The setup function is where you initialize your settings, and the loop function is where the main code runs repeatedly. You can add motor control and wireless communication code as needed.