I'm designing my lawn mower robot, and I am in the perimeter stage. The electronic part is done, and works quite good, now comes the software.

I need an advice on how to deal with the problem of line following. I mean, once the robot is on the line, parallel to the line, that's relatively easy. But how to manage the situation when the robot is driving around and approaches the line (wire)?

I have two sensors, left and right, turned 45° with respect to the forward direction.

The robot could arrive from any angle, so the signal amplitude read from the sensor could be completely random.. So I don't understand what to do in order to move it in the right position on the wire... What's the usual approach?

The idea is the same as here:

Ardumower perimeter wire

The wire is all around the yard. on the mower there are 2 sensors, left and right, that sense the signal emitted from the wire, a square wave signal at 34 KHz. The signal amplitude read from the sensors on the mower is about 2 V when it's above the wire.

  • $\begingroup$ You mention "line" and "wire" - can you draw your setup? I'm having a hard time visualizing what you're doing, unless you're going to rig up (fishing?) line all around your yard or something. I'm not sure what on the mower would interact with the wire, etc. $\endgroup$
    – Chuck
    Commented Oct 5, 2015 at 13:37
  • $\begingroup$ Welcome to Robotics user3318528. On stack exchange, it is better to edit your question to add information requested in comments, rather than adding more comments. Comments are for helping to improve questions and answers, and are distracting, so we try to keep them to a minimum. If all of the information needed to answer the question is contained within it, the comments can be tidied up (deleted). $\endgroup$
    – Mark Booth
    Commented Oct 5, 2015 at 14:35
  • $\begingroup$ It sounds like your robot is using a boundary line as a navigation line. Is your robot mapping where it's already been? $\endgroup$ Commented Oct 5, 2015 at 17:29
  • $\begingroup$ I didn't do anything regarding the movement of the robot, I started the project from the perimeter wire, so at the moment I'm focusing on this part... $\endgroup$
    – Val
    Commented Oct 6, 2015 at 6:10

1 Answer 1


There are a lot of possible ways to solve your problem.

First, let's get you off the wrong track: this isn't a simple, line following problem. For it to be a line following robot, you need to lay track lines under your lawn for every place that you want to mow. Imagine a grid like a potato masher instead of the one your drew.

The problem seems to be:

Given a perimeter wire & an autonomous robot, how can I make a robot mow my lawn, and how can it do the job in a relatively efficient manner? (ie: don't take a random walk).

Here's what I would do:

1) Add a start/stop location to you map. You could use a strong IR emitter and sensor (test it to make sure your robot can see it in bright sunlight). Add this to your "charging station" and you've killed 2 birds with 1 stone.

2) Ensure that you're using encoded motors for your wheel motors. I'd take an approach similar to SLAM, but without the on-the-fly mapping. You can encode your yard as a map, making the code and problem drastically easier.

MIT's "SLAM for Dummies"

Also look into "particle filter localization".

3) Assume your yard is forever static. If it's not (if you plant a tree, remove the pool, or get a pile of mud after a storm, etc), we'll get to that in code with obstacle avoidance & with localization. But for now, we'll start with the simplest case, and we'll build up in difficulty from there.

Now with these 3 additions, I'd start the robot by hugging to the perimeter line -- this is its one little bit of line following. Let's start at the home, ie: the "charging station," and we'll work up the map towards the house. The root will straddle the perimeter wire. When the left sensor drops from 2V to zero, you're at the top of the map. Turn right, follow the line for x-inches or x-centimeters, turn right again, and go down the line blindly. This should work well until you reach the house's left perimeter line. You'll need to try this out in the yard and see how reliable your encoders are, how little slippage your gears give, etc.

Particle filtering will help your robot as it moves blindly to the next perimeter line.

The next issue to tackle is how to get around the pool. The encoded wheels will give you a decent idea of your positioning, so you can simply revert back to line following when you hit the pool perimeter. Follow the line for x-inches again, and turn. Unlike your exterior perimeter, your turns here are not 180 degrees. You'll need to experiment.

In lieu of trying to work that out, you can just avoid the pool area. Mow the easy part of the grid (everywhere that allows for simple 90 and 180 degree turns), and then come back to the pool at the end, where you're more likely to have poor localization.

I'd also add a sonar sensor at the front for obstacle avoidance.

I hope this spurs some ideas for you.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.