Introduction: Cake Decorating Robot

Use the DIY Universal CNC Machine v1.5 to decorate cakes using icing.

Step 1: Things Used in This Project

Step 2: Demonstration Video

Step 3: The Base CNC Machine

On August 14, 2018 I published a project the featured a DIY Universal CNC machine. Its tools could be interchanged easily. Building the machine is quite complex, so see this project for further instructions.

Step 4: Improving the Machine

My initial project did have some flaws, however, as brought to my attention in the comments section of it. For one, the X axis belt had uneven tension. This could cause the movements to not be as precise. The X axis carriage also didn't fit onto the rail tightly enough, causing the entire assembly to tip over and grind against the rail. To fix this I completely redesigned the X axis carriage block by moving where the timing belt fits in and moving the V slot wheels to better locations, as well as adding another wheel to the back to prevent tilting.

Step 5: Dispensing Icing

I needed a way to extrude icing at a very controlled and predictable rate. This meant using a stepper motor. But then the issue came to generating a lot of downwards force from rotation. Gears are a known force multiplier. A small gear attached to the shaft of a motor can turn a larger gear and that larger gear can output a larger force. But then how is rotary motion converted to linear motion? That's where screws and nuts come in to play. Instead of a nut turning on a stationary screw, I had the stationary nut (attached to the large gear) move the screw up or down. At first I was going to design this in Fusion 360, but after looking on Thingiverse I came across something that suited my needs. Find it here:

A Particle Photon controls the stepper motor that is controlled via cloud functions. I created an HTML page that is hosted by an Apache webserver. There are 3 buttons for up, down, and stop. Later on this page will be accessed by a Raspberry Pi 3 B+ and a touchscreen.

Step 6: Controlling the Machine

DFRobot helped sponsor this project by sending me the new Raspberry Pi 3 B+ and a 5in TFT Touchscreen. To start I downloaded the latest Raspbian image from and then using to put it on an SD card.

Then on another Raspberry Pi install node js by entering the following commands:

git clone ~/.nvm
cd ~/.nvm

git checkout `git describe --abbrev=0 --tags`

cd ..

. ~/.nvm/

Then you can install and use the version of node you want with

nvm install 6

nvm use 6

and also run this command to upgrade the node package manager (npm)
npm install npm@latest -g

and finally install the control software with

sudo npm install --unsafe-perm -g cncjs

and cncjs to run it. Just go to http://:8000 to access the page. Also make sure to connect a USB cable from the Arduino Uno that's controlling the CNC machine to the Raspberry Pi running the CNCJS server.

Step 7: Creating the Design

I used Fusion 360 for both designing and generating gcode for CAM. The cake pattern I chose was the logo. I first downloaded an image from the web and then inserted it into the work environment by using the attached canvas function. Then I extruded a body from the sketch. And then I went to the CAM environment and created a setup that mimics a cake (9x13x2in). And finally I generated a toolpath using the 2d cutting operation.

Step 8: Time to Make a Cake

I wanted to make a simple cake, so I got a box of generic yellow cake mix and prepared it according to the directions, pouring it into a 9x13inch pan. While that was baking I made a simple buttercream from 1 cup of butter, 4 cups of powdered sugar, 2Tbls of milk, and a little vanilla. Then that buttercream got spread evenly over the cooled cake. I made sure that there were no large deviations that could interfere with the icing nozzle.

The icing recipe is very important here. If it's too runny it won't
stay in place when extruded. Too thick and the stepper won't be able to extrude it. Here's what I used:

  • 7 ounces by weight of powdered sugar
  • 15.5 teaspoons of water
  • 4 drops of blue food coloring to make what I like to call "Arduino Blue"

Step 9: Decorating!

Now that everything's prepared, it's time to decorate a cake. First I homed all the axes, making them touch the limit switches. Then I touched "down" on the touchscreen to start the icing extrusion. Then I clicked start on the cncjs webpage to make the cnc machine follow the gcode.