User Tools

Site Tools


en:pfw:dht22

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:pfw:dht22 [2025-06-26 12:20] – [Background Information] mkaen:pfw:dht22 [2025-06-27 12:05] (current) – [Implementation for RP2040 using a PIO block] mka
Line 56: Line 56:
 {{ :en:pfw:dht22-bit_lesen_mit_2xmoon.png?nolink |The timing is critical. So, it's correct now. Here we read a "0"}} {{ :en:pfw:dht22-bit_lesen_mit_2xmoon.png?nolink |The timing is critical. So, it's correct now. Here we read a "0"}}
  
-===== Implementation for TI's Launchpad ===== +====== Implementation for TI's Launchpad ======
- +
- +
-[[en:pfw:dht22-msp430g2553-noforth|DHT22 with Launchpad MSP430G2553 and noForth]]+
  
 This program was used to test DHT22 modules before installation. The DHT22 modules were tested for functionality at room temperature, pre-sorted in this way, and then frozen in a bag of moist sand in the freezer and tested again. One module displayed incorrect temperature values ​​in frost conditions, the display of negative values ​​did not comply with the specifications. This program was used to test DHT22 modules before installation. The DHT22 modules were tested for functionality at room temperature, pre-sorted in this way, and then frozen in a bag of moist sand in the freezer and tested again. One module displayed incorrect temperature values ​​in frost conditions, the display of negative values ​​did not comply with the specifications.
  
 +[[en:pfw:dht22-msp430g2553-noforth|DHT22 for Launchpad MSP430G2553 and noForth]]
  
-==== Numerical representation of the measured values ==== 
  
-=== Humidity ===+====== Implementation for RP2040 ======
  
-The first 16 bits coming from the DHT22 are the relative humidity in tenths of a percent. They can be processed directly with the 16-bit noForth and correspond to positive integer. Rounded to whole digits for display purposes. +[[en:pfw:dht22-rp2040-nofortht|DHT22 for the Raspberry Pi Pico Board RP2040 and noForth t]] using PIO block
-Here is an excerpt from the noforth source code:+
  
-<code> +PIO stands for //Programmable Input Output//. You can program the PIO blocks with the [[en:pfw:assemblers_pio-assembler|noforth t PIO Assembler]]. 
-: .hum ( hum -- )   10 . ." %rel" space  ;   +====== Background Information ======
-</code> +
- +
-=== Temperature === +
- +
-The next 16 bits are the temperature in tenths of a degree Celsius. Temperatures from zero degrees and higher can be processed directly using the 16-bit noForth; they correspond to a positive integer. +
- +
-Temperatures below zero degrees are represented by the DHT22 as follows: The MSB of the 16-bits is set, but otherwise the temperature is specified as a positive integer. This number format //does not correspond// to the two's complement of noForthHere, the MSB must first be evaluated to determine the sign. The sign is prepended for output. The measured value can then be further processed as a positive integer.  Whole degrees are displayed to the left of the decimal point, tenths to the right. The unit °C is specified. +
-<code> +
-: .tmp ( tmp -- )   +
-  dup hx 8000 and hx 8000 =  \ check MSB +
-      if [char] -  +
-      else [char] +  +
-      then emit +
-  hx 7fff and ( tmp -- +tmp )    \ reset MSB +
-  10 /mod 3 .r [char] . emit .    \ --> TTT.T +
-  [char] f decemit  [char] C emit  \ print °C +
-  space +
-  ;   +
- </code> +
- +
-  * This is already included in the following source code.\\ +
-  * And here you can see how this was discovered: [[en:pfw:dht22tmpformat|The temperature format of the DHT22]] +
- +
- +
- +
-===== Background Information =====+
  
   * How this was discovered: [[en:pfw:dht22tmpformat|The temperature format of the DHT22]]   * How this was discovered: [[en:pfw:dht22tmpformat|The temperature format of the DHT22]]
- 
-=== MSP430G2553 === 
- 
   * [[https://www.ti.com/lit/ug/slau144j/slau144j.pdf|MSP430x2xx Family guide SLAU144J.PDF]]   * [[https://www.ti.com/lit/ug/slau144j/slau144j.pdf|MSP430x2xx Family guide SLAU144J.PDF]]
   * [[https://www.ti.com/lit/ds/symlink/msp430g2553.pdf|MSP430G2553 datasheet SLAS735J.PDF]], port data on page 49ff   * [[https://www.ti.com/lit/ds/symlink/msp430g2553.pdf|MSP430G2553 datasheet SLAS735J.PDF]], port data on page 49ff
 +  * [[https://home.hccnet.nl/anij/nof/noforth.html| noforth.html - find your version, docmentation,  tool.f and asm.f here.]] All about noForth.
 +  * [[en:pfw:whatisapioblock|What is a PIO block?]]
  
-=== All about noForth === +====== Aids ======
- +
-[[https://home.hccnet.nl/anij/nof/noforth.html| noforth.html - find your version, docmentation,  tool.f and asm.f here.]] +
- +
---- +
- +
-=== Source code editor ===+
  
 +MK:\\
 I like //Notepad Next// for Linux, a cross-platform, reimplementation of //Notepad++//. I like //Notepad Next// for Linux, a cross-platform, reimplementation of //Notepad++//.
-https://github.com/dail8859/NotepadNext +https://github.com/dail8859/NotepadNext\\
- +
-=== Terminal === +
 To work with the embedded noForth system I use //e4thcom// by Manfred Mahlow. To work with the embedded noForth system I use //e4thcom// by Manfred Mahlow.
-https://wiki.forth-ev.de/doku.php/projects:e4thcom +https://wiki.forth-ev.de/doku.php/projects:e4thcom\\ 
- +Sometimes I also use Windows and Teraterm, for example, to log longer MCU outputs to a file. I also prefer it for testing parts of the source code using copy and paste.\\ 
-Sometimes I also use Windows and Teraterm, for example, to log longer MCU outputs to a file. I also prefer it for testing parts of the source code using copy and paste. +In this project I used a Logic Analyzer by AZDelivery8 CH, 24MHz. (Amazon)\\
- +
-=== Logic Analyser === +
- +
-AZDelivery Logic Analyzer 8 CH, 24MHz. (Amazon)\\+
 //PulseView// is a Qt-based logic analyzer and oscilloscope GUI for sigrok. //PulseView// is a Qt-based logic analyzer and oscilloscope GUI for sigrok.
- 
---- 
  
en/pfw/dht22.1750933232.txt.gz · Last modified: 2025-06-26 12:20 by mka