Skip to content

Dcodder33/desk_bot_v7

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– DeskBot v7

Your emotionally intelligent desk companion

An ESP32-powered OLED robot with a living personality โ€” it gets bored, angry, sleepy, and even dies dramatically if you ignore it long enough. Built with โค๏ธ and 6,600+ lines of hand-crafted C++.

License: MIT Platform Display Phone


    โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
    โ”‚  โ—‰       โ—‰  โ”‚
    โ”‚     โ”€โ”€โ”€     โ”‚
    โ”‚    \___/    โ”‚
    โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
      DeskBot v7

โœจ What Is This?

DeskBot is a tiny robot that sits on your desk and feels things. It's not a smart assistant โ€” it's a companion. It watches your phone notifications, reacts to your music, reminds you to drink water, and develops genuine emotional attachment based on how you treat it.

Leave it alone too long? It gets bored, then angry, then furious. Beat it (tap it too many times)? It gets knocked out with spinning cartoon stars. Pet it gently? It purrs with hearts floating up. Ignore it for days? It dies dramatically and reboots with amnesia.

This is not a utility. It's a relationship.


๐Ÿง  The Emotional Engine

DeskBot runs a deeply layered emotional simulation โ€” not random mood cycling, but a reactive personality with memory, escalation, and consequences.

๐ŸŽญ Base Moods

Mood Visual Trigger
๐Ÿ˜Š Alive Blinking, breathing, looking around Default happy state
๐Ÿ’• Love Heart eyes, floating hearts High affection + petting
๐Ÿ˜ก Angry Sharp brows, fire animation Being beaten or ignored
๐Ÿ˜ข Sad Drooping eyes, falling tears Low affection, rejection
๐Ÿ˜ต Dizzy Spiral eyes, wobbling After being hit repeatedly
๐Ÿคฉ Excited Big eyes, bouncing body New notifications, music
๐Ÿ˜จ Scared Shaking, sweat drops Alarms, sudden events
๐Ÿ˜ Smug Half-lidded, slight smirk High affection flex
๐Ÿ• Clock Full-screen time display Auto or knock pattern
๐ŸŒค๏ธ Weather Animated weather scene Auto or knock pattern

๐ŸŽญ Overlay Expressions (10 total)

These layer on top of base moods for complex emotional blends:

Nervous โ”€โ”€โ”€ shaking body + sweat drops
Sleepy โ”€โ”€โ”€โ”€ drooping eyelids
Shocked โ”€โ”€โ”€ maxed wide eyes + jaw drop
Disgusted โ”€ squinted eye + curled lip
Embarrassed eyes looking away + blush circles
Thinking โ”€โ”€ one brow up + side glance
Hyper โ”€โ”€โ”€โ”€โ”€ pupils dart randomly
Pain โ”€โ”€โ”€โ”€โ”€โ”€ X-eyes + zigzag mouth
Melting โ”€โ”€โ”€โ”€ face droops downward
Cry-Laugh โ”€ streaming tears + laughing mouth

๐Ÿ“Š Emotional Memory System

Affection Score: -100 โ—„โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–บ +100
                 HATES                      ADORES

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  โ€ข Petting (long press)          โ†’ +3       โ”‚
    โ”‚  โ€ข Consoling when sad            โ†’ +5       โ”‚
    โ”‚  โ€ข Playing music                 โ†’ +1       โ”‚
    โ”‚  โ€ข Being beaten (rapid taps)     โ†’ -5       โ”‚
    โ”‚  โ€ข Being ignored (5min decay)    โ†’ -1       โ”‚
    โ”‚  โ€ข Dramatic death at -100        โ†’ RESET    โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

The bot remembers how you treat it with a 5-minute sliding memory window and persistent affection score. Its mood choices are weighted by your history together.


๐ŸŽต Music & Dance System

When your phone plays music, DeskBot comes alive with genre-aware dancing:

4 Dance Styles

Style Visual Genre Match
๐Ÿ•บ Groove Smooth sway + relaxed bounce Jazz, Soul, Hip-hop
๐Ÿชฉ Disco Heart eyes + sparkle ball EDM, Funk, Pop
๐ŸŒŠ Wave Flowing wave motion Ballad, Lofi, Classical
๐Ÿ”ฅ Hype X-eyes + aggressive bounce Trap, Rock, Metal

Song Personality Engine

Every song gets a unique dance fingerprint derived from a hash of the track name + artist:

Track: "Bohemian Rhapsody" + Artist: "Queen"
         โ”‚
         โ–ผ
    DJB2 Hash โ†’ Per-song parameters:
    โ”œโ”€โ”€ Beat interval:    430ms
    โ”œโ”€โ”€ Bounce amplitude: 3.2px
    โ”œโ”€โ”€ Arm swing:        35ยฐ
    โ”œโ”€โ”€ Head tilt:        5px
    โ”œโ”€โ”€ Note speed:       0.12
    โ”œโ”€โ”€ Mouth sensitivity: 0.9
    โ””โ”€โ”€ Genre tag:        "rock"

9 genre detectors with 80+ keyword matchers โ€” from Beethoven to Playboi Carti, your bot dances differently to every song.


๐Ÿ”Š Sound Design

A custom non-blocking tone sequencer using ESP32 LEDC PWM drives a passive buzzer with warm, music-box-style melodies:

Boot     โ”€โ”€โ”€ C E G C' E' G'    (music box awakening)
Laugh    โ”€โ”€โ”€ high-low-high      (hahaha)
Cry      โ”€โ”€โ”€ E D C G...         (winding down music box)
Sneeze   โ”€โ”€โ”€ pip pip [silence] ACHOO!
Yawn     โ”€โ”€โ”€ rising ahhh โ†’ trailing zzz
Purr     โ”€โ”€โ”€ soft warm hum      (gentle vibration)

๐Ÿ›ธ Rocky Vocabulary (Project Hail Mary)

Inspired by Rocky from Andy Weir's Project Hail Mary โ€” the bot communicates through pure melodic chords instead of text:

"Word" Musical Phrase Meaning
AMAZE Triple ascending burst ร—3 "amaze amaze amaze!"
GOOD Happy repeating note + lift Approval
QUESTION Rising phrase at end Curiosity
WORRY Wobbling between notes Uncertainty
NO NO NO Harsh low repeated drops Disapproval
SLEEPY Slow fading hum Drifting off
THANK Warm grateful two-note Gratitude

๐Ÿ“ฑ Phone Integration (Gadgetbridge BLE)

DeskBot pairs with your Android phone via Gadgetbridge over BLE UART, receiving:

Data Bot Reaction
Notifications ๐Ÿ”” Chime + fullscreen popup + jealousy system
Incoming Calls ๐Ÿ“ž Ring ripples + caller name + scared โ†’ happy/sad
Music Info ๐ŸŽต Dance mode with genre-aware animations
Weather ๐ŸŒค๏ธ Animated weather scenes (sun, rain, snow, fog, thunder)
Time Sync ๐Ÿ• Full-screen clock with blinking colon
Phone Battery ๐Ÿ”‹ Battery level on clock face
Alarms โฐ Scared + shocked reaction

BLE Stability Features

  • Zombie connection detection (90s stale timeout)
  • Auto-restart with exponential backoff
  • Connection parameter optimization
  • Keepalive heartbeat every 10s
  • Graceful disconnect cleanup

๐Ÿ’ช Behavioral Systems

๐Ÿ˜’ Boredom Escalation

0 min โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Happy, doing quirks
    โ”‚
3 min โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Attention seeking: side-eye + sigh
5 min โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Bouncy expectation
8 min โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Dramatic slump
12 min โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Fake sleep (peeks one eye open)
    โ”‚
45 min โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ BORED (dismissive eye-rolls)
55 min โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ ANGRY (escalated frustration)
65 min โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ FURIOUS (fire animation)

๐ŸฅŠ Getting Beaten (Rapid Tap Detection)

5 rapid taps โ”€โ”€โ”€โ”€ Stage 1: "Ouch!" (flinch)
8 rapid taps โ”€โ”€โ”€โ”€ Stage 2: Pain (X-eyes + zigzag mouth)
12 rapid taps โ”€โ”€โ”€ Stage 3: Crying hard
16 rapid taps โ”€โ”€โ”€ KNOCKOUT โญ (spinning stars, KO'd)
                      โ”‚
                      โ–ผ
              Forgiveness Arc:
              Huffy โ†’ Side-eye โ†’ Tentative โ†’ Forgiven
              (requires gentle long-press to recover)

๐Ÿ˜ป Purring & Bliss

Hold the touch sensor continuously:

0s โ”€โ”€โ”€โ”€ Petting recognized
2s โ”€โ”€โ”€โ”€ Purring starts (warm hum + body sway)
3s+ โ”€โ”€โ”€ Hearts float up
        โ”‚
        โ””โ”€โ”€ Release โ†’ "Why did you stop?!" surprised face

๐Ÿ’€ Dramatic Death

At affection score -100:

Phase 1: Shock โ”€โ”€โ”€โ”€ Wide eyes, frozen
Phase 2: Spiral โ”€โ”€โ”€ Eyes spiral inward
Phase 3: Flicker โ”€โ”€ Screen flickers like old TV
Phase 4: Flatline โ”€ Heartbeat monitor โ†’ flatline
Phase 5: Reboot โ”€โ”€โ”€ Amnesia mode (confused, doesn't recognize you)

๐Ÿงƒ Health Reminders

Reminder Interval Behavior
๐Ÿ’ง Hydration Every 45 min Gets "thirsty" โ†’ urgent โ†’ desperate
๐Ÿช‘ Posture Every 30 min Reminds you to sit up straight

๐Ÿ”ฉ Hardware

Components

Part Specification Pin
MCU ESP32 DevKit โ€”
Display SH1106 1.3" OLED (128ร—64, I2C) SDA=21, SCL=22
Touch TTP223 Capacitive Touch Sensor GPIO 4
Buzzer 3-pin Passive Buzzer Module GPIO 25

Wiring Diagram

ESP32                  SH1106 OLED
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      3V3 โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค VCC      โ”‚
โ”‚      GND โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค GND      โ”‚
โ”‚   GPIO21 โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค SDA      โ”‚
โ”‚   GPIO22 โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค SCL      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

ESP32                  TTP223 Touch
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚      3V3 โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค VCC      โ”‚
โ”‚      GND โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค GND      โ”‚
โ”‚    GPIO4 โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค SIG      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

ESP32                  Buzzer Module
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚       5V โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค VCC (mid)โ”‚
โ”‚      GND โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค GND (-)  โ”‚
โ”‚   GPIO25 โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค SIG (S)  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โšก Quick Start

1. Prerequisites

2. Libraries

Install via Arduino Library Manager:

Adafruit GFX Library
Adafruit SH110X

3. Flash

# Clone the repo
git clone https://github.com/Dcodder33/desk_bot_v7.git

# Open in Arduino IDE
# Select Board: ESP32 Dev Module
# Select Port: /dev/ttyUSB0 (or your port)
# Upload!

4. Pair with Gadgetbridge

  1. Install Gadgetbridge from F-Droid
  2. Scan for "DeskBot" in Bluetooth devices
  3. Pair as a BangleJS device type
  4. Enable notifications, music, and weather forwarding

5. Touch Controls

Action Effect
Single Tap Interact / acknowledge
Double Tap Cycle through moods
Long Press Pet / console
Rapid Taps Beat the bot (escalating)
Knock Patterns Switch to Clock / Weather

๐ŸŽจ Screen Transitions

Mode changes use a smooth circle-iris wipe effect (200ms per half) โ€” the screen closes to a point, switches content, then opens back up. Combined with a brief screen flash for polish.


๐Ÿ—๏ธ Architecture

desk_bot_v7.ino (6,619 lines)
โ”œโ”€โ”€ Buzzer System โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Non-blocking tone sequencer (LEDC PWM)
โ”‚   โ”œโ”€โ”€ 25+ sound patterns (warm musical notes, 1000-2600Hz)
โ”‚   โ””โ”€โ”€ Rocky vocabulary (10 melodic "words")
โ”‚
โ”œโ”€โ”€ Input System โ”€โ”€โ”€โ”€โ”€โ”€โ”€ TTP223 touch with auto-polarity detection
โ”‚   โ”œโ”€โ”€ Single/Double/Long press
โ”‚   โ”œโ”€โ”€ Rapid-tap beat detection
โ”‚   โ””โ”€โ”€ Knock pattern recognition
โ”‚
โ”œโ”€โ”€ Emotional Engine โ”€โ”€โ”€ Reactive personality simulation
โ”‚   โ”œโ”€โ”€ 10 base moods + 10 overlay expressions
โ”‚   โ”œโ”€โ”€ Affection score (-100 to +100)
โ”‚   โ”œโ”€โ”€ Boredom escalation (4 stages)
โ”‚   โ”œโ”€โ”€ Attention seeking (4 phases)
โ”‚   โ”œโ”€โ”€ Forgiveness arc (4 phases)
โ”‚   โ”œโ”€โ”€ Startle chain (3 phases)
โ”‚   โ”œโ”€โ”€ Wake-up drama (4 phases)
โ”‚   โ””โ”€โ”€ Dramatic death (5 phases)
โ”‚
โ”œโ”€โ”€ Dance Engine โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Genre-aware music visualization
โ”‚   โ”œโ”€โ”€ 4 dance styles (Groove/Disco/Wave/Hype)
โ”‚   โ”œโ”€โ”€ Song personality from track hash
โ”‚   โ”œโ”€โ”€ 9 genre detectors (80+ keywords)
โ”‚   โ”œโ”€โ”€ Floating music note particles
โ”‚   โ””โ”€โ”€ Disco ball + waveform bars
โ”‚
โ”œโ”€โ”€ BLE Stack โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Gadgetbridge UART integration
โ”‚   โ”œโ”€โ”€ GB() JSON packet parser
โ”‚   โ”œโ”€โ”€ Notification/Call/Music/Weather handlers
โ”‚   โ”œโ”€โ”€ Zombie connection watchdog
โ”‚   โ””โ”€โ”€ Auto-restart with backoff
โ”‚
โ”œโ”€โ”€ Display Faces โ”€โ”€โ”€โ”€โ”€โ”€ Animated OLED scenes
โ”‚   โ”œโ”€โ”€ Expressive face with 20+ emotional states
โ”‚   โ”œโ”€โ”€ Full-screen clock (blinking colon, date, temp)
โ”‚   โ”œโ”€โ”€ Weather scenes (7 types with animations)
โ”‚   โ”œโ”€โ”€ Call screen (ring ripples, caller info)
โ”‚   โ”œโ”€โ”€ Music popup (scrolling track, visualizer bars)
โ”‚   โ””โ”€โ”€ Notification overlay (app + message)
โ”‚
โ””โ”€โ”€ Health Systems โ”€โ”€โ”€โ”€โ”€ User wellness reminders
    โ”œโ”€โ”€ Hydration (every 45 min, 3 urgency levels)
    โ””โ”€โ”€ Posture check (every 30 min)

๐Ÿคน Personality Quirks

Every 15โ€“45 seconds, the bot does a random micro-animation:

  • ๐Ÿ˜ฎโ€๐Ÿ’จ Sigh โ€” gentle exhale
  • ๐Ÿ‘€ Side-eye โ€” suspicious glance
  • ๐Ÿซจ Wiggle โ€” playful body wobble
  • ๐Ÿ˜ค Nose scrunch โ€” cute twitch
  • ๐Ÿคจ Suspicious squint โ€” narrowed eyes
  • ๐Ÿฆ˜ Mini bounce โ€” happy little hop
  • ๐Ÿคง Sneeze โ€” build โ†’ burst โ†’ surprised face

๐Ÿ“ Technical Details

Spec Value
Codebase 6,619 lines, single-file C++
Frame Rate ~30 FPS (non-blocking, millis-based)
I2C Clock 400 kHz (fast mode)
BLE Protocol UART Service (Nordic-compatible)
Buzzer PWM 10-bit LEDC, 40% duty cycle
Animation Float-based smooth interpolation
Timezone IST (UTC+5:30), configurable
Weather API Via Gadgetbridge (phone โ†’ BLE)

๐Ÿ“ Version History

Version Highlights
v7 Incoming call screen, 4 dance styles, song personality engine, disco ball
v6 Weather icon redesign, music popup, BLE stability
v5 Warm musical sound design, Rocky vocabulary
v4 Emotional memory, boredom system, dramatic death
v3 Overlay expressions, beat detection, forgiveness arc
v2 Gadgetbridge BLE, touch sensor, base moods
v1 Basic OLED face with blinking

๐Ÿ“œ License

MIT License โ€” do whatever you want with it.


Built by Dhruv Gorai

"It's not a product. It's a pet." ๐Ÿค–๐Ÿ’•


If you build one, it will judge you for not petting it enough.

About

ESP32 OLED desk companion with emotional AI, BLE phone integration & 6600+ lines of personality

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages