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
Jump to the comment form

Avatar

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

Reply to Supra

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.

Reply to Jimmy

Avatar

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

Reply to Randall

Avatar

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

Reply to Anthony

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. :(

Reply to Jonathan Linux

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);
}

Reply to Janos Kovacs

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

Reply to Jon

Avatar

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

Reply to Raymond Ramirez

Ashley Whittaker

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

Reply to Ashley Whittaker

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!

Reply to Tadas

Leave a Comment