Support for ultrasonic Modul HC-SR04

Hi all,

i would like to monitor a diesel fuel-tank for my poolheater which is controlled with Cayenne with a standard HC-SR04 Ultrasonic module ( http://www.micropik.com/PDF/HCSR04.pdf or http://www.netzmafia.de/skripten/hardware/RasPi/Projekt-Ultraschall/HC-SR04_2.pdf ).

It is cheap, universal and with a simple handling.
Maybe this one could get here in Chayenne!?

There are mouch sample codes on the net.

cheers

Benjamin

Hi Benjamin,

Weā€™re creating a process that will allow you to use your own code to integrate sensors that are on our current list of supported sensors. In this way, we are 'teaching a man to fish", as the saying goes :slight_smile:

-B

1 Like

Agreed, I would like to use this sensor to monitor water levels in a water feature to automatically kick a valve on to fill the pond. Will we see the HC-SR04 added to the list of devices anytime soon? Seems like a popular sensor out in the jungle.

@benjaminkessler @josh1 Do you guys have an Arduino? Wanted to let you know you should be able to get the HC-SR04 going in Cayenne right now using Arduino. You can check out our docs page here. Let us know if you get if working!

-B

Benjamin, Were you able to hook up a HC SR04 ? Im thinking of using one with cayenne. Thanks

No, currently this sensor is not direct supportet on a raspberry with cayenne.
Maybe it would be possible via Arduino integration but i have no clue about that.

I have one working on another Raspberry without cayenne. It is simple and easy to implement.

Cheers

Benjamin

Try to use Arduino uno and ethernet shield.

Only problem with HC-SR04 - it ā€œfreezesā€ sometimes (actually it fails to catch the pulse it has sent) and you need to powercycle it from time to time - so adding some sort of relay to your project is a must

I canā€™t say Iā€™ve ever had this issue, are you getting any errors in your code?

No, there are no errors. The issue happens if (for whatever reason) the emitted pulse doesnā€™t get back - 2 ways to fix it, actually - you can ā€œclap your handsā€ - that is generate ā€œsomething like the pulseā€ or power cycle the sensor.
How does it look like when HC-SR04 is stuck? Simply you stop hearing pulses (while it is ā€œultrasonicā€ you can still hear clicking sound).

That sounds easy enough to fix with software. Can you post your code?

Hello.

Iā€™m trying a few days on an ESP8266 with a HC-SR04 Ultrasonic module, it works perfectly, one gauge is showing the calibration in millimeters and another in inches.

Greetings from Brazil to everyone!

1 Like