Electronics > Electronics

How many HC-SR04 sensors


Hi All,

My first attempt at a robot has 2 ultrasonic sensors slightly off to the left and right. They are run by a Picaxe 20X2 and the robot is managed by an IOIO / Android. They seem to work... sometimes. I always get a good signal when the robot is idle or being tested, but when it zooms across the room it tends to have a lot of crashes.

Can anyone guide me on a good number of sensors and where it's effective to place them please?

Thanks for your help, Jim.


--- Quote ---but when it zooms across the room it tends to have a lot of crashes
--- End quote ---

The robot 'crashes' into objects?
or the processors 'crash'?

Are any of the wires getting loose when the robot moves? Vibrations can cause this.

So far I've only tested in our lounge room which has plenty of soft furnishings. But I guess the sensors often fail to see chair legs (30mm wide), angled surfaces and soft furniture.

My guess is I need a 3rd sensor facing directly forward as well.

Soft and narrow objects can be a problem with the US sensors.
It can still be a a loose wire or other problem so try setting up a controlled environment to pin point the issues.
Even some cardboard set up as walls would be helpful to determine if the sensors and code is working or if there is a hardware problem.

Also, only run one sensor at a time! Wait some amount of time (say, 30-50 milliseconds) before running the other sensor, and do them ping-pong style, else you may get crosstalk.
You can mount them so they sense in an "X" pattern -- turn the leftmost to face right, and rightmost to face left. This gives you some amount of "center" sensing, hopefully enough to avoid a crash.
Also, try going slowly, not allowing a very fast top speed, until it's all tuned and working well. Then slowly increase max speed.

Finally, to compensate for the shortcomings of US sensors, you can also use a Sharp IR sensor, which works great for soft textiles, but is narrower in its sensing pattern. I use both on my rover robot.


[0] Message Index

Go to full version