Arduino UNO Controlled 8-Motor System with Keypad and DFPlayer Mini
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to control 8 DC motors using an Arduino UNO, an 8-channel relay module, and a 4x4 membrane matrix keypad. Additionally, a DFPlayer Mini MP3 player is included to provide audio feedback. The circuit is powered by a 12V 200Ah battery.
Component List
12V 200Ah Battery
- Pins: GND, 12V
- Description: Provides power to the entire circuit.
DC Mini Metal Gear Motor
- Pins: IN1, IN2
- Description: Drives mechanical components.
DFPlayer MINI
- Pins: VCC, BUSY, RX, USB -, TX, USB +, DAC_R, K2/ADC_KEY, DAC_L, K1/ADC_KEY, SPK1, IO 2, GND, SPK2, IO 1
- Description: Plays MP3 files from a microSD card.
Arduino UNO
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
- Description: Microcontroller that controls the entire circuit.
8 Channel Relay JD-VCC
- Pins: JD-VCC, VCC, GND, In8, In7, In6, In5, In4, In3, In2, In1, In1_NC, IN1_COM, IN1_NO, IN2_NC, IN2_COM, IN2_NO, IN3_NC, IN3_COM, IN3_NO, IN4_NC, IN4_COM, IN4_NO, IN5_NC, IN5_COM, IN5_NO, IN6_NC, IN6_COM, IN6_NO, IN7_NC, IN7_COM, IN7_NO, IN8_NC, IN8_COM, IN8_NO
- Description: Controls the power to the motors.
4X4 Membrane Matrix Keypad
- Pins: R1, R2, R3, R4, C1, C2, C3, C4
- Description: Provides user input to control the motors.
Loudspeaker
- Pins: pin1, pin2
- Description: Outputs audio from the DFPlayer Mini.
Wiring Details
12V 200Ah Battery
- GND: Connected to GND of the 8 Channel Relay JD-VCC.
- 12V: Connected to IN2 of all DC Mini Metal Gear Motors.
DC Mini Metal Gear Motor
- IN1: Connected to IN1_COM, IN2_COM, IN3_COM, IN4_COM, IN5_COM, IN6_COM, IN7_COM, IN8_COM of the 8 Channel Relay JD-VCC.
- IN2: Connected to 12V of the 12V 200Ah Battery.
DFPlayer MINI
- VCC: Connected to 5V of the Arduino UNO.
- GND: Connected to GND of the Arduino UNO.
- RX: Connected to D1 of the Arduino UNO.
- TX: Connected to D0 of the Arduino UNO.
- SPK1: Connected to pin1 of the Loudspeaker.
- SPK2: Connected to pin2 of the Loudspeaker.
Arduino UNO
- 5V: Connected to VCC of the DFPlayer MINI and VCC of the 8 Channel Relay JD-VCC.
- GND: Connected to GND of the DFPlayer MINI and GND of the 8 Channel Relay JD-VCC.
- A0: Connected to In5 of the 8 Channel Relay JD-VCC.
- A1: Connected to In6 of the 8 Channel Relay JD-VCC.
- A2: Connected to In7 of the 8 Channel Relay JD-VCC.
- A3: Connected to In8 of the 8 Channel Relay JD-VCC.
- D13: Connected to In4 of the 8 Channel Relay JD-VCC.
- D12: Connected to In3 of the 8 Channel Relay JD-VCC.
- D11: Connected to In2 of the 8 Channel Relay JD-VCC.
- D10: Connected to In1 of the 8 Channel Relay JD-VCC.
- D9: Connected to R1 of the 4X4 Membrane Matrix Keypad.
- D8: Connected to R2 of the 4X4 Membrane Matrix Keypad.
- D7: Connected to R3 of the 4X4 Membrane Matrix Keypad.
- D6: Connected to R4 of the 4X4 Membrane Matrix Keypad.
- D5: Connected to C1 of the 4X4 Membrane Matrix Keypad.
- D4: Connected to C2 of the 4X4 Membrane Matrix Keypad.
- D3: Connected to C3 of the 4X4 Membrane Matrix Keypad.
- D2: Connected to C4 of the 4X4 Membrane Matrix Keypad.
8 Channel Relay JD-VCC
- VCC: Connected to 5V of the Arduino UNO.
- GND: Connected to GND of the Arduino UNO.
- In1: Connected to D10 of the Arduino UNO.
- In2: Connected to D11 of the Arduino UNO.
- In3: Connected to D12 of the Arduino UNO.
- In4: Connected to D13 of the Arduino UNO.
- In5: Connected to A0 of the Arduino UNO.
- In6: Connected to A1 of the Arduino UNO.
- In7: Connected to A2 of the Arduino UNO.
- In8: Connected to A3 of the Arduino UNO.
- IN1_COM: Connected to IN1 of the first DC Mini Metal Gear Motor.
- IN2_COM: Connected to IN1 of the second DC Mini Metal Gear Motor.
- IN3_COM: Connected to IN1 of the third DC Mini Metal Gear Motor.
- IN4_COM: Connected to IN1 of the fourth DC Mini Metal Gear Motor.
- IN5_COM: Connected to IN1 of the fifth DC Mini Metal Gear Motor.
- IN6_COM: Connected to IN1 of the sixth DC Mini Metal Gear Motor.
- IN7_COM: Connected to IN1 of the seventh DC Mini Metal Gear Motor.
- IN8_COM: Connected to IN1 of the eighth DC Mini Metal Gear Motor.
4X4 Membrane Matrix Keypad
- R1: Connected to D9 of the Arduino UNO.
- R2: Connected to D8 of the Arduino UNO.
- R3: Connected to D7 of the Arduino UNO.
- R4: Connected to D6 of the Arduino UNO.
- C1: Connected to D5 of the Arduino UNO.
- C2: Connected to D4 of the Arduino UNO.
- C3: Connected to D3 of the Arduino UNO.
- C4: Connected to D2 of the Arduino UNO.
Loudspeaker
- pin1: Connected to SPK1 of the DFPlayer MINI.
- pin2: Connected to SPK2 of the DFPlayer MINI.
Documented Code
Main Sketch
#include <Keypad.h>
#include <SoftwareSerial.h>
#include "DFRobotDFPlayerMini.h"
static const uint8_t PIN_MP3_TX = 1; // Connects to module's RX
static const uint8_t PIN_MP3_RX = 0; // Connects to module's TX
SoftwareSerial softwareSerial(PIN_MP3_RX, PIN_MP3_TX);
// Create the Player object
DFRobotDFPlayerMini player;
// Define the keypad
const byte ROWS = 4; // Four rows
const byte COLS = 4; // Four columns
char keys[ROWS][COLS] = {
{'1','2','3','A'},
{'4','5','6','B'},
{'7','8','9','C'},
{'*','0','#','D'}
};
byte rowPins[ROWS] = {9, 8, 7, 6}; // Connect to the row pinouts of the keypad
byte colPins[COLS] = {5, 4, 3, 2}; // Connect to the column pinouts of the keypad
Keypad keypad = Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);
// Define relay pins
const int relayPins[8] = {10, 11, 12, 13, A0, A1, A2, A3};
void setup() {
// Initialize relay pins as outputs
for (int i = 0; i < 8; i++) {
pinMode(relayPins[i], OUTPUT);
digitalWrite(relayPins[i], LOW); // Ensure all relays are off initially
}
Serial.begin(9600);