Line: 1 to 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Solutions to exercise 4: The DHT11 Temperature and Humidity SensorExercise 1: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Line: 10 to 10 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
It takes a new measurement every 2 s and prints the result.
Exercise 2: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
< < | The manual evaluation you must do yourself, the program for automatic data extraction is here: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > | When doing the manual evaluation you get:
Adding the first 4 hex numbers should result in the same value as the checksum:
The program for automatic data extraction is here: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
https://afnog.iotworkshop.africa/pub/IoT_Course_English/SolutionsToTheDHT11TemperatureAndHumiditySensor/dht11Eval.py.txt
and here a screen dump when running it on the data taken: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
< < | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > | ![]() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Exercise 3:The exercise sheet pretty much explains how to proceed. Therefore I just supply the solution for your study. There are 2 different ways on how to convert the binary values in the 32*32 bit array to strings such that you can write them to the file. In the solution I use the newer method while the old style is given in the comments. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Line: 47 to 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
> > |
|
Line: 1 to 1 | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Added: | |||||||||||||||
> > |
Solutions to exercise 4: The DHT11 Temperature and Humidity SensorExercise 1:
The solution to the exercise is quasi already given in the MicroPython manual It takes a new measurement every 2 s and prints the result. Exercise 2:The manual evaluation you must do yourself, the program for automatic data extraction is here: and here a screen dump when running it on the data taken:
Exercise 3:The exercise sheet pretty much explains how to proceed. Therefore I just supply the solution for your study. There are 2 different ways on how to convert the binary values in the 32*32 bit array to strings such that you can write them to the file. In the solution I use the newer method while the old style is given in the comments. Here is the solution that starts a measurement, reads out the raw data and write them to a file named "/data/dht11.txt". If the "/data" directory does not yet exist on the ESP32 it is created. Exercise 4:In the script the file dth11.txt is opened and unpacked. The sequence if bits is written to the file "dht11Unpacked.txt". This file can be easily plotted with gnuplot:
gnuplot The script does unpacking and plotting in a single script. It uses matplotlib to produce the plot.
Comments
|