Introduction: Code You Can Eat

About: I'm a designer and researcher of creative, hands-on learning experiences at CU Boulder.

Creating things with code that are touchable, tactile, and even edible (as I'll explain in this Instructable) is an idea that I find really exciting. There's something magical about being able to interact with an object that started out as lines or blocks of code on your computer.

I was inspired first by how Wonderful Idea Co. taught campers to code in Beetle Blocks and translate their code into stickers or temporary tattoos. Then I learned about the ways that Leah Buechley uses code to create expressive, and beautiful computational ceramics.

But it was pastry artist Dinara Kasko's explorations with using technology such as 3D printing and 3D modeling software to create artful desserts that sparked my idea to make "Code You Can Eat".

This Instructable will guide you through the process I used to make chocolates from shapes that I programmed using Tinkercad's Codeblocks. This is meant to be a starting point and inspiration for your own experiments with Code You Can Eat.


More details about these supplies can be found in each step. Here are all of the supplies I used:

Step 1: Use Codeblocks to Design Your Edible Code Shape

I love using Codeblocks on Tinkercad to make 3D designs using code. You can create really complex and interesting designs using simple shapes like spheres and rings. You can also keep it simple and create nice designs using only a few shapes and a few lines of code.

If you're new to Codeblocks I'd recommend trying out some of the tutorials on the Tinkercad website. Or check out these resources from Rob Morrill, an amazing educator who makes really cool stuff with his students using codeblocks.

Here are two Codeblocks designs that I've used to make my "Code You Can Eat" chocolates:

This one (images 1 and 2) is simple, but easy to customize. Here are some things you can try if you make your own copy of this design:

  • Try changing the letter on top, or add a word
  • Replace the hearts with a different shape
  • Add another element

This one (image 3) is more complicated, but creates a beautiful geometric pattern. Here are some things to try changing:

  • Change the numbers in the "change degrees of rotation" block
  • Replace the spheres and rings with different shapes
  • Change the properties (radius, sides, tube, steps) of the tori

When you're feeling ready, try designing your own edible code shape in Codeblocks.

If you're going to make chocolates like I did, here are some tips:

  • Look up chocolate molds that you can buy, what do you notice about how they are shaped? Most have a flat surface, and that flat surface is the widest point in the design. This makes it easy to fill the molds and to remove the chocolate from the mold.
  • Try not to add really small and delicate elements to your design. For example, in the more complex example that I shared above, the small spheres around the edge break off really easily.
  • Find some introductory mold making / casting tutorials (like this amazing Instructable series!). Being familiar with the basics of molding and casting will help you design better food molds.

Step 2: 3D Print Your Edible Code Shape

  1. When you have one or more shapes that you like, export them from Tinkercad by pressing the "export" button in the upper right corner and select the filetype that you would like to download. (Usually .stl or .obj is the filetype you'll need for 3D printing)
  2. Prepare your file for 3D printing. If you are someone who uses a slicer like Cura to prepare your files, you might want to consider setting the quality to "high" or decreasing the layer height. Silicone molds are really good at capturing detail, so the rougher your 3D print is, the rougher the surface of your chocolates (or whatever you decide to make) will be.
  3. Print your design. I used normal PLA filament. I haven't tested different filament types with the silicone used in this project and so I can't say if ABS or other filament types will also work with the mold-making materials described in the next step.

Step 3: Make a Food-Safe Mold

I used LEGO to make my chocolate mold because I had LEGO handy and found that using LEGO makes it easy to make custom mold shapes. Additionally, I found this Instructable which helped me understand how to use LEGO to make a mold.

Here are the materials you'll need for this part:

  • Food-safe silicone to make the mold. I used this one from Smooth-on but there are other products out there that you can use.
  • LEGO bricks and at least one LEGO baseplate . The baseplate should be large enough to accomodate your 3D printed design.
  • Disposable cups and mixing tools (a spoon, popsicle stick, paint stick, etc.) to mix the silicone
  • A craft knife
  • Hot glue or glue dots

Here's how I made my mold:

  1. grab the LEGO baseplate, your 3D printed piece, and glue. Add glue dots or hot glue to the flat side, or bottom, of your 3D print. Stick the print onto the baseplate and make sure it's secure. If it's not secure, it might float to the top of the mold or move around when you pour your silicone.
  2. Use LEGO bricks to build a border around your 3D print. (see the first image for an example)I recommend making the smallest border possible. If you leave a bunch of extra space, you'll waste silicone. The border should be at least a few centimeters taller than the height of your 3D print. It's okay if the border is quite a bit taller than the print, but you don't want it to be too short. Then you might end up with holes or weak spots in your mold.
  3. Make sure that the LEGO bricks are securely pressed together so that silicone doesn't escape through a crack or loose part.
  4. Prepare your silicone according to the product's instructions. (Image 2 shows me mixing some silicone at Construct3D 2020, thanks Rob for taking this photo!)
  5. Pour the silicone carefully into your lego mold, pour the silicone until it has covered your 3D print. Keep pouring so that you have about an extra centimeter (more or less) of silicone on top of your 3D print. You should not be able to see the top of your 3D print. Like I mentioned in step 2, if you don't have enough silicone on top then your print might break through the mold creating a hole.(image 3 shows a couple examples of good molds*)
  6. Let your silicone cure. Again, follow your product's instructions.
  7. After the silicone is cured you can remove the LEGO bricks (image 4)
  8. Use your craft knife to cut a small layer off of the part of the mold that was facing the baseplate. (it will have a LEGO brick texture on it). You want to cut off just enough to reveal the bottom of your 3D print. Don't cut off too much or it might ruin your design. **
  9. Remove the 3D print from the mold. (image 5 shows what my mold looked like at this point)

*Sometimes there are bubbles in the mold, which isn't ideal. Someone who does mold making professionally might use a vacuum degassing chamber to get rid of these bubbles. But I haven't found that to be necessary for this project.

** There are ways to make a mold so that this step isn't necessary, I just find this method to be pretty quick and easy and I don't mind cutting off the top layer.

Other notes:

  • Sometimes people will spray their objects with "mold release" to help it come out of a mold. You could try a food-safe version of this by using baking spray but I have found that the 3D prints come out of the mold really easily and I didn't need to use mold release spray.

Step 4: Fill Your Mold

Now it's finally time to make your edible code treats!

You can fill your molds with pure chocolate (yum!) or candy melts. I used a glass measuring cup to carefully melt my chocolate and candy melts. You might want to give your mold a wash with whatever you use to clean dishes before using it.

Here are some other ideas for using your computational mold to make delicious code-based treats:

  • Try using different foods: jello, gummies,etc. Or get a popsicle stick and make suckers or cake pops.
  • Experiment with different recipes. This image shows homemade peanut butter cups that I made.
  • Use these molds for baking (cookies, cakes) or freezing (ice cubes, fudgesicles)

Block Code Contest

Second Prize in the
Block Code Contest