The smart crust-cutting robot
By David Crookes. Posted

There’s nothing quite like a good bread debate to get people talking. Do you cut sandwiches into rectangles or triangles? Are you calling it a roll, bap, barm, or muffin? And do you eat your crusts – thereby ‘guaranteeing’ your hair will grow curly – or slice them off and throw them away?
Advertisement
The desktop computer you've been waiting for: Raspberry Pi 500+
For Andrew DeGonge, the latter question has a clear cut answer: crusts are to be chopped. Indeed, he’s so determined that the sides of bread are banished, he’s used his loaf and created an automatic guillotine-like device to do the hard work for him.
“Crust in general isn’t my main problem. Cheap bagged bread is,” he tells The MagPi. “It’s all so mushy and the crust is even more of a burnt soggy mush. So, like any reasonable adult I prefer bagged bread without it to make it a bit more tolerable, although I do love the crust on a good sourdough or Italian loaf.”
No crumby thought
The idea for a crust cutter rolled into his head when he was considering building a robot with computer vision. “I wanted it to be original so I thought to myself, ’what’s a problem many people have that doesn’t have an automated solution?,” he says. “I realised there was no way to automatically cut the crust off sandwiches so decided to create one, just because I can.”

Andrew spent ten hours creating a CAD drawing of the project, ensuring enough room for the necessary motors and knife. “I went with stepper motors for the motion control and used V-slot extrusions and wheeled gantries for linear motion,” he explains.
He also built a custom four-axis control board (“the OSR, which controls all of the stepper motors”) and he used a Raspberry Pi 4 paired with a Camera Module V2. “Raspberry Pi is the easiest and cheapest way I know to integrate computer vision into my projects,” Andrew says.
As such, with the components sitting within a 3D-printed frame, Andrew envisaged placing a sandwich on a rotating cutting board before having the camera take images for analysis using OpenCV. “I spent 30 to 40 hours on the code, which included all the OSR, computer vision, and Python segments,” he reveals. It was time to get chopping.
Sticking the knife in
By comparing the current image frame to previous ones, the device determines the shape and size of the bread. “I then feed the rotation of the rectangle to the stepper controlling the turntable cutting area to align the sandwich with my knife,” Andrew says. “Next, the knife moves horizontally in the X-axis to a position that is a small offset in from the edge of the bread, and finally the Z-stage comes down and makes a cut. Then it’s a matter of doing three more rotations and three more cuts to remove the rest of the crust.”

The main problem was figuring how to convert the camera’s pixel measurements into real-world measurements. “I ended up uniformly converting the measurements because cutting food doesn’t need to have sub-millimetre accuracy,” he says. “I ran into some motor control issues which ended up being bugs in my stepper control loops, but it all works pretty well.”
Now Andrew doesn’t worry about crusts, especially now he’s using a sharper knife. “People criticised the bot for not cutting well enough, so I redesigned the gantry to support a sharper knife while using a pivoting knife mechanism and adding a food-holding spring-loaded platform. It’s now a seriously capable bot that cuts bread very cleanly and accurately. It’s cool, if not a little scary.”
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles

Raspberry Pi 500+ in Raspberry Pi Official Magazine issue 158
We’re quite taken with Raspberry Pi 500+. But when you don’t need all that processing power, and just want a board that will make a plastic skeleton jump around in a terrifying manner, you’ll find Raspberry Pi Pico more than up to the job. There’s more terror in the magazine (which is only right as […]
Read more →

Win one of five Raspberry Pi SSD 1TB
Raspberry Pi prides itself on high quality hardware, and this 1TB Raspberry Pi SSD is no different. You can use it with a standard Raspberry Pi or even in your desktop PC – the choice is yours. We have five to give away and you can enter below Win 1 of 5 Raspberry Pi SSD […]
Read more →

Dual-screen cyberdeck
Twin screens mean you can code on one screen while watching David Bowie’s 1978 Musikladen show on the other.
Read more →
Sign up to the newsletter
Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.