Circuit Documentation
Summary
This circuit involves an Arduino UNO, an ESP32, a 12V single-channel relay, a TB6600 micro-stepping motor driver, a BTS7960 motor driver, a 12V battery, a DC motor, and a bipolar stepper motor. The Arduino UNO is the primary microcontroller, controlling the relay and motor drivers to manage the DC motor and stepper motor. The ESP32 is also included in the circuit, potentially for additional control or communication purposes.
Component List
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- 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
ESP32 (30 pin)
- Description: A low-cost, low-power system on a chip microcontroller with integrated Wi-Fi and dual-mode Bluetooth.
- Pins: EN, VP, VN, D34, D35, D32, D33, D25, D26, D27, D14, D12, D13, GND, Vin, D23, D22, TX0, RX0, D21, D19, D18, D5, TX2, RX2, D4, D2, D15, 3V3
12V SINGLE CHANNEL RELAY
- Description: A relay module that allows a microcontroller to control high voltage devices.
- Pins: NC, COM, NO, IN, GND, VCC
TB6600 Micro Stepping Motor Driver
- Description: A stepper motor driver capable of driving bipolar stepper motors.
- Pins: ENA-, ENA+, DIR-, DIR+, PUL-, PUL+, B-, B+, A-, A+, GND, VCC
BTS7960 Motor Driver
- Description: A high-power motor driver module.
- Pins: Pin 1, Pin 2, Pin 3, Pin 4, Pin 5, Pin 6, Pin 7, Pin 8, Pin 9, Pin 10, Pin 11, Pin 12
Battery 12V
- Description: A 12V battery used to power the circuit.
- Pins: -, +
DC Motor
- Description: A simple DC motor.
- Pins: pin 1, pin 2
Stepper Motor (Bipolar)
- Description: A bipolar stepper motor.
- Pins: D, B, C, A
Wiring Details
Arduino UNO
- 5V connected to VCC of 12V SINGLE CHANNEL RELAY, TB6600 Micro Stepping Motor Driver, Vin of ESP32, Pin 5 of BTS7960 Motor Driver, Pin 1 and Pin 5 of another BTS7960 Motor Driver.
- GND connected to GND of 12V SINGLE CHANNEL RELAY, TB6600 Micro Stepping Motor Driver, DIR- and PUL- of TB6600 Micro Stepping Motor Driver, GND of ESP32, Pin 1 of BTS7960 Motor Driver.
- D11 connected to Pin 8 of BTS7960 Motor Driver.
- D10 connected to Pin 4 of BTS7960 Motor Driver.
- D9 connected to Pin 4 of another BTS7960 Motor Driver.
- D8 connected to IN of 12V SINGLE CHANNEL RELAY.
- D7 connected to Pin 3 and Pin 7 of BTS7960 Motor Driver.
- D6 connected to Pin 8 of another BTS7960 Motor Driver.
- D5 connected to Pin 3 and Pin 7 of another BTS7960 Motor Driver.
- D4 connected to DIR+ of TB6600 Micro Stepping Motor Driver.
- D3 connected to PUL+ of TB6600 Micro Stepping Motor Driver.
ESP32 (30 pin)
- Vin connected to 5V of Arduino UNO.
- GND connected to GND of Arduino UNO.
12V SINGLE CHANNEL RELAY
- VCC connected to 5V of Arduino UNO.
- GND connected to GND of Arduino UNO.
- IN connected to D8 of Arduino UNO.
- COM connected to + of Battery 12V and Pin 11 of BTS7960 Motor Driver.
- NO connected to pin 1 of DC Motor.
TB6600 Micro Stepping Motor Driver
- VCC connected to 5V of Arduino UNO.
- GND connected to GND of Arduino UNO.
- DIR- connected to GND of Arduino UNO.
- PUL- connected to GND of Arduino UNO.
- DIR+ connected to D4 of Arduino UNO.
- PUL+ connected to D3 of Arduino UNO.
- B- and B+ connected to B of Stepper Motor.
- A- and A+ connected to A of Stepper Motor.
BTS7960 Motor Driver
- Pin 1 connected to 5V of Arduino UNO.
- Pin 3 connected to D7 of Arduino UNO.
- Pin 4 connected to D10 of Arduino UNO.
- Pin 5 connected to 5V of Arduino UNO.
- Pin 7 connected to D7 of Arduino UNO.
- Pin 8 connected to D11 of Arduino UNO.
- Pin 9 connected to pin 2 of DC Motor.
- Pin 10 connected to pin 1 of DC Motor.
- Pin 11 connected to COM of 12V SINGLE CHANNEL RELAY.
- Pin 12 connected to - of Battery 12V.
Battery 12V
- + connected to COM of 12V SINGLE CHANNEL RELAY and Pin 11 of BTS7960 Motor Driver.
- - connected to Pin 12 of BTS7960 Motor Driver and pin 2 of DC Motor.
DC Motor
- pin 1 connected to NO of 12V SINGLE CHANNEL RELAY.
- pin 2 connected to - of Battery 12V.
Stepper Motor (Bipolar)
- B connected to B- and B+ of TB6600 Micro Stepping Motor Driver.
- A connected to A- and A+ of TB6600 Micro Stepping Motor Driver.
Documented Code
int relayPin = 8;
int motorEnablePin = 7;
int motorDirectionPin = 6;
int motorPWM = 9;
void setup() {
pinMode(relayPin, OUTPUT);
pinMode(motorEnablePin, OUTPUT);
pinMode(motorDirectionPin, OUTPUT);
pinMode(motorPWM, OUTPUT);
}
void loop() {
digitalWrite(relayPin, HIGH);
delay(2000);
digitalWrite(relayPin, LOW);
delay(2000);
digitalWrite(motorEnablePin, HIGH);
digitalWrite(motorDirectionPin, HIGH);
analogWrite(motorPWM, 128);
delay(2000);
digitalWrite(motorDirectionPin, LOW);
analogWrite(motorPWM, 128);
delay(2000);
digitalWrite(motorEnablePin, LOW);
delay(2000);
}
This code is for the Arduino UNO and controls the relay and BTS7960 motor driver to manage the DC motor. The relay is toggled on and off every 2 seconds, and the motor driver is used to control the motor's direction and speed.