FrostBot - a Robot That Frosts Cookies
By: Brian Schmalz
FrostBot Picture  Two Cookies
December 2007

General Description: I have built a computer controlled cookie frosting robot and demonstrated it to several groups of people. The first version (described here) is an initial prototype, and has some significant limitations. However, much was learned in the development of this project, and the next version will be substantially improved. This web page is a technical description of how the robot works, and includes downloadable software if you wish to make your own or improve upon the design presented here.

System Description: The Frost Bot robot consists of a small table-top CNC router kit made by www.fireballcnc.com, augmented with a forth axis stepper motor driving a frosting extrusion device. The four stepper motors of the system are driven by a single board called a Quad EasyDriver, which is based upon putting for Easy Driver boards together and sending them data using two shift registers. (Like a one-directional SPI bus.) This board is driven by a UBW controller board (from SparkFun) using a custom firmware and powered with a standard computer (AT) power supply at 12V. The UBW firmware takes motor move commands over the USB connection from a computer. The computer runs a Liberty Basic application that loads HPGL based vector graphics files, and sends them to the UBW. It also handles homing, jogging, zeroing, offsets, etc. The HPGL input files to the Frost Bot software are generated from Post Script files using GhostScript, and those .ps files are generated from SVG files made in InkScape. Although it all sounds really complicated, it is actually straightforward if you think about each chunk.

Movie:


How Does It Work? Here is a simplified diagram.
Simple Frost Bot
The robot is built on a simple CNC machine called a FireballCNC mill. This machine moves the Stage in the X (forward/back) direction, and can move the 'head' (Frosting Cone in this machine) in Y (left/right) and Z (up/down). Each of these axis of movement is controlled with a stepper motor and a screw. The motor turns the screw and the screw converts the rotational motion of the motor to the linear motion that we need. There are many other CNC (Computer Numerically Controlled) machines out there and they are used for many different things. RepRap is one of them that is similar to FrostBot (but it is much more sophisticated).

The frosting is contained in a normal cake icing bag fitted to the CNC machine in place of the normal Dremel cutting tool. Around the frosting bag is a frosting 'extruder' that mimics the squeezing force that human hands normally exert on the icing bag. The icing bag uses normal couplers and icing cones, although I tend to use the very smallest tips I can find. The extruder has another stepper motor that drives a screw using a belt. This screw pushes down on a roller, which slowly squeezes the frosting out of the bag and onto the cookie (hopefully!).

Extruder Tip
In this picture you see the very bottom of the extruder, where the icing tip pokes through the hole in the bottom piece of wood. The Frost Bot is squirting frosting onto a piece of wood covered with aluminum foil (for testing). You can see that we forgot to turn off the extruder after we moved up away from the foil (after the image was complete) and so there is a 'tendril' of frosting from the foil up to the icing tip that shouldn't be there. The kind of circle/arrow logo that you see in these images is my company's logo.

Two Cookies Logic Logo

This is a picture of two rectangular cookies I made, one with the Logic logo and one with the word "Logic" frosted onto them. These were some of the very first trials of the Frost Bot. You can see one of the big problems with this version of the robot - the longer it frosts, the 'thicker' the frosting becomes. Next to the cookie picture is the way that the images looked in InkScape, which is the graphics application I used to draw them originally.

Front of FrostBot

This is a top down view of the stage, with a fresh test pattern (it is glistening!). You can also see a small part of the X axis screw, and a large part of the Y axis screw. The CNC machine kit comes as unpainted MDF wood, and I haven't had time to paint it yet. The extruder is also constructed from MDF as well.

FrostBot FrontFrostBot Front2
Now these are some great pictures. They both show the Frost Bot in its entirety. You can just barely see the icing bag inside the extruder. (The bag is clear plastic, and so looks blue because I had blue frosting in it.) You can see the extruder stepper motor on top of the extruder. It is supported by the red plastic tubes. The belt connects a pulley beneath the stepper motor to another pulley. Inside the second pulley is an aluminum shaft I machined on the lathe. There are two ball bearings (one above the pulley and one below). That top piece of MDF wood is bolted down, and squeezes the sandwich of bearing, pulley, bearing. The aluminum shaft is tapped for the 1/4 20 threaded rod that it rotates around. As the shaft is turned by the pulley, the threaded rod goes up or down. This in turn pushes on the metal tube (not visible in these pictures) that squeezes the frosting out of the bag.

Extruder UpExtruder Down
Here are two pictures - both have the front guide of the extruder removed so you can see what it looks like on the inside. There is no frosting in the bag, which is why it looks clear/white. The first picture has the extruder up, where we put it to load the bag of frosting in. The second picture has the extruder down, where it would be pushing on the frosting and extruding it onto the cookie (if there was frosting in the bag).

Electronics: The electronic portion of this project consists of a UBW controller board, a single board holding four EasyDriver stepper motor drivers, and a normal computer power supply delivering 12V to the motor driver chips. There are four home switches (one for each axis) that the UBW reads with four of its digital inputs. The UBW sends step and direction data to the Easy Driver Quad board using a simple SPI like shift-register scheme. It has a Clock, Data and Latch signal (and ground) to send the data into the latch chips, and then latch the data to the four driver chips. The motor driver chips are rated at about 750mA/phase, and even with this fairly weak current the stepper motors turn quite rapidly and with considerable power. Using a higher voltage power supply, or stronger motor drivers would allow the robot to move faster, but this would compromise the quality of the frosting job.

UWB and EDQ boards
Here is the UBW board and the Easy Driver Quad board without the fan so you can see how things sit on the breadboard.

Software: There are two pieces of software that the Frost Bot team wrote. One lives on the UBW board and interprets motor move commands from the PC (over USB) and generates the step and direction pulses for the four motors. It also reads the home switches and executes special instructions like 'home' and 'abort'. The other piece of software is a full Windows application written in Liberty Basic by Jemiah Aitch. It reads in HPGL files (graphics files) and interprets the files, breaking them into individual move commands which are sent to the UBW board. It also has logic for handling homing, offsets (i.e. zeroing), soft limits on all axes, pausing, and generating the correct among of extrude motor motion for each unit of distance traveled by the tip.

FrostBot PC Application screenshot
This screenshot shows what the LibertyBasic PC application looks like. You can see that it has loaded in a simple HPGL file and converted it to UBW step commands. The graphics start out as SVG files drawn in InkScape, then saved as PostScript files. Those *.ps files are read into GhostScript and saved as HPGL files, which are then read in by the LibertyBasic app and sent to the UBW.


Motivation: Every year the company I work for has a holiday potluck. Last year (2006) was the first year my UBW design was being sold by SparkFun, and so I hand-made and frosted cookies that looked like my UBW boards. Many people commented on how they liked the cookies, and they asked if there was a reason I didn't build a robot to do the decorating for me. (My friends at work know me pretty well.) Here are the UBW cookies.
UBW Cookies

So for 2007 I thought I really should try. I feared building my own CNC platform to base the robot off of, as I just don't have enough time for something that involved. Low and behold, FireballCNC sold me one of their wonderful CNC kits, which I quickly put together and had running. They really are great little machines. This was the perfect platform for the cookie frosting robot.

Two weeks before the holiday potluck at work, I figured I'd better get busy. I already had the UBW and EasyDriver Quad boards done, and so I wired them up, wrote the UBW software, and built the extruder. However, 3 days before the potluck, I still had no PC software. Jemiah came to my rescue. Over the course of about 3 nights, he got the PC application written and we started decorating cookies. Our first cookie was decorated with the Logic logo at about 4:30 AM the morning of the potluck.

Limitations: The biggest limitation with this current design is the very poor behavior of the icing bag. The bag swells out as pressure is applied, and so starting and stopping the stream of frosting is very difficult. Also, the amount of frosting extruded per step of the extruder motor changes in a very non-linear way, depending upon how tight the bag is, where the pusher tube is along the bag (the bag is a cone, so the further you go the more frosting comes out with each step) and where you are in the current 'squeeze'. It is very difficult to control.

Emily Schmalz picture
This picture shows a test print that used a much thicker frosting and smaller cone tip. The frosting stayed relatively consistent throughout the entire image, although the start and stop points did get too much frosting (because starting and stopping the extrusion is difficult to do rapidly).

Another large limitation is the difficulty in changing frosting bags. I was hoping to be able to do multiple colors, but this didn't happen with the first version of FrostBot.

Frost Bot Future: The next version of the robot will have a syringe type frosting extrusion system so that I can more precisely start and stop the frosting flow. It will have improved software that hopefully allows for as smoother user experience. This robot will never be a 'useful' tool in the sense that it is much faster and easier to frost cookies by hand. However, it is very fun to watch and might serve as a great introduction to CNC control and embedded systems engineering in general.

Downloads: We are making the current software available. However, this software was not written to be published. It was not written to be useful to anyone but us on the FrostBot project. It was not commented, designed, architected or debugged. In other words, we're not very proud of how this code looks. But it does work, and for the amount of time we put into it, that's amazing. Do not expect us to support this code, or provide future versions, etc. You're welcome to do whatever you wish with this code, there are no restrictions.

To download the software used in this version of FrostBot, please see this page.

The Frost Bot Team: I (Brian Schmalz) did much of the work on this first version. However, I had considerable help. Jemiah Aitch (a co-worker of mine at Logic and all-around awesome guy) wrote all of the software that runs on the PC to control the robot. He also helped out (in a string of very late-night hacking sessions) with the systems engineering and integration of the whole thing. John Hansford designed and built the 3-axis CNC mill kit that I assembled and modified into the final Frost Bot base. I built the frosting extruder assembly (4th axis), designed both the UBW controller board and Quad Easy Driver motor driver boards, and the step and direction software running on the UBW. Much of the UBW software and EDQ work was based upon work I've been doing to help out Elias Crespin and Bruce Shapiro.

Questions? E-mail me at e-mail