Week 9 - Input Devices

This Week i used the read data from the DHT22 Temperature and Humidity with the Board i designed in week 6 and produced in Week 8. I programmed the board with the Arduino IDE.

In our group assignment, We showed, how . Due to the fact, that i was overseas for a Conference I was just Responsible for The Website. So Crossreading, the Content and also Adding it to the Site and Pushing everything to our Internal Git.

Prepwork

board setup

First i have to setted up the Pi Pico 2 W as Borad. For that i used the RP2040 BoardLibrary from "Earle F. Philhower, III". Step 1 was to open the preferences and add "https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json" to "Additional boards manager URLs"

404

Second steo was to install the Boards in the Boards Manager.

404

libraries

The Library used in this sketch is the "DHT sensor library" by Adafruit. U can download it through the library manager

connnecting the and sensor

To Connect our Sensor, use the second GP-Pin, which is "DHT-DATA" and the power pins on our board (marked with "DHT-VCC" and DHT-GND). Every pin used for the DHT is colored Green.

404 404
                #include 


                #define DHTPIN 1
                #define DHTTYPE DHT22
                
                float temp;
                float humidity;
                DHT dht(DHTPIN, DHTTYPE); 
                
                
                void setup() {
                  Serial.begin(115200);
                  dht.begin();
                }
                
                void loop() {
                  temp = dht.readTemperature();
                  humidity = dht.readHumidity();
                  
                  Serial.print("Temperatur: ");
                  Serial.print(temp);
                  Serial.println(" *C");
                  Serial.print("Luftfeuchtigkeit: ");
                  Serial.print(humidity);
                  Serial.println(" %");
                
                  Serial.println();
                  delay(2000);
                }
        

Result

404