Arduino and ESP32-Based Smart Motor Control with Ultrasonic Sensor and LCD Display
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit involves an Arduino UNO, an ESP32, a 5V relay, a 16x2 I2C LCD, an ultrasonic sensor, a DC motor, and a power source. The Arduino UNO is the primary microcontroller, interfacing with the ultrasonic sensor, the relay, and the LCD. The ESP32 is used to control another relay. The relays are used to control a DC motor and a 220V power source.
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
5V Relay
- Description: An electromechanical switch used to control high voltage devices.
- Pins: Normally Open, Common terminal, Normally Closed, In, GND, VCC
Power 220V
- Description: A high voltage power source.
- Pins: hot wire, neutral wire
DC Motor
- Description: A motor that runs on direct current.
- Pins: pin 1, pin 2
Ultrasonic Sensor
- Description: A sensor used to measure distance using ultrasonic waves.
- Pins: +VCC, Trigger, Echo, GND
ESP32
- 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, 3V3, D15, D2, D4, RX2, TX2, D5, D18, D19, D21, RX0, TX0, D22, D23, BOOT
16x2 I2C LCD
- Description: A 16x2 character LCD display with I2C interface.
- Pins: GND, VCC, SDA, SCL
Wiring Details
Arduino UNO
- GND: Connected to GND of Ultrasonic Sensor, 5V Relay, and 16x2 I2C LCD
- 5V: Connected to +VCC of Ultrasonic Sensor, VCC of 16x2 I2C LCD, and VCC of 5V Relay
- A4: Connected to SDA of 16x2 I2C LCD
- A5: Connected to SCL of 16x2 I2C LCD
- D8: Connected to In of 5V Relay
- D3: Connected to Echo of Ultrasonic Sensor
- D2: Connected to Trigger of Ultrasonic Sensor
5V Relay (First Instance)
- GND: Connected to GND of Arduino UNO
- VCC: Connected to 5V of Arduino UNO
- In: Connected to D8 of Arduino UNO
- Normally Open: Connected to hot wire of Power 220V
- Common terminal: Connected to Normally Open of second 5V Relay
5V Relay (Second Instance)
- GND: Connected to GND of ESP32
- VCC: Connected to 3V3 of ESP32
- In: Connected to D12 of ESP32
- Normally Open: Connected to Common terminal of first 5V Relay
- Common terminal: Connected to pin 1 of DC Motor
Power 220V
- hot wire: Connected to Normally Open of first 5V Relay
- neutral wire: Connected to pin 2 of DC Motor
DC Motor
- pin 1: Connected to Common terminal of second 5V Relay
- pin 2: Connected to neutral wire of Power 220V
Ultrasonic Sensor
- GND: Connected to GND of Arduino UNO
- +VCC: Connected to 5V of Arduino UNO
- Trigger: Connected to D2 of Arduino UNO
- Echo: Connected to D3 of Arduino UNO
ESP32
- GND: Connected to GND of second 5V Relay
- 3V3: Connected to VCC of second 5V Relay
- D12: Connected to In of second 5V Relay
16x2 I2C LCD
- GND: Connected to GND of Arduino UNO
- VCC: Connected to 5V of Arduino UNO
- SDA: Connected to A4 of Arduino UNO
- SCL: Connected to A5 of Arduino UNO
Documented Code
Arduino UNO Code (sketch.ino)
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
Arduino UNO Documentation (documentation.txt)