Notifications
Clear all

Combining example DHT sensor sketch with LowPower lib; save battery

2 Posts
1 Users
0 Likes
1,136 Views
jBo
 jBo
(@jbo)
Member
Joined: 3 years ago
Posts: 100
Topic starter  

Hi. I was checking out the libraries for temperature and humidity

https://github.com/adafruit/DHT-sensor-library

https://github.com/adafruit/Adafruit_Sensor

I am using DHT11 modules for now, a tiny board with just 3 pins, but this is not I2C version.

I appreciate that the sensor needs a couple of seconds to stabilize between readings. The sketch works fine right out of the box, from the examples provided by those libraries. At this point, though, I wanted to look into reducing power, since I want to put several of these around the garden. I looked into an article by Sparkfun:

Reducing Arduino Power Consumption

I got this to work, though at first there were oddities and problems with the Serial.print() to the Serial Monitor. Sometimes I got complete garbage, even though the baud rate matched what was specified in Serial.begin(9600). Other times it had an odd pause after "Tem", then inserted two spaces for unknown reasons, then continued with "perature."

OK, so using it is a little "sensitive" to the placement of print() and possibly delay(). What I got to work was

delay(1000);

LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

delay(2000);

So I guess my real questions are:

* does anyone else use the LowPower library to save on battery?

* anyone else notice odd interactions with Serial.print() ?

Thank you. John

 

In theory, theory and practice are the same.
In practice, they're different.


   
Quote
jBo
 jBo
(@jbo)
Member
Joined: 3 years ago
Posts: 100
Topic starter  
This post was modified 3 years ago by jBo

In theory, theory and practice are the same.
In practice, they're different.


   
ReplyQuote