Build your own smart lawn mower with Raspberry Pi

I’m sure you’ve heard that it rains a lot here and that we don’t get a lot of sun. So when those brief dry spells happen on a weekend, you pretty much have to mow your lawn right then, lest you find yourself overrun by undergrowth. However, mowing the lawn takes ages and is really boring. So we will be building this open-source lawn mower robot immediately.


Maker Clemens Elflein devised OpenMower after being let down by the current generation of robotic lawnmowers. The only models he could find simply drive themselves in a straight line until they hit a perimeter wire buried in the ground, at which point they turn around a bit and then set off in another straight line. OpenMower is able to localise itself using very precise real-time kinematic (RTK) positioning, meaning it can mow a patch of grass much more efficiently.

Learning the map

OpenMower is so smart it can roam freely between different mapped areas. So if you have a front and a back garden, it can mow one, drive itself round to the other, and start mowing again.

Clemens’ dad teaching his OpenMower the perimeter map

To teach the robot where you want it cut the grass, you first have to drive it around the area using a remote control. Clemens’ dad taught his OpenMower using a standard Xbox controller. He mapped it to mow tightly up against the edges of the patio and to cut a neat circle around the base of a tree.

The robotic gardener starts off cutting the perimeter of your mapped area, then efficiently mows neat lines until it has cut the entire area.

How does it work?

Clemens picked up this off-the-shelf robotic lawn mower for €400. It meant that the main mowing motors and batteries were already in place in a neat waterproof package.

Clemens added Raspberry Pi 4 as the main processor of the OpenMower software. It handles all the big jobs like navigation and localisation. All the real-time tasks are a job for a Raspberry Pi Pico, which hides underneath the RTK GPS board.

Want to build your own smart lawn mower?

Everything you need is on GitHub. Clemens advises that you ask him any questions on Discord before you get started, as this is an expensive build to mess up.

Hi Clemens!

What day do you get your garden jobs done? We polled Pi Towers and we’re all Sunday afternooners.

10 comments

Supra avatar

Never mind. I will do it myself using picamera and CV.

Jimmy avatar

I checked them out and it’s a really nice idea. The project isn’t fully documented yet though for all stages with instructions missing. Parts are looking like €1k total or thereabouts.

Randall avatar

That would be a nice project…. If there was any Raspberry pi available.

Anthony avatar

Fantastic. Now I only need to get a raspberry pi (sold out everywhere) at a reasonable price (not possible)

Jonathan Linux avatar

Yeah. PI 400 is still on sale for same price. But most people want like pi 4 with only the board. Cant believe we are going through a shortage right now. I am sad. :(

Janos Kovacs avatar

#include
#include

void setup() {
// initialize the robot
Robot.begin();
}

void loop() {
Robot.motorsWrite(255, 255); // move forward
delay(2000);
Robot.motorsStop(); // fast stop
delay(1000);
Robot.motorsWrite(-255, -255); // backward
delay(1000);
Robot.motorsWrite(0, 0); // slow stop
delay(1000);
Robot.motorsWrite(-255, 255); // turn left
delay(2000);
Robot.motorsStop(); // fast stop
delay(1000);
Robot.motorsWrite(255, -255); // turn right
delay(2000);
Robot.motorsStop(); // fast stop
delay(1000);
}

Jon avatar

Checking out that brand of mower in the US from amazon is a lot more expensive than 400 pounds (500 USD). In the US it’ll cost me close to double that at $965

Raymond Ramirez avatar

I have two Roombas and two IntelliVac units. Can I use any of them?

Ashley Whittaker avatar

If I ever get round to installing artificial grass, I reckon a Roomba would be ace.

Tadas avatar

what if we take an old phone, install raspbian into it (or maybe even not?) and then add some external usb IO to convert the phone into a sort of minicomputer? Pi are scarce, but phones, especially old ones, are really plentiful. You can install python into them, they can connect to the net, heck they even have a camera and gyro/accel!

Comments are closed