{"id":815,"date":"2020-07-11T10:39:09","date_gmt":"2020-07-11T15:39:09","guid":{"rendered":"https:\/\/robotsbench.com\/?p=815"},"modified":"2022-09-11T21:06:44","modified_gmt":"2022-09-12T02:06:44","slug":"hc-sr04-ultrasonic-sensor-arduino","status":"publish","type":"post","link":"https:\/\/robotsbench.com\/hc-sr04-ultrasonic-sensor-arduino\/","title":{"rendered":"HC-SR04 Ultrasonic Sensor with Arduino"},"content":{"rendered":"
I hope that the products recommended here will help you build great projects. Just so you know, if you buy through the links on this page on Amazon or Banggood (among others), RobotsBench may get a small share of the sale (as an Amazon affilate, I earn from qualifying purchases). This helps to keep the site alive and allow me to write more articles. Thank you!<\/div>\n

To detect objects at a distance in your Arduino projects, the HC-SR04 ultrasonic sensor is a common option. It comes as a board that’s easy to integrate in your projects, and it can be bought for pretty cheap. To learn more about this sensor I built a quick project on a breadboard to test it out. This prototype displays the current distance to the sensors on a 3 digits 7-segment display.<\/p>\n\n\n\n

\"\"<\/figure><\/div>\n\n\n\n

How does the sensor works? The sensor sends signals that bounce back when they reach an obstacle. It then reads the signal that bounced back to evaluate the distance. The module can “see” and measure an obstacle at any distance from 2 cm to 400 cm, but there is not much more in the datasheet.<\/p>\n\n\n\n

Here is what I could see with that test:<\/p>\n\n\n\n