CNC Pancake Maker

In How To Make Almost Anything, we're extremely fortunate to have access to the incredible (and expensive) machines in the shop. To further our appreciation of shop's capabilities, this week we've been tasked with building a CNC machine as a group. We have a shared page where you can view how the project came together, but on this page, I'm documenting my personal contribution.

Figure 1: Our final mods interface (it was too big to just take a screenshot)

Image Processing

I decided that I was best suited to contribute to the software design and implementation for this project. Early on, I helped describe the system architecture and define the constraints. We decided that we wanted to create gradients in our pancakes which required separating our toolpaths into various sections. The user uploads an image, which is then thresholded into five regions. The first, darkest region, describes the outline of the image. This is drawn onto the griddle first and therefore would cook the longest (giving it the darkest color). The other thresholds define spiraling in rastered areas. We looked at videos of pancake artists and decided that spiraling the batter inward would leave us with the most uniform distribution of pancake batter. Notably, the final layer covers the entire png design. This is a security layer to make sure all the separate layers connect together. After the thresholds are calculated, they are processed and thresholded. Sean wrote an invert image function, as we wanted to pour batter inside the image instead of outside, but when we thresholded the images, they described the opposite.

Calculating Z-Extrude

My other main contribution was writing a distance function for the z-extruder. Since we were only using two axes (and three motors) on the CNC machine, we had room to use an extra motor on the TinyG board. We had decided to use a motor to actuate the plunger in our pancake batter container. Because the distance between two points being described in the GCode can vary, and because we wanted uniform batter distribution, we had to write a function that would scale the batter being poured relative to the distance between the two points. To do this, we did the following at the GCode level.

Figure 2: The Distance Formula

For every line in the GCode, we looked at the previous x,y,z values and the current x,y value to calculate the new z value. We used the distance formula above, where x1 and y1 represented the previous x,y values and x2 and y2 represented the current x,y values. Next, we scaled this distance by a coefficient so that our extruder moter would plunge at a reasonable rate. Last, we added this new distance to travel to the previous z value.

Content Generation

Figure 3: CBA Logo

Figure 4: Gudetama

Figure 5: Scratch Cat

The last thing I did for the project was prepare images to be pancakified. I chose simple images with clear boundaries that would look good when thresholded to 4 layers. Additionally, to minimize risk and for continuity, I processed each layers RGB values to be (20, 20, 20) for the darkest layer and (64, 64, 64), (128, 128, 128) and (192, 192, 192) for the lighter layers. Additionally, the background of the image represents the machinable size of the bed (approximately 20 inches by 10 inches).