Let's Make Robots!

Problem with HC-SR04 distance sensors

Hi Everyone,

I have been finding that I get erratic distance measurements on my tests with the HC-SR04 sensors. I put together a circuit with 128x64 OLED SSD1306 I2C display (Really like that module, by the way) connected on a breadboard to Arduino Nano v3.

The idea behind the circuit is:

Use the NewPing library to generate a distance measurement in centimeters.

Print the distance value to the screen, and keep on repeating.

As the sensor is moved around (8V lipo battery connected to Vin and Ground) you can see the distance updated on the tiny screen.

My latest robot, built with an Arduino Nano v3, plugged into a 400pin breadboard. Ultrasonic distance sensor, Sharp IR distance sensor, Laser, PIR motion detector, … Read more