Noob needs help with temp anywhere project

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 :stuck_out_tongue:

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.

1 Like

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 :stuck_out_tongue_winking_eye:

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.

1 Like

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? :smiling_imp:) 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? :wink:

Hell yea! :smile: 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 :stuck_out_tongue_winking_eye: BTW: Anders Celsius was a :sweden:

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 :+1:

1 Like

Thanks! Iā€™m starting to feel like the Sensors Guy :nerd_face:

1 Like

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.