Deleted
Look upā¦ look way upā¦ at my post with the code, wherein I already mention this exact issue and provide a link to the solution
This whole mess has become intractable, every time I post, this happens, I wish I knew how to fix it.
Thanks Gunner. Iāll go read it again.
Unfortunately that is the nature of a flowing, living, forumā¦ all the information one needs is probably right there, and repeated a zillion times, but hard to pick out of the bazillion other words
To try and keep up, I fall back on bookmarks, memory, lots of re-reading and too many sticky notes ā¦ but alas, it can still seem like a losing struggleā¦ but keep on working the problem. eventually something will click.
Donāt feel too bad. I was losing track of my code iterations earlier this week for a project of a similar size as yours. I finally broke down and a) started a journal for each major ātechnologyā as well as a separate punch list document that shows dependencies, and b) signed up on github and created a repo.
When you break it down your project has 5 or 6 pieces (understand microcontroller & integrate hardware, read DHT, read DSxx, read multiple DSxx, Read DHT AND multiple DSxx, Report data (implicit but still important)). Each one of those is going to have multiple challenges. That is a reasonably large punch list for a project that, assuming your memory is no better than mine, is not easy to track in oneās head.
I donāt want to sound like a smart-ass (Or do I? ) but you think wrong!
I found an excellent comment in a very, very fine written sketch about this and the use of setWaitForConversion(0);
with 2 timers and 2 functions:
//============ Temperature sensor
/*
A note about about temperature readings from the DS18B20. The default resolution is 12 bits (0.0625 increments or 1/128 degrees C) and will take the sensor up to 750 ms to complete. This may seem like a problem, but it doesn't have to be (if I've done my homework correct)! startSensorConversation() tells the sensor(s) to start the temp conversation which would normally make the program halt for ~750 ms. But by setting setWaitForConversion(0) to false, the request just initiate the conversation and doesn't wait for it to finish. Total time for startSensorConversation() and getSensorData() functions is now a manageable 30-35 ms instead of 750-800! :)
The DS18B20 is rated for a minimum of 50.000 EEPROM Writes (but will probably do many many more). Even though it's a high number, getting a new reading once a minute equals to 1440 a day, and after just 35 days your over 50.000! So to be a bit conservative, I now only do it once every 10 minute. I'm still running getSensorData() once a minute so the data received is never older than 10 + 1 minute. That's OK for my needs.
*/
(Some spelling errors appears in the text; conversation should of course be conversion! )
Yah, I wasnāt sureā¦ I just added that comment based on the other DHT sensors command, which does work that wayā¦ not that I ever use such old formatsā¦ Celsius all the way! Negative temperatures = Cold, Positive temperatures = Warm, simple Eh?
Hell yea! I mean, there is logic behind both Celsius and the metric system! But there is always some reactionary countries: āU.S. remains the only industrialised country that has not fully adopted the metric system as its official system of measurementā. If you could start using it in movies, TV shows, and by NFL commentators I would be happy. F - 32 / 1.8
isnāt always easy to do in the head BTW: Anders Celsius was a
Nuff with the off topicā¦ Iām not sure if I would call it a general misunderstanding, but many (not just in this forum) doesnāt seem to understand that those sensors works differently. Perhaps not technically correct per se, but I think the easiest way to explain it is that:
- DHT22 sends data to the MCU
- MCU reads data from the DS18B20
Or MCU sends āgimme some dataā to DHT22 and the DHT22 sends it back.
MCU tells DS18 to start measure temperature, do a analogue-to-digital conversion, store the value in your scratchpad memory and Iāll read it when your done. If I donāt have timing issues, Iāll sit and wait for you to finish, otherwise Iāll come back at a later time (hence the option to change setWaitForConversion()
).
Good breakdown and explanation
Thanks! Iām starting to feel like the Sensors Guy
It warms my heart to see my lowly project encouraging so much fun. In 1964 they told us in school that we were to begin learning the metric system, then the Republicans shot it down, un-American! along with a whole bunch of other jingoism and nationalistic clap-trap, so here we are today still behind the 8-ball, regardless of the fact that the majority of our equipment has metric fasteners. I do not know how the USA ever became a world leader but I do know that we are quickly headed for 2nd to 3rd world status, and we deserve it.