Skip to content

SukunDev/ESP32-Pet-Robot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP32 Pet Robot

Wokwi Simulator

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.

Features

  • 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

Hardware Components

  • ESP32-C3-DevKitM-1
  • SSD1306 OLED Display (128x64)
  • MPU6050 Sensor (Gyroscope + Accelerometer)
  • Microphone
  • TTP223 Touch Sensor

Pin Configuration

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

Code Structure

  • FluxGarage_RoboEyes.h: Library for drawing animated eyes on the OLED display
  • RoboEyesManager.h: Manager for controlling various eye expressions and reactions to inputs
  • Main file: Implements core logic and reads sensor inputs

Installation

  1. Clone this repository:
git clone https://github.com/SukunDev/ESP32-Pet-Robot.git
  1. Open the project in Arduino IDE or PlatformIO

  2. Install required libraries:

    • Adafruit GFX Library
    • Adafruit SSD1306
    • Adafruit MPU6050
    • Adafruit Unified Sensor
  3. Upload the code to your ESP32

How It Works

Eye Expressions

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

Interactions

  1. 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
  2. Microphone:

    • When robot is sleeping: Triggers scared or angry expression randomly
  3. MPU6050 Sensor:

    • Shaking: Triggers scared expression
    • Lifted/Dropped: Triggers scared expression
    • Tilted Left/Right: Eyes look in the direction of the tilt

Automatic Modes

  • 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

Wiring Diagram

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

Contributing

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.

Lisensi

MIT License © 2025

About

Interactive ESP32 pet robot with expressive OLED eyes. Responds to touch, sound, and motion with emotions like happy, angry, sleepy, and scared. Features automatic sleep modes and smooth animations. Perfect for learning robotics!

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages