Multiple ultrasonic sensor not working but wroking indivisualy

i am using three hc sr04 ultrasonic sensor with an arduino uno powerd by my pc usb port they work indivisualy but as all three work together then there the give unchanging values
so plz help me out with this

Start by posting your code and a schematic of your project

The easier you make it to read and copy your code the more likely it is that you will get help

Please follow the advice given in the link below when posting code , use code tags and post the code here

If you get errors when compiling please copy them from the IDE using the "Copy error messages" button and paste the clipboard here in code tags

You go first.

Imagine yourself walking into a repair shop and saying "My car doesn't work. It's a Ford - I left it at home"

Welcome to the forum.

Can you please post a circuit diagram, not a Fritzy picture, just a picture of a hand drawn circuit.

Thanks.... Tom... :smiley: :+1: :coffee: :australia:

I think the problem is the data acquisition method that you use.
An sr04 has trig and echo pins, when you trigger the sensor, arduino waits until the ultrasonic wave comes back after hitting a surface. If you are using a single trigger signal for all of the sensor simultaneously, maybe when the arduino is waiting that one sensor listen the sonic wave, the other two have already listened, but arduino can't read those because is busy.
This could return wrong values according to wich listen first.

You can't do this:

Trigger Sensors 1, 2, 3 simultaneously.
Listen sensor 1
Listen sensor 2
Listen sensor 3.

I believe this is your problem.

Sorry for bad english.

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.