DEVLOG 005 - Second Touch Sensor & Emotion System
Added a second capacitive touch sensor on a new
GPIO pin dedicated entirely to emotions.
How It Works
Built a full gesture detection system on the new
sensor:
◆ Single tap → excited
◆ Hold for 800ms → cozy
◆ Rapid tap 3+ times → mad
Each emotion has 5 or 6 distinct face variants
that cycle using weighted random probabilities
so it never shows the same reaction twice in
a row.
◈ Mad - red angry eyes in different shapes:
wide glare, tiny squint, psycho stare,
disgusted droop
◈ Excited - big round happy eyes, bouncy
small eyes, wide open stare
◈ Cozy - half closed drowsy eyes, warm round
soft eyes, tiny sleepy eyes
Emotions auto expire after 6 seconds and return
to the default idle face automatically.
Spent a long time writing the code, fixing
errors, getting everything working and then
the compiled firmware came out at 101% of the
ESP32’s flash limit and wouldn’t upload.
Couldn’t just scrap it after all that work so
I started diagnosing what was eating the space.
The two biggest culprits:
◈ HTTPClient and ArduinoJson together were
pulling in around 60–80KB of overhead just
from the libraries alone
How I Fixed It
◆ Replaced HTTPClient and ArduinoJson with a
raw WiFiClient socket connection and three
tiny manual JSON parsers using strstr and
atof no library needed at all
◆ Replaced every cos and sin math call with
precomputed fixed point lookup tables stored
in PROGMEM completely removed the float
math library dependency
◆ Wrapped all string literals in F() to keep
them in flash instead of RAM
Got the binary down under the limit without
cutting a single feature. Everything still
works exactly the same, it just actually
fits on the board now.
Still needs some tuning though the emotion
faces need a bit more work to feel right and
there are a few things here and there that
need cleaning up. The structure and foundation
is solid but it’s not fully polished yet.
More to come on that in the next log.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.