Arduino Mega 2560 Multi-Motor Control System with NRF24L01 Wireless Module
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit integrates various components to perform multiple functions, including motor control, wireless communication, and stepper motor driving. The central processing unit is an Arduino Mega 2560, which interfaces with an NRF24L01 wireless module, an L298N DC motor driver, a TB6612FNG motor driver, and an A4988 stepper motor driver. Power is supplied by a 2200mAh LiPo battery and a 12V battery, which are connected to the motor drivers. The circuit controls several DC motors and a bipolar stepper motor.
Component List
Arduino Mega 2560
- Microcontroller board based on the ATmega2560
- Provides 54 digital input/output pins, 16 analog inputs, 4 UARTs, a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button.
NRF24L01
- A wireless transceiver module that operates in the 2.4GHz band
- Features include up to 2Mbps data rate, low power consumption, and enhanced ShockBurst™ and Auto Acknowledgment support.
L298N DC Motor Driver
- A high-power motor driver capable of driving up to two DC motors
- Provides several control modes and is capable of delivering up to 2A per channel.
TB6612FNG Motor Driver
- A compact dual motor driver carrier
- Can deliver up to 1.2A per channel continuously (3.2A peak) with thermal shutdown protection.
A4988 Stepper Motor Driver (Red)
- A complete microstepping motor driver with a built-in translator for easy operation
- The driver offers five different step resolutions and operates bipolar stepper motors in full-, half-, quarter-, eighth-, and sixteenth-step modes.
LiPo Battery 2200mAh 30C
- A rechargeable battery with high discharge rates
- Used to power the motors and motor drivers in the circuit.
12V Battery
- Provides the necessary voltage for certain components in the circuit that require higher operating voltages.
DC Motors
- Electric motors that convert electrical energy into mechanical energy
- Used for various applications requiring rotational motion.
DC Mini Metal Gear Motor
- A small DC motor with a gearbox for increased torque
- Suitable for applications where space is limited and high torque is required.
Stepper Motor (Bipolar)
- A motor that divides a full rotation into a number of equal steps
- Ideal for precise control of rotation angle, speed, and position.
Wiring Details
Arduino Mega 2560
3V3connected to NRF24L01 VCC (3V)5Vconnected to TB6612FNG Motor Driver VCC and A4988 Stepper Motor Driver VDDGNDconnected to NRF24L01 GND, A4988 Stepper Motor Driver GND, L298N DC Motor Driver GND, and TB6612FNG Motor Driver GNDVINconnected to L298N DC Motor Driver 5VA0connected to L298N DC Motor Driver ENAA1connected to L298N DC Motor Driver ENBA2connected to TB6612FNG Motor Driver PWMBA3connected to TB6612FNG Motor Driver PWMAD2 PWMconnected to A4988 Stepper Motor Driver DIRD3 PWMconnected to A4988 Stepper Motor Driver STEPD7 PWMconnected to NRF24L01 CED8 PWMconnected to NRF24L01 CSND10 PWMconnected to TB6612FNG Motor Driver AI2D11 PWMconnected to TB6612FNG Motor Driver AI1D12 PWMconnected to TB6612FNG Motor Driver BI1D13 PWMconnected to TB6612FNG Motor Driver BI2D24connected to L298N DC Motor Driver IN1D25connected to L298N DC Motor Driver IN2D26connected to L298N DC Motor Driver IN3D27connected to L298N DC Motor Driver IN4D50connected to NRF24L01 MISOD51connected to NRF24L01 MOSID52connected to NRF24L01 SCK
NRF24L01
VCC (3V)connected to Arduino Mega 2560 3V3GNDconnected to Arduino Mega 2560 GNDCEconnected to Arduino Mega 2560 D7 PWMCSNconnected to Arduino Mega 2560 D8 PWMSCKconnected to Arduino Mega 2560 D52MISOconnected to Arduino Mega 2560 D50MOSIconnected to Arduino Mega 2560 D51
L298N DC Motor Driver
GNDconnected to Arduino Mega 2560 GND and LiPo Battery 2200mAh 30C GND5Vconnected to Arduino Mega 2560 VINENAconnected to Arduino Mega 2560 A0ENBconnected to Arduino Mega 2560 A1IN1connected to Arduino Mega 2560 D24IN2connected to Arduino Mega 2560 D25IN3connected to Arduino Mega 2560 D26IN4connected to Arduino Mega 2560 D27OUT1connected to DC Motor pin 2 (Instance 1)OUT2connected to DC Motor pin 1 (Instance 1)OUT3connected to DC Motor pin 2 (Instance 2)OUT4connected to DC Motor pin 1 (Instance 2)12Vconnected to LiPo Battery 2200mAh 30C VCC
TB6612FNG Motor Driver
VCCconnected to Arduino Mega 2560 5VGNDconnected to Arduino Mega 2560 GND, A4988 Stepper Motor Driver GND, and 12V Battery -VMconnected to 12V Battery +PWMBconnected to Arduino Mega 2560 A2PWMAconnected to Arduino Mega 2560 A3AI2connected to Arduino Mega 2560 D10 PWMAI1connected to Arduino Mega 2560 D11 PWMBI1connected to Arduino Mega 2560 D12 PWMBI2connected to Arduino Mega 2560 D13 PWMB01connected to DC Mini Metal Gear Motor IN1 (Instance 1)B02connected to DC Mini Metal Gear Motor IN2 (Instance 1)A02connected to DC Mini Metal Gear Motor IN1 (Instance 2)A01connected to DC Mini Metal Gear Motor IN2 (Instance 2)
A4988 Stepper Motor Driver (Red)
VDDconnected to Arduino Mega 2560 5VGNDconnected to Arduino Mega 2560 GND and TB6612FNG Motor Driver GNDVMOTconnected to 12V Battery +DIRconnected to Arduino Mega 2560 D2 PWMSTEPconnected to Arduino Mega 2560 D3 PWMRESETconnected to A4988 Stepper Motor Driver SLEEP2Bconnected to Stepper Motor (Bipolar) A2Aconnected to Stepper Motor (Bipolar) C1Aconnected to Stepper Motor (Bipolar) B1Bconnected to Stepper Motor (Bipolar) D
LiPo Battery 2200mAh 30C
VCCconnected to L298N DC Motor Driver 12VGNDconnected to L298N DC Motor Driver GND
12V Battery
+connected to TB6612FNG Motor Driver VM and A4988 Stepper Motor Driver VMOT-connected to TB6612FNG Motor Driver GND
DC Motors
pin 1andpin 2of each DC Motor connected to the corresponding OUT pins of the L298N DC Motor Driver
DC Mini Metal Gear Motors
IN1andIN2of each DC Mini Metal Gear Motor connected to the corresponding B01/B02 or A01/A02 pins of the TB6612FNG Motor Driver
Stepper Motor (Bipolar)
A,B,C,Dpins of the Stepper Motor connected to the corresponding 2B/2A/1A/1B pins of the A4988 Stepper Motor Driver
Documented Code
Arduino Mega 2560 Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
The provided code