New HC-SR04 ultrasonic sensor not working, always return -1

I have 2 brand new HC-SR04 ultrasonic sensors, connected them to a photon and a core and run the sample code but I’m always getting -1 as a result (NO_SIGNAL = -1.0f;) on both devices. I’ve tested the photon ports with LEDs to make sure they are working.

I’ve tried multiple connections but no luck. Also, I’m not sure if I need to use the voltage divider as there are many links that say I should to reduce trigger voltage from 5 to 3.3 (1, 2) and many examples that connect directly to the board 1, 2, namely the sample code example state it connects directly.


  • Any ideas on what might be happening ? defective HC-SR04s ?! How to debug this ?
  • Can I connect directly to the board or should I divide to get lower voltage ?



sensors were defective. got new ones and it works fine.

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