Do You Want to Build a Snowman?
This project shows how to build a dancing snowman, with the Raspberry Pi and PivotPi – a servo controller built just for that!
Scratch is used to code the dancing snowman and Sonic Pi generates the Holidays music.
Get a post of some sort that will tall enough to hold the snowman.
Attach two medium servos to the lower half of the post, eye-balling their approximate position. Servo placement determines the type of movement you will get. If you place a servo in the center of one of the circles, you’ll get a pure rotation movement. That looks good for the central part with the arms. Attach the arms to the body using tape, the arms don’t move, it’s the body that will rotate.
If you place a servo higher than the center of the body circle, you’ll get a swing effect which looks nice for the bottom part. It’s not a precise science (it could be, but it’s not necessary to be that precise for a snowman), but about 1/3 up looks nice.
The top servo – a small one – controls the head. We will use a short piece of balsa wood as a neck, the lower part of which is attached to the servo and the upper part is attached to the head. This allows the snowman to move its head side to side. The balsa wood uses double sided tape to stick to the head part.
Time to decorate the snowman! Googly eyes, candy cane and all!
Time to connect those servos to the PivotPi board! There are three of them, but two should be a little too high. You have a couple of choices. You can put the PivotPi/RaspberryPi higher up on the supporting post by using tie-wraps or any other safe method, or you can extend the servo wires by using male to female jumper wires.
The bottom servo is connected to Port 1
The middle servo is connected to Port 2
The top servo (the small one) is connected to Port 7 as my PivotPi was kept standing up and the wires could reach it (Port 8 would have been fine too).
You can change the Scratch code to match your own connections by adapting these blocks
The speaker’s connection is easy.
The snowman project uses Scratch for the PivotPi. To avoid looking completely like a robot, some random generators are used. Otherwise the code is straightforward. You can learn more with our online Scratch reference page
If you do a DI Software Update on your Raspbian for Robots card, you will be able to find the code by:
Click on File, then Open
Click on the Pi button and navigate to Dexter, PivotPi, Projects, Snowman
Sonic Pi is not, by default, on Raspbian for Robots. You do not need it but it’s a fun thing to add.
To install Sonic Pi, your SD card must be at least 8 Gig with some spare room. If you have a 4 Gig one, changes are Sonic Pi won’t fit on it.
Run the following commands in a terminal window:
sudo apt-get update
sudo apt-get install sonic-pi
and let it do its magic.
You can download Jingle Bells from Robin Newman’s collection (click on the ‘Download Zip’ button, top-right) (Huge thank yous to Robin for sharing his musical talent! )
If you need some help to transfer the file from your regular computer to your Pi, take a look at our tutorials:
Start Sonic Pi by clicking on the Pi’s little red raspberry menu, then Programming, then Sonic Pi
Load the Sonic Pi file by clicking on the Load button, and finding the place where you saved it on the Pi.
Once your speaker is plugged into the Pi and switched on, you can click on the Run button and listen to your Pi create music!