ESP32-Based Motor Control System with INA219 Current Sensor and ST7735S Display
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This document provides a detailed overview of a circuit that includes an ESP32 microcontroller, an INA219 current sensor, a China ST7735S 160x128 display, a DC power source, a 12V 5A power supply, a resistor, a pushbutton, and a BTS7960 motor driver. The document includes a component list, wiring details, and the embedded code used in the microcontroller.
Component List
ESP32
- Description: A powerful microcontroller with Wi-Fi and Bluetooth capabilities.
- Pins: EN, VP, VN, D34, D35, D32, D33, D25, D26, D27, D14, D12, D13, GND, VIN, 3V3, D15, D2, D4, RX2, TX2, D5, D18, D19, D21, RX0, TX0, D22, D23, BOOT
INA219
- Description: A current sensor that measures the voltage and current of a connected load.
- Pins: VCC, GND, SCL, SDA, VIN -, VIN +
China ST7735S 160x128
- Description: A 160x128 pixel TFT display.
- Pins: GND, VCC, SCL, SDA, RES, DC, CS, BL
DC Power Source
- Description: A generic DC power source.
- Pins: positive, negative
POWER SUPPLY 12V 5AMP
- Description: A 12V 5A power supply.
- Pins: 220V Positive Pole (AC), 220V Negative Pole (AC), GND, GND (DC), 12V-24V Output (DC)
Resistor
- Description: A resistor with a resistance of 10k Ohms.
- Pins: pin1, pin2
- Properties: Resistance: 10000 Ohms
Pushbutton
- Description: A pushbutton switch.
- Pins: Pin 2, Pin 1, Pin 3, Pin 4
BTS7960 Motor Driver
- Description: A motor driver capable of driving high-current motors.
- 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
Wiring Details
ESP32
- 3V3 connected to China ST7735S 160x128 VCC
- VIN connected to INA219 VCC and BTS7960 Motor Driver Pin 5
- GND connected to INA219 GND, BTS7960 Motor Driver Pin 1, and China ST7735S 160x128 GND
- D35 connected to Resistor pin1
- D22 connected to INA219 SCL
- D21 connected to INA219 SDA
- D26 connected to BTS7960 Motor Driver Pin 8
- D27 connected to BTS7960 Motor Driver Pin 4
- D14 connected to BTS7960 Motor Driver Pin 7
- D12 connected to BTS7960 Motor Driver Pin 3
- D2 connected to China ST7735S 160x128 DC
- D4 connected to China ST7735S 160x128 RES
- D5 connected to China ST7735S 160x128 CS
- D18 connected to China ST7735S 160x128 SCL
- D23 connected to China ST7735S 160x128 SDA
INA219
- VCC connected to ESP32 VIN
- GND connected to ESP32 GND
- SCL connected to ESP32 D22
- SDA connected to ESP32 D21
- VIN - connected to DC Power Source positive
- VIN + connected to BTS7960 Motor Driver Pin 10
China ST7735S 160x128
- VCC connected to ESP32 3V3
- GND connected to ESP32 GND
- SCL connected to ESP32 D18
- SDA connected to ESP32 D23
- RES connected to ESP32 D4
- DC connected to ESP32 D2
- CS connected to ESP32 D5
DC Power Source
- positive connected to INA219 VIN -
- negative connected to BTS7960 Motor Driver Pin 9
POWER SUPPLY 12V 5AMP
- GND (DC) connected to BTS7960 Motor Driver Pin 11
- 12V-24V Output (DC) connected to BTS7960 Motor Driver Pin 12
Resistor
- pin1 connected to ESP32 D35
Pushbutton
- Pin 2 connected to Pin 4
- Pin 1 connected to Pin 3
BTS7960 Motor Driver
- Pin 1 connected to ESP32 GND
- Pin 3 connected to ESP32 D12
- Pin 4 connected to ESP32 D27
- Pin 5 connected to ESP32 VIN
- Pin 7 connected to ESP32 D14
- Pin 8 connected to ESP32 D26
- Pin 9 connected to DC Power Source negative
- Pin 10 connected to INA219 VIN +
- Pin 11 connected to POWER SUPPLY 12V 5AMP GND (DC)
- Pin 12 connected to POWER SUPPLY 12V 5AMP 12V-24V Output (DC)
Code Documentation
ESP32 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 ESP32 microcontroller. The setup function is where you initialize your components and settings, and the loop function is where you place the code that needs to run continuously.