Distance measuring (particular ambient conditions)

Good morning,
I am creating a simple robot to mark some lines on a field. My problem is that I need a distance sensor to measure the distance of my robot from the wall so that the marked line is as much straight as possible (parallel to the wall). However the sensor should satisfie two basic requirements:

  1. It should measure distances between 1 to 5 meters
  2. It should not be too pricy (let's say less expensive than 10 dollars)
  3. It should be able to take the measurament even if the wall has a really irregular texture

Anyone has an idea on how to achieve this?
Thank you all in advance

Get a distance sensor that can handle that range.
Like the ultrasonic HC-SR04 or ToF based VL53L0X. Both are cheap, less than a dollar or a few dollars depending on what dollars you're using.

That's quite a vague requirement. Would +/- 5cm be good enough?

Probably not.
+/- 1cm is the maximum.
There's a reason behind this number: the marked line is 10 cm wide so I accept maximum 1 cm of deviation from the absolute straight path (or in other words a 10% error margin)

From my experience ultrasonic sensor cannot handle 5 meters distances with a good level of precision. I have never used ToF sensosr but I have read online that they are not good for extremely rough textures. Am I wrong?

Probably not possibe on a 10 dollar budget.

Ok then what percentage of error on 10 cm should I admit to stay in my budget?

Give me a few days

Otherwise are there any ways to ensure that the line is straight?

Now you give a different requirement.

First you asked for x cm from a wall, now you ask for the line to be straight. That are DIFFERENT requirements, which have different possible solutions. If you have a straight wall that is completely free of obstacles for the length of the line you want to draw, following that COULD be a solution if the line happens to be parallel to that wall.

For straight lines I'm thinking of laser guidance, though don't recall having seen that in conjunction with Arduino/hobby projects. Basically place the robot on one end of the line, and a beacon on the other end, and have the robot go straight towards that beacon. Should be quite similar to line following though the line sensing part may be a bit trickier.

Ok I am sorry. The correct requirement is the line must be parallel to wall

This device has an acuracy of +/-2.5cm at 5 meters or less but it's more than $10

Unfortunately price is a problem because I have some mechanical and electronical equipment on my robot that already costs a lot. If there are any cheaper ways to do the job it would be perfect. Otherwise I will just pay

Offhand I don't have a solution.
Maybe another forum member has done something similar with the acuracy you want.

Maybe if I explain you what this robot should do it would be easier to find a solution together.

I own a small football court where I usually play with my friends. The court is not perfect, the surface it's not perfectly even and also the football goals are not perfectly aligned.

Since today we always used a manual machine to mark lines with chalk powder but it's always a boring work that requires a lot of time.

I am trying to create a robot that can do this job for us marking lines with powder chalk. The best idea I had to try to make the lines is to make them parallel to walls as we used to do when we did this job manually. I don't know if it is a good idea or maybe i should switch to another method to solve the problem.

Are you saying that when you did it manually you were able to keep the distance of the line from the wall to within +/- 1cm. How did you do that?

I didn't think about this particular :sweat_smile:. Excuse me if it was a loss of time.
We were surely able to achieve pretty straight lines without curves and quite parallel to wall (we measured the distance from the wall at one end of the court, placed a small wood piece in that point, then went to the other end of the court, measured the distance from the wall, placed another small wood piece, put a string between them and followed that string). I hope the job of putting and removing references (as the wooden pieces) could be bypassed in some way

It's not a simple problem.

Unfortunately I know but I hope to find a solution with the help of the members of the forum. Otherwise we will do it manually again

Give it a day, forum members are all over the world.