DHT22 lib working on 1Mhz?
-
So after 2 weeks fiddling around with the different libraries at different clock frequencies, I have some conclusions I would like to share with you.
I tested with a ProMini and two DHT22 sensors, one from Adafruits and one from China.
As I already reported, I had problems with clock frequencies below 8MHz with all different libraries. After switching to 8MHz, I realized another problem. Temperature readings did not change. They stayed the same value, only when I reset the ProMini I had a correct reading.
I had this behaviour with the Adafruit and the library included in the MySensors project.Since yesterday evening I am testing the library from Rob Tillaart (http://arduino.cc/playground/Main/DHTLib) which is working correctly giving me correct readings.
I am presuming that this is related to sleeping the ProMini and may be the low power mode the DHT22 is going into, I don't know...(at least in Rob's lib there is a wakeup delay which seems to address that point)Anyway, it seems I have at least now a working solution. I will re-try to lower the clock frequency with that library.
Apart from that I also realized that the DHT library included in MySensor will perform a sensor read for a call to readTemperature and readHumidity which means that you would need to put a delay of 2s between a readTemperature and readHumidity. Since the sensor delivers the values in a "single" read this is rather unfortunate for battery powered sensor.
-
I retried again with Rob Tillaart's DHT22 library whether I can reduce clock frequency.
The results:- 1 MHz -> wrong readings, like -100 C
- 2 MHz -> "
- 4 MHz -> from time to time wrong reading
Overall, I would state that you need to run the DHT22 with the libraries I tested on 8 Mhz.
-
Sorry for a stupid question, but how do you run at 1 Mhz?
See http://www.mysensors.org/hardware/micro#comment-2196823229
Are you able to switch to 1 Mhz at runtime? -
Have a look at the sensebender sketch http://www.mysensors.org/hardware/micro#example-sketch
if ((measureCount == 5) && highfreq) { clock_prescale_set(clock_div_8); // Switch to 1Mhz for the reminder of the sketch, save power. highfreq = false; }The clock frequency is scaled down by software.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login