Quest log: the deer that breathes

Quest status: prototype breathes - next up: making it compact
You know those calming plushies that slowly breathe in and out, like the well-known sleepy otters? I wanted one - so I decided to make my own. My test subject: a plush deer. The plan: a small motor inside that gently lifts and lowers its belly, in a real breathing rhythm.
Inventory
- Arduino Nano (CH340 chip, USB-C)
- SG90 micro servo - later an MG90S with metal gears
- Intenso XS5000 power bank
- electrolytic capacitors (1000 µF and 470 µF)
- breadboard and jumper wires for the prototype
The breathing
The servo moves a lever up and down. The trick is the movement: instead of a robotic tick-tock, the servo speeds up and slows down smoothly (a cosine curve), so it feels like breathing:
// Move the servo smoothly from one position to another
void move(int from, int to, unsigned long duration) {
unsigned long start = millis();
while (millis() - start < duration) {
float p = (float)(millis() - start) / duration;
float e = (1.0 - cos(p * PI)) / 2.0; // soft start, soft stop
breathServo.writeMicroseconds(from + (to - from) * e);
delay(15);
}
breathServo.writeMicroseconds(to);
}
The rhythm went through three versions: the first was very calm (about 7 seconds per breath), the second much faster and stronger (about 3 seconds) - but with so much travel that the servo started to grind. Version 3 keeps the faster, deeper rhythm with a short, firm inhale and a longer, softer exhale, but with a much smaller range of motion. That is gentler on the motor.
Boss fights
- The Nano kept freezing as soon as the servo moved. The servo pulls so much current for a moment that the voltage drops. I found it with the built-in LED as a “still alive” signal - the fix was a 1000 µF capacitor between 5V and GND.
- The power bank switched itself off because the whole thing draws so little power that it thought the device was fully charged. Switching to a different power bank solved it.
- The power bank would not switch on while the charged capacitor was already connected. Solution: switch it on first, then connect.
- A stripped gear: one SG90 gave up. The replacement is an MG90S with metal gears (the 180° version, not the 360° one).
Next level
- soldering a small, compact version instead of the breadboard
- a soft mount, so you can not feel the motor
- maybe a timer that slows down and stops after 30-45 minutes
Have you built something like this? Tell me in the comments!
