👀 Build a Cute Desktop Companion with ESP32 & OLED!
Make your own tiny desk buddy with big blinking eyes that react to you! This little companion uses an ESP32 microcontroller, an OLED screen for its animated face, and a touch sensor so it knows when you're nearby.
What You'll Build
A small box or 3D-printed shell holding an ESP32 (the "brain") and a tiny OLED display (the "face"). The companion blinks, looks around, and shows happy or sleepy expressions, with a touch sensor that makes it wake up and look at you when you tap it!
🎯 Why Kids Love This Robotics Project
This ESP32 robotics project for kids is special because it gives a robot real personality through simple animated eyes — no motors or wheels needed! It's a perfect first step into electronics, displays, and code, and the result is something you'll want to keep on your desk forever.
🧰 Materials You Need
🛠️ Step-by-Step Building Instructions
Prepare the Body
Pick a small box (or 3D print a tiny shell) about the size of your palm. Cut a rectangular window on the front where the OLED screen's "face" will peek through.
Mount the OLED Screen
Glue the OLED display behind the window from the inside, so the screen lines up neatly with the cut-out, like a little face peeking out.
Place the ESP32 Inside
Mount the ESP32 board inside the body, with its USB port accessible from the back or bottom for easy charging and reprogramming.
Add the Touch Sensor (Optional)
Glue the small touch sensor module to the top of the box, like a little "pat the head" button, so your companion knows when you're saying hello.
Wire Everything Together
Connect the OLED display and touch sensor to the ESP32 using the circuit diagram below. Double-check connections before powering on.
Install the Software
In the Arduino IDE, install the ESP32 board package, plus the Adafruit_GFX and Adafruit_SSD1306 libraries for the OLED screen.
Upload the Code
Copy the code below into the Arduino IDE, select your ESP32 board and port, then click Upload. Your companion's eyes should appear on the screen!
Decorate & Enjoy
Add fun details like ears, antennae, or a painted shell. Give your companion a name and place it proudly on your desk!
🔌 Circuit Diagram
Layout:
ESP32 DEV BOARD
┌────────────────────┐
│ 3V3 ●──────┬───────┼── OLED VCC
│ GND ●──┬───┼───┬───┼── OLED GND
│ GPIO21●─┼───┼───┼───┼── OLED SDA
│ GPIO22●─┼───┼───┼───┼── OLED SCL
│ GPIO4 ●─┼───┴───┼───┼── Touch Sensor Signal
└────────────────────┘
│ │
Touch GND Touch VCC (3V3)
| Component | Wire | ESP32 Pin |
|---|---|---|
| OLED Display | VCC | 3V3 |
| OLED Display | GND | GND |
| OLED Display | SDA | GPIO 21 |
| OLED Display | SCL | GPIO 22 |
| Touch Sensor | Signal (OUT) | GPIO 4 |
| Touch Sensor | VCC / GND | 3V3 / GND |
Tip: Most 0.96" OLED screens use the I2C address 0x3C — if your screen stays blank, try scanning for the correct address with an I2C scanner sketch.
💻 Arduino Code
desktop_companion.ino#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
#define TOUCH_PIN 4
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
unsigned long lastBlink = 0;
bool eyesClosed = false;
void drawEyes(bool closed, bool happy) {
display.clearDisplay();
int eyeY = 24;
int leftX = 36;
int rightX = 92;
int eyeW = 22;
int eyeH = closed ? 4 : 28;
display.fillRoundRect(leftX - eyeW/2, eyeY - eyeH/2, eyeW, eyeH, 6, SSD1306_WHITE);
display.fillRoundRect(rightX - eyeW/2, eyeY - eyeH/2, eyeW, eyeH, 6, SSD1306_WHITE);
if (happy && !closed) {
// little smile under the eyes
display.drawLine(50, 50, 64, 56, SSD1306_WHITE);
display.drawLine(64, 56, 78, 50, SSD1306_WHITE);
}
display.display();
}
void setup() {
pinMode(TOUCH_PIN, INPUT);
Wire.begin();
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
drawEyes(false, false);
}
void loop() {
bool touched = digitalRead(TOUCH_PIN);
// Blink every few seconds
if (millis() - lastBlink > 4000) {
drawEyes(true, touched);
delay(150);
drawEyes(false, touched);
lastBlink = millis();
}
if (touched) {
drawEyes(false, true); // happy face when touched
}
delay(50);
}
🌟 Tips for a Cuter Companion
- Try changing the eye shape (circles instead of rounded rectangles) for a different personality.
- Add a "sleepy" mode that slowly closes the eyes if no one touches the sensor for a long time.
- Use translucent paper over the screen window for a soft, glowing look.
- Experiment with eye movement by shifting the X position left and right over time.
- Keep wiring neat with small zip ties so the box closes smoothly.
❓ Frequently Asked Questions
Do I need to know how to code to build this?
No! The code above is ready to copy and upload. Just install the required libraries first, then click Upload in the Arduino IDE.
Can I skip the touch sensor?
Yes, the companion will still blink on its own without it — the touch sensor just adds an extra interactive "say hello" feature.
Why is my OLED screen blank?
Double-check the SDA/SCL wiring and confirm your screen's I2C address (usually 0x3C or 0x3D) matches what's in the code.
What age group is this project good for?
With adult help for wiring and software setup, kids aged 9 and up can enjoy building and personalizing this project.
🏆 You Did It!
You just built your very own desk companion with a face full of personality! Give it a name, decorate its shell, and try adding new expressions like winking or surprised eyes by tweaking the code.

Comments
Post a Comment