WEEK 10
Mechanical Design and Machine Design
The EECS section built a multi-color CoreXY pancake printer. I was one of the two software team people, and I built the path from an SVG drawing to a list of print moves during my travel.
November 2026
Initial Machine Design
In this week, our EECS section chose to work on an automatic pancake printer. The machine design was inspired by the DIY Pancake Printer project from earlier years. The idea is that it would be a coreXY machine that can draw 2D arts on a griddle through extrusion of pancake batter.
Unfortunately this week also overlapped with my conference travel to DC, so I chose to be on the software team and worked on the initial part of the design-to-toolpath pipeline remotely. The frame, the carriages, and the syringe head were built by the mechanical (CoreXY) and extrusion side of the section. We are also working with the firmware team during integration to implement the motion planning and the syringe control. In the code I attached here, Tudor Mocioi wrote the firmware wrappers. Andrin Schmid wrote the GUI. The shared write-up is on the EECS machine week page where you can also find my contributions.
I start with the idea of software after our initial group discussion. Later on, I decided to narrow down my job to the design-to-toolpath pipeline. The goal is that it reads an SVG, assigns each color to a syringe, compensates for nozzle offsets, fits the drawing where every nozzle in use can reach, orders the strokes, and hands back an abstract list of print events plus a preview and some statistics. I also wrote the first end-to-end hardware layer (CoreXY motion, a UFP board driver, and a command-line printer) and the interface spec, so the whole chain could be tested in simulation early on before the gantry existed. As specified in the readme, I worked with both copilot and Claude to produce the package, but code generation followed my planned outline. I also reviewed and verified line by line to make sure quality.
In the last few days Tudor rebuilt that hardware layer on his own wrappers, which added homing and a real syringe cycle. Andrin's app calls my pipeline for every print. The files from the SVG through the event list stayed as I wrote them. Tudor set the job to start from the homed gantry.
SVG conversion and toolpath planning
First I laid down the parameters. Every hardware parameter lives in config/machine.example.yaml,
so the team could change units, the homing offset, and the syringe values without touching the planner.
And the planner stops at an event list (SelectNozzle, Move, ExtrudeOn, ExtrudeOff, Dwell).
When we dropped G-code for the UFP boards, and again when Tudor moved the last stage onto the firmware wrappers, everything up to those events stayed the same.
photo or drawing
-> Andrin's app (image_to_pancake, GUI)
SVG -> svg_input -> colors -> geometry -> toolpath
|-> preview
|-> motion -> ufp_driver -> firmware wrappers -> UFP boards
my pipeline
The app calls three of my functions: svg_to_job() in pipeline.py, trace()
in preview.py for its own drawing, and plan_motor_moves() once it wants motor steps.
Photos, hand drawings, and test squares all need to become SVGs first, so every print goes through this function.
SVG to a job
def svg_to_job(svg_source, cfg: MachineConfig) -> Job:
paths = load_svg(svg_source)
color_map = assign_nozzles(paths, cfg)
area = cfg.reachable_area(set(color_map.values()))
d = cfg.design
paths = place_in_area(paths, area, d.margin, d.fit_to_print_area, d.max_size)
paths = simplify(paths, cfg.print.curve_tolerance)
events = plan(paths, cfg)
return Job(paths, events, stats(events, cfg), color_map)
SVG is evil to parse manually, so svg_input.py uses svgelements.
Each M starts a new stroke. Curves are sampled about every 2 px, pixels become millimeters at 96 dpi. Note that Y is flipped because SVG's Y points down.
Pixel to millimeter, Y flipped
pl.points = pl.points * [PX_TO_MM, -PX_TO_MM] # px -> mm, flip Y (SVG Y points down)
geometry.py then scales the drawing by one factor, min(avail_w / w, avail_h / h),
so the aspect ratio stays to preserve the original drawing, and centers it in the print area minus a margin.
Douglas–Peucker simplification (shapely) runs after that scale, so the tolerance is in real millimeters.
On the smiley demo that is 774 points down to 119 at 0.2 mm. The app turns fitting off for photos, which already have a physical size, and uses 0.3 mm so the gantry stops less often (from Andrin's config).
smiley.svg, one nozzle. Dashed lines are travel with the syringe off. The red numbers are the stroke order the greedy planner picked. Footer time is the constant-speed estimate, about 0.7 min.
hi.svg. The letters are plain strokes, eight of them, so travel jumps to 247 mm. The H alone consists of three strokes.
Each stroke is the same sequence: travel to the start, extrude on, an optional dwell, the printing moves, extrude off. Open strokes may be reversed, and a closed loop starts at the closest point. Ordering is through the greedy nearest-neighbour.
One stroke
events.append(_move(cfg, nozzle, pts[0], pr.travel_speed, False))
events.append(ExtrudeOn(nozzle))
if pr.extrude_start_delay > 0:
events.append(Dwell(pr.extrude_start_delay))
events.extend(_move(cfg, nozzle, pt, pr.print_speed, True) for pt in pts[1:])
events.append(ExtrudeOff(nozzle))
Color and nozzle offsets
colors.py sends each SVG color to the syringe whose configured batter color is closest.
The distance is redmean, a cheap perceptual RGB distance, so a designer does not have to hit the hex value exactly.
The app's photo converter writes the three nozzle colors into its SVG, and this step sends each one to its own syringe.
Nozzles print in color_order. First printed cooks longest, so that slot is the darkest batter.
The nozzles are fixed on the carriage, each with an offset from the gantry reference.
A bed point (x, y) needs the gantry at (x, y) - offset. reachable_area() in config.py intersects the print area
with what every nozzle in use can actually reach, and the drawing is placed in that intersection.
two_color.svg. The dark features map to nozzle 0 (180 mm of line) and the light outline to nozzle 2 (753 mm).
Hardware and Integration
The first hardware layer was mine, written so the pipeline had somewhere to go and test before the firmware existed.
The README said the firmware team could replace motion.py and ufp_driver.py.
And Tudor did that on 16 November. CoreXY math now lives in his xy_geometry.py, and the software plans in millimeters.
Each stroke is prime, then one extrude timed over the stroke, then a retract, through his SyringeBank.
In my first version the plunger was a third motor locked to the XY move. The gantry homes on limit switches, and home_offset says where that homed point sits in machine coordinates.
Andrin's pancake_machine app is the part a person actually drives:
find boards by MOTOR_ID, connect, home, jog, run the syringes, print, and stop. Photo to a 3-color SVG is also the app (image_to_pancake.py).
Below I also list some miscellaneous issues that were fixed by other people after my initial version.
firmware_link.pylooked infirmware/instead offirmware/scripts/. Fern fixed the path. The app setsPANCAKE_FIRMWARE_DIRinstead.- Hector Astrom found that a fractional plunger step leaves the motor in a weak half hold. The app rounds each stroke and carries the remainder. His syringe measurements are also what the app uses for real plunger numbers (about 0.0745 steps per mm of line, and 2135 steps of travel on a 150 ml syringe). The example config still has the placeholder of 1 step per mm.
set_current(1.0)wraps in the board firmware and commands no current. The app caps currents at 0.99.- Tudor's
XYStagedefaultsx_home_posto 500 mm.open_machine()does not pass the box width, so a smaller bed fails homing. The app passes the box's x max. - The example config puts motor A and syringe 0 both on MOTOR_ID 3. The app uses MOTOR_ID 1 through 5.
Tests
We also prepared some tests that millimeter scaling, aspect ratio, the Y flip, travel versus print, nozzle offset, and the reachable area. The below table details some planned motion. The actual number may be somewhat different.
| Design | Strokes | Print (mm) | Travel (mm) | XY moves | Time (min) | Syringe steps |
|---|---|---|---|---|---|---|
| smiley | 4 | 589 | 92 | 123 | 0.9 | e0 589 |
| hi | 8 | 526 | 247 | 32 | 0.8 | e0 526 |
| two_color | 5 | 933 | 96 | 188 | 1.3 | e0 180, e2 753 |
Remaining issues and future improvements
- Measuring SVG arcs at the library default made the tests take about 50 seconds. Measuring length at
1e-4is what sets the sample count, and it is a few hundred times faster for the same polyline. - An offset nozzle could not reach part of the print area. The fix is to place the drawing in the area every used nozzle can reach, instead of erroring halfway through a demo.
Code
Download the pancake printer software (.zip)
Team copies, for the version everyone integrated against: software README, group page, Tudor's week 10, Andrin, Fern, Hector.