Introduction: Build an Edible Gingerbread Robot With the Raspberry Pi and Servos
This is by far the tastiest project we’ve ever done! In this project we show you how to build a Gingerbread robot using the Raspberry Pi and servos kit, and the PivotPi, the Raspberry Pi Servo Controller. The Gingerbread robot is equipped with a camera that checks for faces, and if it sees a face, it does a small dance!
Step 1: Materials
Step 2: Gingerbread Robot Construction
Not your traditional robot, the Gingerbread man robot requires a little baking to get started.
Bake the Robot Parts
First, we baked a Gingerbread man. You can find our recipe here.
Next, we cut the gingerbread man according to this stencil. You can click on it and download the full sized stencil. We printed on a laser printer and cut it out with scissors.
Next, placing the paper on the flat rolled dough, and cutting the outline out.
Next we severed off his arms, rounded the ends, and added some holes to be able to tie them to the servos.
Finally, we baked. To make him a little more solid, we baked a few minutes longer than the prescribed 10 minutes: we baked him at 185C for about 14 minutes. This gave us a much stronger gingerbread man to work with.
After cooling, we added some life with a smile and candy eyes.
Yum, and cute.
Step 3: Cardboard Stand
We built a cardboard stand for our edible robot using an clean box and some clear tape.
First, trace out the Gingerbread man on the box.
Erase his arms, and add a two square posts on the side of the Gingerbread-bot, to mount the servos. Our stick out approximately 2 inches.
Do not separate the cardboard, rather, fold it back behind the gingerbread bot, and tape it together, as in the pictures below.
Tape it in the back for extra support!
Step 4: Adding the Raspberry Pi and Servos
First, we mounted the Gingerbread man to the cardboard stand. We used two thick zipties around his legs. Next, we attached two large servos to the cardboard. Again, we used a thick ziptie for each limb.
Attach the long double-sided arm to the servo.
Finally, add the arms. This takes a little skill to attach without breaking the cookies. If you push too hard, you can crack the arms open. Wrap a zip-tie around each end of the servo arm.
Next, we attach the PivotPi to the Raspberry Pi, and add the power pack to the PivotPi.
Next, attach the Raspberry Pi Camera. This should be wedged down below the Gingerbread man’s legs.
Finally, connect the servos to the PivotPi board. We are using channels 1 and 2 on the PivotPi.
Step 5: The Code
All of our code for the Raspberry Pi Servo controlled gingerbread man robot is open-source and free, here on Github.To add the facial recognition, we installed OpenCV. Adrian Rosenbrock had a painless setup process you can follow here to install OpenCV on the Raspberry Pi. We based some of our OpenCV code on some code from PythonProgramming.net here; in particular, the code to find a face. The code puts a box around the face it sees. Here’s me setting up the camera in front of the Gingerbread robot. These pictures were taken from the Raspberry Pi camera.
After installing OpenCV, you can get the code with the following commands:
sudo git clone https://github.com/DexterInd/PivotPi cd PivotPi/Projects/Gingerbead_Man_Robot sudo python gingerbread-man.py
Stick your face in front of the camera and see your gingerbread man wave!
Step 6: The Results!
Step 7: Learn More, Ask a Question
Got a Question? Ask on our Forum!