Sensors for range detection and line follower

Hi guys, can you help me to choose the right sensor for range detection and line following mechanism?

For range detection i looked into:


For line following:


Which one to choose and what is the best practice to make automatic robot that can determine the obstacle by itself and bypass it? How many ultrasonic range sensors i should use?

@ andre.m -
I use RC model as a chassis (speed and steering are controled via PWM and servo). I know there are a lot of threads and questions about the obstacle avoidance. But what is the most efficient way to implement this task in my case? Should i use an ultrasonic HSR04 or IR Sharp detectors fits best? How many sensors should i use for stable obstacle avoidanse? How the sensors have to be situated and so on? Does anybody have experience of implementations?

We don’t know much about your environment, but here are a few things to consider…

Some things (like cloth and some types of furniture) can be invisible to ultrasonic sensors - they won’t see those objects.
Some things (like black matte surfaces and certain fibers) can be invisible to IR sensors - they won’t see those objects.
Some hard surfaces will give false distance readings for ultrasonic sensors (due to reflections at oblique angles). This is especially a problem in mazes.
Ultrasonic sensors also have a dead-range where they won’t see objects that are too near.

In general, unless you are absolutely certain of what you will encounter in your environment (e.g., you are targetting a specific competition arena) then you need a combination of sensors. If you are just doing obstacle avoidance and dead-reckoning calibrations, then fixed sensors are sufficient, but if you are doing localization and mapping (SLAM), you need richer sensor data.

So tell us more about the type of environment you will be in; how fast your platform will move; and what type of navigation you want to do.

(and yes, you could say I have some experience with robots :slight_smile: )


@ mcalsyn’s advice is good. The only thing I want to add is that LIDAR is another sensor option to consider if you want to detect objects farther away. Both ultrasonic and IR have fairly short working distances.


Thank you for a full answers and valuable tips guys

@ andre.m -
I would like to calculate my robo position in the area(room).
@ mcalsyn -
My enviroment is a flat with different kind of surface (wooden furniture, wallpapers and so on). First of all i want just to do obstacle avoidance and dead-reckoning calibrations. What do you mean by fixed sensors, do you mean the statically situated? I seen some robo videos with SR-04 that spins around on servo, what do you think about this approach? Does it fit my enviroment or it’s better to use it for SLAM?
(You definitely have a robo experience :smiley: )

@ ianlee74 -
I will consider LIDAR if decide to use a robot outside. Inside the flat there is no long distance to be measured.

Yes, by ‘fixed’ I meant statically situated.

Even indoors, I do like the looks of the Lidar unit, but it is too costly to use more than one, so with that one, you could rotate it (hint: Adafruit sells six-wire slip rings that allow for continuous rotation - maybe sparkfun does too). Rotating ultrasonics has never worked out well for me because the rate at which you can read and move them is too slow - it really limits the speed at which you can move your bot. But rotating sensors, in general, isn’t necessary for basic area coverage and obstacle avoidance.

Consider, as an example, the Roomba. Roombas don’t use SLAM - they just employ a series of coverage patterns and escape maneuvers. They have a Sharp IR sensor on one side (for wall following), mechanical contact sensors (switches), cliff sensors (downward facing IR and wheel-drop switches), and wheel encoders if I recall correctly, and yet they can do an excellent job of covering a room in spite of obstacles. They rely heavily on the contact sensors. There is a tendancy to over-do sensors on hobby robots, so think carefully about what you are trying to achieve.

So :
a) if you just want to move and cover an unknown space without mapping it, you just need a small set of fixed sensors, and contact sensors are cheaper and more reliable than anything else (if less sexy). If you can’t touch obstacles, then choose IR or ultrasonics, but be aware of their blind spots (discussed previously)

b) if you want to move within a map that is know ahead of time, but which may contain unmapped obstacles, then you need wheel encoders and IR/ultrasonics to correct for errors while moving (wheels slipping for instance) - and again, I always recommend contact switches as a failsafe.

c) if you want to map an unknown space, then you need to always know your position within that space and you need to match up current sensor measurements against the map you are building up. That requires fast, dense, accurate, and repeatable measurements, and probably is best done with lidar. SLAM may require more memory and processor power than you will have on most NETMF devices. I won’t say it is impossible, I just think you’ll probably have to use wifi or something to offload some of the processing.

And one final note about ranged sensors like IR and ultrasonics: It’s easy for thin objects (table legs, chair legs, cats, etc) to slip in between their fields of view, so contact sensors are always a good idea.

1 Like

@ mcalsyn -

Answer is getting longer))) really appreciate it…

Roomba is good example of what i am trying to achieve.
There are a lot of variants i see. But it seems like the best is “a”. I will buy both ultrasonic and IR range sensors and try them all. Did you try any kind of contact sensors? Can you advice wich one to order please?

Contact sensors are generally custom built on your robot - just a microswitch with a whisker on it, or a microswitch and some sort of ‘bumper’. You can get microswitches from your favorite electronics supplier (Sparkfun for instance). In a pinch, I bet you could even make a Gadgeteer button work.

You can even buy bumper switch kits :

Just use your favorite search engine’s image search with “robot bumper sensor” for some ideas.

1 Like

@ mcalsyn -
Thank you very much!!! I am ready to start shopping and coding…

Just spotted this and thought it was relevant : Scanning lidar on a Disco 429 using the lidar from a Neato XV-11 vacuum (about $350 on Amazon, $179 on ebay). You could probably get similar results with the Sparkfun device and a slip ring, motor, and hall effect sensor, but if can get an XV-11 on ebay, it seems like a cheaper and faster way to go.