Ultrasonic sensor review: Parallax Ping, SainSmart HC-SR04, RadioShack Ultrasonic Range Sensor
Ultrasonic sensors are great for providing distance sensing to robots so they can navigate around obstacles and hopefully prevent them from crashing at high speed and damaging themselves. Probably like many people new to robotics, I have been using the Parallax Pingsensor as well as the RadioShack Ultrasonic Range Sensor, which are both great products, but at $30 each it starts to get expensive once you have three or five of them on a robot, and I really don’t want to be limited to having a single operational robot at at time.
I recently found out about a much cheaper alternative named the HC-SR04 which cost a fraction of the price or the Parallax Ping. These can be purchased from as low as $1.40 on Amazon if you buy a pack of 10. This is clearly a game changer… if they actually work! I wanted to find out, so I purchased a SainSmart HC-SR04 for $5.25 (including shipping) and set up a test to compare this alongside the Parallax Ping and the Radio Shack Ultrasonic Range Finder products.
As you can see, this is a simple breadboard setup connected to an Arduino Uno. In the test I take one measurement from each sensor in quick succession and output them to the serial monitor. I do this once per second and note the results. I used the exact same code for each sensor, which sets the trigger pin HIGH for 10 microseconds and then reads a digital pulse from the echo pin. The length of the echo pulse indicates how long it took the sound to reach the target object and be echoed back.
In the case of the HC-SR04, the trigger pin and echo pin are separate pins (which could be a limitation for some applications), whereas the Parallax and Radio Shack versions use a single pin for both purposes.
No comments:
Post a Comment