nomadsearch.blogg.se

Raspberry pi light logger
Raspberry pi light logger








raspberry pi light logger

# Create data to plot lists for animation. Print("Launch temperature and humidity Matplotlib animation using DHT22 sensor.") Matplotlib animation of humidity and temperature Add a second DHT22 sensor to aid in calibration or in long term failure analysis.Package the hardware off breadboard so it can remain reliable for longer periods of time or be used in lab experiments such as for the incubator I am building.Add storage of data to either a database or just to a csv file.(Or maybe an email notice would be good too). So it would be nice to know what is happening while I am away. I hope to the use the REMI library for this feature. Add a web browser GUI front end so I can view results while away from my lab.Different labs and different areas of the world could use different limits and degrees C vs degrees F. Currently the limits for temperature and humidity are fixed. Maybe a simple “show current values” only until enough data has been collected for a meaningful chart. Currently the plot looks “stupid” until then – about the first 20 seconds in time. Show the plot only after two data points are ready to plot.I wanted the data logging to roll over a 12 to 24 hour period so management of time formatting was critical. The variable “myFmt” controls x-axis formatting. Even though the values are formatted as text results. Matplotlib supports many time and date formatting features so the x-axis can change over time without every tick value being assigned a value. In this way, the plot looks ok after about 20 seconds.ĭata logging with time required a little extra care. So I start with a median of 3 sensor test results and increment with each animation loop to more data collection per logged entry up to my target of 10 test results per reported log entry. I wanted the data logging display to start displaying results quickly while still enforcing the value of statistics median. The data smoothing algorithm I created is a bit over complex. But a few reasonable tests improve the accuracy of the overall stream of reported data being logged. I am impressed with the overall stability of the DHT22 sensor. An average would have still changed the final value enough to create a false dip in the temperature plot.

raspberry pi light logger

The benefit was that random very low “noise” temperature results were eliminated. Near the end of my design process I switched from averaging a block of 10 sensor results to taking the median of these results. The main program loop is managed using Matplotlib’s animation module through regular calls to function “animate”. Initialization is complete when I define the plotting environment along with lists for plotting data and smoothing data using the median of 10 results. Then I import packages and define the hardware layout of my DHT22 sensor.

Raspberry pi light logger how to#

The code starts with a few references I used to learn how to create a DIY temperature humidity data logging platform from my Raspberry Pi. I catch this type of error by taking the median from 10 results – then report this median value. In this case the temperature for one result is about 20 degrees Fahrenheit lower than the temperature result just before or after this result.

  • Another error comes from the temperature value.
  • I catch and report this error in code by looking for humidity values above 100%.
  • Occasionally humidity values go way beyond the 100% upper limit.
  • Other developers have included a time-out test so a temperature / humidity result of none is managed.
  • I found and corrected three types of error generated by the DHT22 sensor:










    Raspberry pi light logger