The ESP32 Pet Robot project is an interactive mini pet robot featuring animated eyes on an OLED display. This robot responds to various interactions such as touch, sound, and physical movements through an MPU6050 sensor.
- Expressive animated eyes with various moods (happy, angry, sleepy, scared, etc.)
- Motion responsiveness:
- Shake detection
- Tilt detection (left/right)
- Lifted/dropped detection
- Sound response via microphone
- Touch sensor interaction
- Automatic sleep mode when inactive
- Smooth transitions between expressions
- ESP32-C3-DevKitM-1
- SSD1306 OLED Display (128x64)
- MPU6050 Sensor (Gyroscope + Accelerometer)
- Microphone
- TTP223 Touch Sensor
| Component | ESP32 Pin |
|---|---|
| OLED SDA | Pin 8 |
| OLED SCL | Pin 9 |
| TTP223 | Pin 7 |
| Microphone | Pin 4 |
| MPU6050 SDA | Pin 8 |
| MPU6050 SCL | Pin 9 |
FluxGarage_RoboEyes.h: Library for drawing animated eyes on the OLED displayRoboEyesManager.h: Manager for controlling various eye expressions and reactions to inputs- Main file: Implements core logic and reads sensor inputs
- Clone this repository:
git clone https://github.com/SukunDev/ESP32-Pet-Robot.git-
Open the project in Arduino IDE or PlatformIO
-
Install required libraries:
- Adafruit GFX Library
- Adafruit SSD1306
- Adafruit MPU6050
- Adafruit Unified Sensor
-
Upload the code to your ESP32
The robot features several different eye expressions:
- Default: Normal eyes with automatic blinking
- Happy: Smiling eyes with laughing animation
- Angry: Angry eyes with horizontal flickering
- Sleepy: Drowsy eyes half-closed
- Asleep: Sleeping eyes shown as horizontal lines
- Scared/Scare: Frightened eyes with sweat drops and rapid flickering
- Curiosity: Inquisitive eyes that change size when looking sideways
- Tilted Left/Right: Eyes looking left/right when the robot is tilted
-
TTP223 Touch Sensor:
- When eyes are in default/curiosity mode: Triggers happy or angry expression randomly
- When robot is sleeping: Makes the robot angry for being awakened
-
Microphone:
- When robot is sleeping: Triggers scared or angry expression randomly
-
MPU6050 Sensor:
- Shaking: Triggers scared expression
- Lifted/Dropped: Triggers scared expression
- Tilted Left/Right: Eyes look in the direction of the tilt
- Sleep Mode: If no interaction occurs for 5 seconds, the robot enters sleepy mode, and after 10 seconds it falls asleep
- Curiosity Mode: Randomly, the robot enters curiosity mode where eyes move randomly
ESP32-C3-DevKitM-1
├── Pin 8 (SDA) → OLED SDA & MPU6050 SDA
├── Pin 9 (SCL) → OLED SCL & MPU6050 SCL
├── Pin 7 → TTP223 Touch Sensor
├── Pin 4 → Microphone
├── 3V3 → OLED VCC, MPU6050 VCC, and touch sensor VCC
└── GND → OLED GND, MPU6050 GND, Microphone GND, and touch sensor GND
Contributions in the form of pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
MIT License © 2025
