Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!

Multiple Object Detection with a Single HC-SR04 Sensor

Analog output processing lets a fixed HC-SR04 sensor detect multiple objects.

Jeremy Cook
4 years ago

HC-SR04 ultrasonic sensors are useful in a wide variety of automation tasks, for determining the distance to an object. If you need to deal with multiple objects, this normally means buying or building a scanning setup, or perhaps mounting a few fixed sensors at different angles, while taking care to avoid interference. As Erik Meike demonstrates, however, it’s entirely possible to pick up more than one object with a single ultrasonic emitter/receiver unit, without any sort of extra scanning hardware.

The trick here is that instead of getting a distance value out of the ‘SR04 directly, he’s tapping into the analog output from the board’s comparator, and using a Teensy board to read raw values directly. The board samples the signal at about 440kHz, and taking into account that the ultrasonic sensor emits sound waves 40kHz, it’s able to pick out different reflections at different distances. Meike shows this off with a small display that graphs distance versus reflected peaks, clearly picking out his hand and a cardboard box in the distance.

Although one still might want to build a scanner to sense multiple directions, this multi-measurement ability would open up usage possibilities in a number of ways. As he puts it, “I thought it was cool to put together some common components and start to mimic the functionality of something far more expensive.” I couldn’t agree more, and hope to see hackers take advantage of this technique in the future!

[h/t: Reddit]

Jeremy Cook
Engineer, maker of random contraptions, love learning about tech. Write for various publications, including Hackster!
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles