Drop and Obstacle Avoidance - Which Sensors to Use

Hello Everyone! 

I'm new to the forum and had a few questions regarding sensors. I'm building a project bot and I'm looking for some info regarding two topics for some things I need the bot to do.

1) Not crash into anything - obstacle avoidance

2) Not fall off of anything - drop sensors

A couple dilemmas are - Direct daylight and dark surfaces.


1) With my first objective. I was considering using simple infrared sensors to detect when anything is close to the bot, and having it adjust course. Although, I want my bot to be able to work in direct daylight. It seems that some bots have problems with daylight interfering on the sensor. So my question is -What sensor would work best for object detection in daylight? Would it be an IR sensor with a filter or tinted cover on it? How well would that work inside or in the dark? Or would proximity sensors work best?


2) My next objective is - to prevent falls using a drop or "cliff" sensor. I'm looking for a sensor that detects up to a certain distance (say only about 3-5cm). My question is - what kind of sensor would I need to use? Maybe I just dont have the proper terminology for it to find them. I would need a sensor that constantly sends and recieves a signal at a very small distance and when that signal either takes too long to come back or it doesnt come back at all (say the sensor has gone over an edge) then it will send a signal to the board letting it know there is a drop. Also, daylight comes into play with this as well, although since the sensors are under neath, would I need to be concerned with this? Another thing, is dark surfaces. Ive noticed some roombas have problems with dark carpets, registering them as drops. 


Any input is greatly appreciated. Thank you so much! I'm very excited to get into the world of robotics and some fun projects.





Distance sensors

Most commercial IR distance sensors use a light pulse scheme and do a fairly good job of removing the background light. They come in various models that typically specify the useful range and cost about $15US. They provide either an analog value that can be converted to distance or a digital within range or not. I do not recall the exact update rate but is is a few times per second.

You could also use sonar modules and measure the time of flight for the echo. The really low cost ($3.00US) are really quite poorly made.

For a long range solution you could go the LiDAR path for about $120US.

Our sponsor site, RobotShop, carries just about everything including tutorials. Lots of examples and help can be found on this forum.




I came across the robotlink HC-SR04 Distance Sensor for Arduino - looks like this will actually be my best bet as opposed to IR. They seem to be pretty popular and fairly straight forward. 

So - with my bot, I can put one at each corner and my understanding of it is that I should be able to adjust how close of a range I want to work with. Say if it detects a ping that says an object is 10cm away, it’ll tell the arduino board. Is this correct?


Will these be useable for drop sensors as well? Essentially reverse operation. Where it needs to detect a 5cm or less ping, and if its longer itll send a signal indicating that theres a drop.

If I were to use the HC-SR04

If I were to use the HC-SR04 ultrasonic sensors - is it possible to get one that is similar to a cars reverse sensors in the rear bumper? I want the sensors to be water resistant as well, but it appears or I dont think the sensors will work with a piece of clear plastic infront of it. What do you think?


Also, back to my original question of IR - would an IR filter be effective to cut down on hard light from reaching the sensor? If thats the case - I could effectively use that instead and it would be weatherproof asopposed to the ultrasonic HC-SR04. I could use car sensors but they wont work with the close range im working with.

Sonar vs IR

IR will probably be more accurate a close range. With sonar you measure the time it takes for the echo to return. IR distance sensors compute the distance by evaluating the angle, not the magnitude. How much “hard” light are you designing for?

Leaning towards IR

Thanks Gallant - broad summer day light is what I’m going for. 

I actually am ordering a small bot car to test and will see how the IR works in broad day light. It’s not going to be moving fast. I’ll post results in a few days. Just doing my due dullogence prior to. 


So looks like sonar is out of the question due to how close I want the readings ( at 10cm) and the only available sonar at that distance isn’t waterproof for the elements.  


When it cones to IR and day light supposedly making it hard on the receiver - what options do I have when it comes to shielding? I’ve seen posts regarding having the receiver in a flat black tube, pushed back. Similar to how a lens hood works on camera lenses. And just aiming the sensor.  What about filters? Can I get one that let’s IR pass through but not normal day light? 

IR Distance Sensors

The IR Distance sensors that I have (Sharp xxx) appear to be somewhat weather resistant. Molded plastic case with sealed lens. The circuit board would need some sort of protection. As a side note, these devices consume approx 30ma average current at 5V. They are active for about 10% of the time with an active current of about 240ma. You will probably want to add at least 20uf caps near the physical device. Pololu has some newer models that cycle faster and supposedly use less current.

Depending on your build you might be able to use a sonar for long distance scanning. 

**Made the bot **


Okay, so I've made a test bot. See attached photo. 

It uses - Arduino uno with a shield, 2 DC motors and an IR sensor for obstacle detection. I just need to write or find a sketch for this set up before I can test and see how well the IR works in broad daylight. 


Is it possible to sadjust reviewer strength based off of light levels? Say - I had one ambient light sensor that controlled all IR sensors to either send a stronger signal or not based off of how bright it is outside. Does this idea sound plausible? 


Thank you