I am using ultrasonic HC-SO04, not giving reading on fabric. I lost many hours on testing my obstacle avoidance robot car in front of my sofa, every time it hits hard but works fine on other hard surfaces. Is there any other distance sensor which can detect soft objects like fabric from long or short distance?

Also looking any other accurate long distance cheap sensor which can work easily with Arduino. Please let me know. Thanks

  • 3
    Ultrasonic uses sound, and fabric absorbs sound. IR distance sensors may be an alternative. Unless the sofa is also black :-) (not necessarily true, as black might still reflect IR)
    – Gerben
    Sep 9, 2015 at 15:39

2 Answers 2


There are three types of commercially viable sensors for small scale projects:

  1. Ultrasonic sensors(HC-SO04 and similar): These sensors use ultrasound much like a submarine uses its sonar to locate things by sending out a sound wave(trigger pin) and then measuring the time it takes for the sound wave to bounce back by reading the echo.There are two problems with this sensor. It needs a pretty solid object to bounce sound of thus walls are good but cloth absorbs the sound wave and the echo never bounces back. The second is you can encounter ghost echos when the sound wave strikes a corner and creates a echo for an object that is not really there. These sensors typically have a range of around 250cm to 600cm however some sensors can sense up to 7 meters away. Thus while it has good range it can not reliably detect all things and you might have false positives on it as well.
  2. IR(Infrared) Sensors: These work like the ultrasonic ones but with light instead of sound. The sensor sends out a pulse/beam of IR light and measures the time it takes to reflect the light pulse/beam. This sensor is much faster than the ultrasonic ones but they have a much smaller range than ultrasonic sensors with a normal range of about 1.5 meters. While they work on most obstacles some might be missed due to the ability of some materials to absorb the IR light pulse thus there is no echo to measure.
  3. LIDAR(Laser Range Sensors): There are various models of these but the principle is the same as the IR sensor. These can have massive range but they also come in at a massive prices. You can find cheaper ones around I saw a model for $80 that has a 40 meter range.
  • Thanks @Namphibian for a detailed description, can you also mention when and where you found that LIDAR for $80? any link?
    – Builder
    Sep 10, 2015 at 15:57
  • Sparkfun has the LIDAR-Lite v2 for ~$120, which sounds similar to this. The previous version was about $80 but has been upgraded and is now more expensive. sparkfun.com/products/13680
    – mwwalk
    Sep 11, 2015 at 8:37
  • I'd just like to add that not all IR sensors work that way. Some have an IR led that shines a dot straight ahead and then it looks at that spot and based on the angle, determine the distance. I'm pretty sure this is how the sharp ir sensors work, but I could be wrong.
    – mwwalk
    Sep 11, 2015 at 8:40
  • @mwwalk my point number 2 covers this though I was not clear. I made some alterations.
    – Namphibian
    Sep 20, 2015 at 20:54
  • @Namphibian I don't think you understood what I was saying but I don't think I said it very clearly. Note that it doesn't really matter for this question and is a bit pedantic. I was just saying that some IR sensors use the angle of the echo light rather than the time it takes to determine distance. This is what the Sharp IR sensors do.
    – mwwalk
    Sep 24, 2015 at 19:41

If you are using HC-SR04 then I would suggest you to first check it out on simulation. I use Proteus software for simulation purposes and you should download the Ultrasonic Sensor Library for Proteus, using this library you can easily simulate your Ultrasonic sensor in Proteus and can design your code. It will save you from hardware testing.

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.