The Emotional Dog: A Sensor-Driven Quadruped with Expressive Behavior

Most educational robots respond only to direct commands, behaving in a mechanical
and predictable way. This project develops an “Emotional Dog” — a quadruped robot
that perceives its surroundings and reacts with behaviors resembling emotional
responses, making the interaction feel natural and lifelike. Built on the Hiwonder
MechDog platform and programmed in MicroPython on an ESP32-S3 microcontroller,
the robot uses an ultrasonic distance sensor and a capacitive touch sensor to drive a
finite state machine of five emotional states: normal, petted, scared, happy, and bored.
Each state is triggered by sensor readings and timing conditions and produces a distinct
expressive behavior, from backing away when startled to lying down when bored. A key
contribution of this project is the petted-state reaction, which is not available as a built-in
motion: it was constructed from inverse-kinematics commands that lift one rear leg while
tilting the body to the opposite side for balance, producing a stable, dog-like movement,
and it distinguishes a single touch from a double touch to trigger two different
responses. The system also introduces controlled randomness into its reactions, so the
robot’s song and dance choices vary between repetitions and avoid feeling scripted.
Manual control is preserved through a Bluetooth mobile application extended with
custom action buttons, allowing autonomous emotional behavior and on-demand
commands to operate within the same system.