Animated Smart Elf on a Shelf With the Raspberry Pi Servo Controller



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.

Step 1: Materials

Step 2: Build It!

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 PivotPi to the GrovePi Zero. We use the two supports provided with the PivotPi and a small screw driver.

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!


Step 3: Program the Raspberry Pi Servo Controller

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
cd PivotPi/Install 
sudo bash

If you’re using Raspbian for Robots, PivotPi comes already installed. You can run the program with the command:

sudo python

And watch the Elf come to life!

Step 4: Do More, Ask a Question



    • Paper Contest

      Paper Contest
    • Sweet Treats Challenge

      Sweet Treats Challenge
    • Organization Contest

      Organization Contest