I have facing a problem since long and cannot solve it. I built Arduino car and place 2 IR sensors shown in image, to check down distance to avoid falling from stairs. One is at back and other at front. On hard surface they work well but on carpet always give wrong reading like no object there which translates unsafe to move and my car stops. How can we solve this problem? I also tried Ultrasonic but it has same problem on carpets or fabric.

I tested this that on carpet it was giving a big distance reading but when I place a white paper, suddenly it was fixed and detected surface.

enter image description here

  • Maybe a contact switch may work? Maybe one of those end stop switches with rollers.
    – Paul
    May 7, 2016 at 8:26
  • It may highly depend on what type of carpet you have. But you might get away with adjusting the IR's sensitivity. I believe it's also a good thing to place something between the receiver and transmitter, to avoid them making "contact" directly instead of by reflection.
    – Paul
    May 7, 2016 at 9:37
  • Paul, the blue thing on IR sensor is for adjusting distance and I tried it but this adjusting will not work here.
    – Builder
    May 8, 2016 at 2:34

1 Answer 1


You may have noticed that this product is no longer available from well known parts distributors like adafruit.com, sparkfun.com or trossenrobotics.com. I would recommend using a Sharp distance sensor designed for the distances you are interested in: enter image description here It is about 10 times the price, but produces a variable voltage that you can read with the Arduino's ADC. Then you can compensate for floor irregularities in your code.

If you care to experiment, I obsurved that the better distance measurement devices angle the emitter and sensor to light up & observe the same spot at the desired operating distance: enter image description here

You might try this with your current sensor. However, it does not appear the manufacture left you enough lead length to make such an adjustment.

  • Thanks @st2000 for detailed reply. I have 1 sharp sensor after failing with cheap IR sensor and Ultrasound sensor. I am using it for front distance. I came up with few results. Ultrasound sensor failed on fabric objects i-g. sofa or carpet. I used sharp sensor which fails on dark objects like black surface or very shiny steel sheets. Also I read that it will also fail on sun light or very bright light. I know there are some LDR sensors on ebay but cheapest one is C$300 plus. Other lasers are around C$130 plus. Can you provide the name and product # etc. for this. I can check on ebay.
    – Builder
    May 8, 2016 at 2:42
  • I have never used a LDR so can not recommend a part. You could combine the ultra sound and Sharp sensor in software to cover more surfaces. Also, what about micro wave sensors like those found in construction-wall-sensing devices.
    – st2000
    May 8, 2016 at 15:23

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.