Create a diy desk companion using esp32

Cute DIY Desktop Companion with ESP32 & OLED | Easy Robotics Project for Kids
Kid-Friendly Robotics Project

👀 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.

Fun Fact: The ESP32 chip inside your companion is so powerful it also has built-in Wi-Fi and Bluetooth — the same chip is used in smart home gadgets all over the world!

🧰 Materials You Need

🔧ESP32 Dev Board
🖤0.96" OLED Display (I2C, SSD1306)
👆Touch sensor (TTP223) - optional
🔋USB cable / small battery
🔗Jumper wires
📦Small box or 3D-printed shell
🧵Hot glue / double-sided tape
🎨Craft decorations (optional)

🛠️ Step-by-Step Building Instructions

1

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.

2

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.

3

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.

4

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.

5

Wire Everything Together

Connect the OLED display and touch sensor to the ESP32 using the circuit diagram below. Double-check connections before powering on.

6

Install the Software

In the Arduino IDE, install the ESP32 board package, plus the Adafruit_GFX and Adafruit_SSD1306 libraries for the OLED screen.

7

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!

8

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)
      
ComponentWireESP32 Pin
OLED DisplayVCC3V3
OLED DisplayGNDGND
OLED DisplaySDAGPIO 21
OLED DisplaySCLGPIO 22
Touch SensorSignal (OUT)GPIO 4
Touch SensorVCC / GND3V3 / 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);
}
How it works: The OLED screen draws two rounded rectangles for "eyes." Every few seconds, the code shrinks them to a thin line to make a quick blink, then pops them back open. When the touch sensor is pressed, a tiny smile line appears — instant happy face!

🌟 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.

Made with 💜 pixels, code, and curiosity — Happy Building!

Comments

Product Cards
Buddy Bot eBook
⭐ New 2026 Release
Build Your
Own Robot!
3D design, wiring &
Arduino coding.
Young inventors love it!
🖨️
3D Print
All parts
Wire it
Circuit guide
💻
Code it
Arduino IDE
🤖
Watch it
Walk & react
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Website Offer
₹499 300
🌍 International: $5 USD
One-time · Instant digital delivery
🔒 Secured by Razorpay · Your data is safe
📄 Download Free Sample Copy
🔒 Secured by Razorpay · Your data is safe
🍓
Raspberry Pi Pico Mastery
21 Projects
⚡ Launch Price — 80% OFF
Learn Pico
Build 21 Projects!
MicroPython · Wokwi
IoT · Certificate
Perfect for beginners!
🖥️
Wokwi
No hardware
🐍
MicroPy
From zero
🔨
21 Projects
IoT + sensors
📄
Certificate
Verified cert
📋 Your Details
Enter your name
Valid 10-digit no.
Enter a valid email
Special Launch Offer
₹999 200 80% OFF
🌍 International: $5 USD
One-time · Lifetime access · No subscription
🔒 Secured by Razorpay · UPI · Cards · NetBanking
🎉

You're in!

Payment successful! Your Buddy Bot eBook is ready. Time to build!

📖 Access Your eBook Now
🎉

Enrolled!

Payment successful! Lifetime access to all 21 Pico Projects is yours!

🍓 Go to My Course