ESP32-Controlled Automated Transport System with OLED Display and Stepper Motor
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to control a variety of components including an ESP32 microcontroller, OLED display, stepper motor with ULN2003A driver, IO expander, RGB LED, micro switches, joystick, single LEDs, a buzzer, toggle switches, and a WS2812 RGB LED matrix. The ESP32 is the central processing unit that interfaces with an OLED display for user feedback, controls a stepper motor for mechanical movements, reads inputs from a joystick and micro switches, drives LEDs for visual indicators, and sounds a buzzer for audio alerts. The circuit is powered by a 9V battery and uses I2C communication for the OLED display and IO expander.
Component List
- ESP32 (30 pin): A microcontroller with WiFi and Bluetooth capabilities, featuring a variety of digital and analog pins for interfacing with other components.
- 128x64 OLED Display (I2C IIC SPI Serial): A small display for showing system status and messages to the user.
- ULN2003A breakout board: A driver board used to control a stepper motor.
- PCF8575 IO Expander Module I2C 16 PIN: An I2C interface chip that expands the number of available IO pins.
- LED RGB: A multicolor LED that can display various colors based on input signals.
- Micro Switch: A switch that changes state when actuated.
- PS2 Joystick: An analog input device that provides two-dimensional control.
- LED: Two Pin (red): A simple red LED for indication purposes.
- WS2812 RGB LED matrix 1x8: A chainable LED strip with individually addressable RGB LEDs.
- LED: Two Pin (green): A simple green LED for indication purposes.
- Buzzer: An audio signaling device.
- Toggle Switch spst: A single-pole single-throw switch for manual control.
- Resistor: A component that provides electrical resistance; used here to limit current to LEDs.
- 28BYJ-48 Stepper Motor: A small stepper motor for precise control of mechanical movement.
- 9V Battery: The power source for the circuit.
Wiring Details
ESP32 (30 pin)
VPconnected to PS2 JoystickS - XD34connected to PS2 JoystickS - YD32connected to LED RGBGD33connected to LED RGBRD25,D26,D27,D14connected to corresponding inputs on ULN2003A breakout boardD12connected to LED RGBBD13connected to Toggle Switch spstCOMGNDconnected to various GND pins on other components3V3connected to VCC pins on OLED Display, WS2812 RGB LED matrix, PS2 Joystick, and PCF8575 IO ExpanderD22,D21connected to SCL and SDA pins on OLED Display and PCF8575 IO ExpanderD18,D5connected to COM pins on Toggle Switch spstRX2connected to PCF8575 IO ExpanderINTD4connected to buzzerPIND15connected to PS2 JoystickS - K
ULN2003A breakout board
0Vand+5Vconnected to 9V Battery-and+respectivelyBLUE wire,PINK wire,YELLOW wire,ORANGE wire,RED wireconnected to corresponding wires on 28BYJ-48 Stepper Motor
PCF8575 IO Expander Module I2C 16 PIN
GND,VCCconnected to common GND and 3V3 linesSDA,SCLconnected to ESP32D21andD22INTconnected to ESP32RX2P00,P01connected to anodes of green and red LEDs respectivelyP04,P05,P06,P07connected to COM pins on Micro Switches and Toggle Switch spst
LED RGB
R,G,Bconnected to ESP32D33,D32,D12-connected to common GND line
Micro Switches
COMconnected to PCF8575 IO ExpanderP04,P05
PS2 Joystick
S - Y,S - X,S - Kconnected to ESP32D34,VP,D15VCC,GNDconnected to common 3V3 and GND lines
Single LEDs (red and green)
anodeconnected to PCF8575 IO ExpanderP00,P01cathodeconnected to common GND line through 200 Ohm resistors
WS2812 RGB LED matrix 1x8
VCC,GNDconnected to common 3V3 and GND linesDINnot connected in the provided net list
Buzzer
PINconnected to ESP32D4GNDconnected to common GND line
Toggle Switches spst
COMconnected to ESP32D13,D18,D5and PCF8575 IO ExpanderP06,P07
Resistor
pin1connected to LED cathodespin2connected to common GND line
28BYJ-48 Stepper Motor
BLUE,PINK,YELLOW,ORANGE,REDconnected to corresponding wires on ULN2003A breakout board
9V Battery
-,+connected to ULN2003A breakout board0V,+5V
Documented Code
ESP32 Microcontroller Code
// Libraries
#include <Arduino.h>
#include <U8g2lib.h>
#include <Adafruit_SSD1306.h>
#include <Wire.h>
#include <EEPROM.h>
#include <FastLED.h>
// ... (Code omitted for brevity)
void setup() {
init();
// FastLED setup for WS2812 RGB LED matrix
FastLED.addLeds<WS2812, DATA_PIN_VOOR, GRB>(ledsVoor, NUM_LEDSVoor);
}
void loop() {
// Main loop code
}
// Initialization function
void init() {
// Serial and I2C initialization
// Pin mode configuration
// Interrupt setup
// PCF8574 initialization
// Motor pin setup
}
// ... (Additional functions omitted for brevity)
// EEPROM initialization and handling
void eeprominit() {
// EEPROM read and write operations
}
// ... (Additional functions omitted for brevity)
The provided code for the ESP32 microcontroller includes initialization of various peripherals such as the OLED display, stepper motor, and FastLED library for the WS2812 RGB LED matrix. It also includes functions for handling interrupts, motor control, display updates, LED control, buzzer alarms, and EEPROM read/write operations. The code is structured with setup and loop functions, as well as numerous helper functions for specific tasks.
(Note: The code above is a summarized version of the provided code. It includes comments and structure to give an overview of the functionality. The full code includes detailed logic for motor control, display handling, LED operations, and more.)
Additional Microcontroller Code
The additional microcontroller code provided is minimal and does not include any functional code. It consists of empty setup and loop functions, which are placeholders for potential future code.
void setup() {
// Setup code
}
void loop() {
// Main loop code
}
The documentation above provides an overview of the circuit, detailed component descriptions, wiring information, and a summary of the embedded code. This should serve as a comprehensive guide for understanding and working with the circuit.