I'm having some troubles with my HC-SR04 sensors. They were working just fine but one day they suddenly stopped working with no reason and showing 0 distance no matter which material in different shapes i use. Then after a few attempts, they started to work again but now i'm getting incorrect readings more like random values. I got random readings between 139 and 150 on a surface. Now i'm getting random readings between 96 and 111 on the same surface. Same distance, same material, same rectangle shape but different readings! I even checked the temperature, tried different codes and different pins. I noticed that sometimes when i touched the trigger pin, the sensors stopped working or started to work again. There is only 1 thing left i didn't try and that is soldering a 10k resistor to the trigger pins. Do anyone know how to solve this issue and why this is happening ??
Try to add a 10uf capacitor between power and ground at the sensor.
nothing has changed. unfortunately
You sure you did not change anything when they stopped working?
Or maybe they got affected by moisture or so and are simply broken?
Yes, i'm sure. I bought a new HC-SR04 and tried with the same code and electronic circuit, it is working well but not the others.
Well, then the obvious conclusion would be that the other two are broken.