Pocket pet with a screen
A Tamagotchi-style pet on a tiny OLED with three buttons and a buzzer, in an egg-shaped case Faber designed to fit the parts. Feed it, play with it, put it to sleep.
By the Faber team · Featured build · 2026-11-17
The prompt
“A little virtual pet with a screen and buttons, in an egg-shaped case.”
How it was built
- Describe it. "A little virtual pet with a screen and buttons, in an egg-shaped case." Faber picked an SSD1306 OLED on I2C, three buttons and an active buzzer.
- Wire it. The OLED needs only four wires (power plus SDA on A4 and SCL on A5). Each button goes from its pin to GND; the sketch turns on the internal pull-up, so no resistors are needed.
- Upload the sketch (Adafruit_SSD1306 and Adafruit_GFX libraries). The pet has food, happiness and energy from 0 to 100. Every second awake: food -2, happiness -1, energy -1. Feed adds 25 food, Play adds 20 happiness and costs 10 energy, Sleep dims the screen and restores energy. Under 20 on any stat it looks sad and beeps every 5 seconds.
- Test it in the simulator. Six scenarios ran on the real firmware: it boots and draws, feed fills food, play beeps, sleep dims and wakes, neglect makes it sad, and it keeps running on Serial if the screen doesn't answer.
- Print the case. Faber checked the board, screen and buttons fit inside the egg and exported files for a 3D printer. Print it in two halves, mount the OLED behind the window, and close it up.
Wiring
| From | To | Note |
|---|---|---|
| OLED GND, VCC | Uno GND, 5V | |
| OLED SDA | Uno A4 | I2C data |
| OLED SCL | Uno A5 | I2C clock |
| Feed button | Uno D2 and GND | INPUT_PULLUP, pressed = LOW |
| Play button | Uno D3 and GND | |
| Sleep button | Uno D4 and GND | |
| Buzzer + / - | Uno D8 / GND |
What the simulator tested
- Hatches, draws the pet and reports its stats on Serial.
- Feed raises food by 25 (capped at 100); play makes it happier, costs energy and beeps.
- Sleep dims the screen and restores energy; a second press wakes it.
- Left alone it gets sad and beeps for care every 5 s.
- With a missing OLED it keeps running headless on Serial.
What it doesn't prove
- OLED flicker, button bounce and buzzer loudness are not simulated (the sketch debounces anyway).
- Battery life in the case still needs a real measurement.
- The printed case's feel and tolerances depend on your printer.
Describe it in one sentence. Faber picks the parts, wires them, writes and tests the code, and designs a case.