In this project we show you how to Animate an Elf on a Shelf with the PivotPi, a Raspberry Pi Servo Controller, making it a smart Elf. We’ll attach a small servo to the Elf’s arm to make it wave, we’ll use a distance sensor to see if anyone is close to the Elf on a Shelf, and we will tie it all together with the Raspberry Pi and GrovePi Zero.
When someone approaches, the Elf will begin enthusiastically waving! This project will demonstrate how to easily add motion to an otherwise lifeless Elf and other toys.
- Small Twist Wires – Usually we have these laying around our house. If you don’t, we recommend using some thin electrical wire.
To build the Elf, we’ll first start by attaching the servo to the arm we want to wave.
We attached a small servo to the back of the Elf using some wires, wrapping around his torso, the servo, and the servo mount holes.
Next, using the small arm that comes with the servo, we attached the Elf arm to the servo arm using some wires.
We prepare the controller by first placing the SD Card in the Raspberry Pi:
Then attach the Grove Ultrasonic Sensor to the GrovPi Zero on port D3.
Next, attach the GrovePi Zero and PivotPi to the Raspberry Pi.
Finally, attach the battery to the PivotPi board, to power the Servos.
Attach the servo to the PivotPi. Note the orientation of the colors on the servo wires!
You may want to first put you Raspberry Pi on the local network, so you can control it remotely. Our code is open-source and you can see it here.
If you’re not using Raspbian for Robots, you need to install the PivotPi first:
sudo git clone https://github.com/DexterInd/PivotPi cd PivotPi/Install sudo bash install.sh
If you’re using Raspbian for Robots, PivotPi comes already installed. You can run the program with the command:
sudo python elf.py
And watch the Elf come to life!
Did you replicate this project? Share it!I made one
Love this project? Think it could be improved? Tell us what you think!