Chicken Animatronic
IoT and Particle Alarm Clock of Hei-Hei from Moana
IoT and Particle Alarm Clock of Hei-Hei from Moana
As part of ITP-348, a hands-on Arduino Electronics and programming class, our final project was any device of our choosing that had to connect to an app interface and integrate some of the modules we had learned. I decided to make a childhood dream come to life and create an animatronic of a Disney character!
Instead of just making the character move, it functions as a stop watch alarm clock. The user can select and set a desired time, click start and the character will animate when the timer reaches zero. This functionality can both be controlled by the hardware dial, and also in an IoT app on your phone. I imagined it as a cute alarm clock for children!
First I began an analysis of the Moana character to think about the unique motion profile I wanted to mimic. I noticed the expressive jerky motions and secondary motion of the ping-ponging irises, comb, and wattle of Hei Hei
I then started sketching ideas, what kind of mechanisms might allow for this kind of movement? And what kind of body did I want to create? Standing up, sitting? I finally ended on Hei Hei in an egg so that I could easily hide the electronics and be able to access them.
At first, I wanted the motion to be powered by just one motor, inspired by the spring-powered Japanese Karakuri robots which I had done extensive research on during a study aboard trip to Japan. In the end, it was more practical to create jerky head turning and noding with servos instead, but I hope to come back to a more mechanical and cam-based concept in the future.
The egg was modeled in OnShape, and 3D printed on a Prusa Mk3 3D printer in PLA. It was then sanded and spray painted and brush painted to create depth and a feeling of a real egg. A light yellowing pass adds to the aging effect. I assembled my wiring and components and measured and modeled the footprint to make sure it would fit snuggly in the egg, accounting for the wire plug.
Wiring Diagram
The main controlling interface on this device consists of the potentiometer which allows the selection of a small or large time between 59 min and 0 min and a button that toggles the timer to be either active or paused and awaiting target time input.
Components:
1 Particle Argon Board
3 Servos - one for rotation, one for tilting, and on for the mouth
1 Motor https://www.sparkfun.com/products/13302, attached to the wings
1 Button
1 Potentiometer
1 Sparkfun Motor Controller
1 Sparkfun Micro OLED
1 k Ohm resistor
A bunch of wires
Code Overview
The code is structured as a state machine with Paused, Active, and Expired states. The state machine handles the millis timers.
1. Paused
- pot takes values and updates timer
- app takes values and updates timer
- updates OLED screen to show "counting from" time when pot or app gives new values
- call the displayTime (as user is setting it, shows what they are setting)
- encapsulated function to read button value
- encapsulated function that takes pot value -> and updates timeVar
- when button pressed, move to timer active
- pot takes values and updates timer
- app takes values and updates timer
- updates OLED screen to show "counting from" time when pot or app gives new values
- call the displayTime (as user is setting it, shows what they are setting)
- encapsulated function to read button value
- encapsulated function that takes pot value -> and updates timeVar
- when button pressed, move to timer active
2. Timer active (counting down)
- pot doesn't take values
- app doesn't take values
- update OLED screen every second
- after every sec call function with time stamp (encapsulate displayTime)
- pot doesn't take values
- app doesn't take values
- update OLED screen every second
- after every sec call function with time stamp (encapsulate displayTime)
3. Timer expired
- pot doesn't take values
- app doesn't take values
- When timer reaches 0, mechanism turns on
- after time migrate to paused state
- pot doesn't take values
- app doesn't take values
- When timer reaches 0, mechanism turns on
- after time migrate to paused state
How potentiometer reads time:
Decided to choose 15-second intervals because of potentiometer noise.
Pot mapped range becomes 0 - 240.
We will get 4 of these intervals per minute (60 sec in min)
Pot mapped range becomes 0 - 240.
We will get 4 of these intervals per minute (60 sec in min)
Math used:
int 50 / 4 = 4 (4.1666 gets truncated)
50 % 4 = 2 (bc multiply by 15 -> 30 sec, modulus finds remainder)
int 50 / 4 = 4 (4.1666 gets truncated)
50 % 4 = 2 (bc multiply by 15 -> 30 sec, modulus finds remainder)
BLYNK DASHBOARD
The Blynd dashboard allows remote setting and monitoring of the time as it shows on the OLED, paused vs. active selector, chicken animation toggle, and display of the state (active, paused or expired for debugging).
Body Overview
The body of the chicken was sewn from felt and fluffy fabric with a foam and cardboard interior. Two halves of a ping pong ball make up it's comically spherical eyes.
Final