I am using the following devices/components to for distance measurement using ultrasound sensor.
1. Arduino Uno board
2. HC-SR04 ultrasound sensor
3. Breadboard
4. Arduino jumper cables.
5. Sketch : Provided at http://www.instructables.com/id/Simple-Arduino-and-HC-SR04-Example/step3/Upload-the-sketch/
My setup is pretty much what is mentioned in the above link. Everything works fine but it seems like the sensor doesn't fit securely in the breadboard. If I push the sensor forward it works fine. If I push it backward it keeps giving me only one reading (5 cm in this case). When you push the sensor you can feel it hinges back and forth.
I soldered another sensor on a protoboard but it has the same issue. When I apply pressure from top it works fine, otherwise it keeps giving me just one reading. Has anyone faced similar issue ? How to resolve it ?