Software apps and online services
Hand tools and fabrication machines
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.What you will need
The snowman showcases the PivotPi, so let’s start with that. The hardware you will need is listed and linked above in the Things section.
In the crafts area, you will need:
- Big tie wraps
- Strong double-sided tape
- Googly eyes
- Black marker
- A strong post
You will build the snowman out of a piece of foamboard. Use three plates of different sizes, or any round objects, that will give you a nicely proportioned snowman. Cut the pieces out and consider sanding the sides too.
Use a black marker to go around each circle, to make them stand out. And we’ve got the start of a snowman!
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!
Middle section with arms
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.
- Its power cable is connected both to the speaker and to one of the Pi’s USB port.
- Its audio cable goes onto the audio port on the Pi.
- Its power must be turned on to the highest volume as we will be outside.
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 clicking 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.
Raspberry Pi/Programming/Sonic Pi
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!How to get the code for this Project
The easiest way to get the code is to update your Dexter Industries software through the “DI Software Update”. When you do this, all of the code files for new projects like this will show up!
When you run the DI Software Update, this project can be found in this location:
If you are not using the Dexter Industries custom software, Raspbian for Robots, and you still want to download this file; you can download it here.Need Help?
Have a question or a problem? Post it on the forums and we’ll help you out.