Arduino Forum

Using Arduino => Sensors => Topic started by: jandot on Dec 15, 2018, 01:27 pm

Title: HC-SR04 on battery => how to sleep for entire day?
Post by: jandot on Dec 15, 2018, 01:27 pm
Hi all,

I'm planning to use an HC-SR04 distance sensor for keeping an eye on the water level in our water softener tank. This is just to know when we need to get to the shops to buy new bags of salt.

Of course it's not necessary to have a continuous reading of the water/brine: once a day or week would be good enough. To be able to run this on a battery I'd also like to have the arduino (well: wemos D1 with integrated wifi) sleep for the rest of the time.

As the HC-SR04 is an active sensor: is there a way to get the wemos/arduino to sleep for a day, then just wake up long enough to get a reading, connect to wifi and send an mqtt message?

Any help on getting this sensor used with sleep is welcome.

Thank you!
jandot
Title: Re: HC-SR04 on battery => how to sleep for entire day?
Post by: wvmarle on Dec 16, 2018, 06:51 am
Make sure you have a 3.3V version of the sensor, not all work at that voltage.
As the sensor takes little power, you may use an output pin to power it (positive power supply). Then when the WeMOS is asleep, it's powered down, and to do a reading you just power it up by setting the output to HIGH.
Be prepared to replace the sensor every few months at least, maybe more. Water and salt are not good friends of a non-waterproofed sensor.