Food and electronics don't usually mix well—unless you're cake hacking. I've been embedding electronics into edible cakes since 2008. And, in 2009, my group won the New York City Yahoo! Hackathon with a cake that showed rudimentary emojis via LEDs with emotions based Del.ico.us tags.

Most cakes I've put electronics in have been for friends' birthdays. I've made cakes with LED candles, cakes with motorized candles (fun flame effects!), singing cakes, and even a Game Boy cake with Mario Bros sounds. I generally use open hardware Arduinos to run the cakes. Not wanting to poison friends on their birthdays, I've learned a few tricks along the way.

Photo by Alicia Gibb. CC BY-SA 4.0

This set of instructions offers general steps for any cake you're embedding electronics into:

Bake the cake first, according to your recipe. Do not bake the electronics directly into the cake.

bake the electronics directly into the cake. The green 4" x 2.5" x 1" IKEA tupperware is a perfect fit for an Arduino Uno or derivative product of the same size.[1] You can house the board and a 9-volt battery in the tupperware, then poke holes in the top for wires to come out. If you don't have tupperware, lining the cake with parchment is another option.

Photo by Alicia Gibb. CC BY-SA 4.0

Saran wrap all wires and components well. I like using professional-grade saran wrap because it really sticks and stretches around stuff. All wires and solder joints need to be saran wrapped so nothing leaches into the cake, since solder isn't naturally food safe. [2]

Take a picture of the inside of the cake before frosting it so you can remember where the wires are, and remember not to cut through them!

Turn the power source on and ensure everything works as planned (hopefully you've prototyped your concept before embedding it in a cake).

Put down a layer of parchment paper bridging any gaps between the top of the cake and the tupperware to give it a little more structure when frosting.

Photo by Alicia Gibb. CC BY-SA 4.0

Now all you have to do is frost the cake!

The most recent cake I hacked was for the Unversity of Colorado Boulder Blow Things Up Lab, which I direct. The cake screamed "ow!" every time it was cut. The brain of this cake was an Arduino derivative called a Makey Makey that turns whatever material you're working with (cake) into a keyboard input. I deviated from my usual code editor and wrote the code in Scratch because it allowed me to program the Makey Makey in less that one minute. Scratch has a great sound library that already had a "scream" track. The code I used can be found below.

Connect one alligator clip to the metal bit of a regular knife and the spacebar pad on the Makey Makey. Connect another alligator clip to the edge of the cake's frosting and the ground pad (called "Earth") on the Makey Makey. That's it! Two connections to the Makey Makey and a laptop is all you need to add sound effects to your cake. When the circuit is completed between the water molecules[3] in your frosting and the knife, the cake will scream. Make sure to wash your alligator clips before and after food use! Alternatively you could probably use aluminum foil between the cake and alligator clip if you're concerned about food safety.

Photo by Alicia Gibb. CC BY-SA 4.0.

When working with professional bakers (as I did with my wedding cake), they prefer to be handed a styrofoam block full of electronics rather than embedding loose electronic bits inside the cake. It's a cheat, but the cake still lit up! Below are the schematics for the electronics of the inside of my wedding cake. I used LilyTwinkles, so there is no code requiHred (it's pre-programmed into the board). You can buy the electronics needed for this cake at SparkFun Electronics.

Note: The small boards are LilyTwinkles, not accelorometers. LED positives go into pins 0, 1, 2, and 3 respectively. CC BY-SA 4.0.

Photo by Alicia Gibb. CC BY-SA 4.0.

Give your friends a thrill on their next birthday! All the schematics, code and ideas in this article are CC BY-SA Alicia Gibb so feel free to build upon my ideas and use them in your special occasion cakes. Once you build the electronics they can be transferred into another cake, so save your work and use it in future delights. Happy Hacking!

[1]Flat electronics like the Lilypad line or Arduino Pro Mini line are easier to slide into the frosting layer of an already baked and frosted cake.

[2]There are some edible cake decorating materials that are conductive. Silver coated sugar found at specialty baking shops will carry a bit of current.

[3]Technically it's the ions in the water that cause it to conduct.