DHT11 Sensor Suhu Dan Kelembaban
Table of Contents
Persiapan Perangkat #
– Raspberry Pi Pico / Pico W
– HC SR501 Pir Motion Sensor
– Breadboard
– 3x Kabel Jumper Male to Female
– Kabel Micro USD
– Aplikasi Thonny IDE
Wiring DHT11 Ke Raspberry Pi PICO #

– connect the DATA pin of the sensor to GP16 (yellow wire)
– connect the VCC pin of the sensor to 3V3(OUT) (red wire)
– connect the GND of the sensor to a GND of the Pico (black wire)
Sample Code #
from machine import Pin
import time
from dht import DHT11, InvalidChecksum
sensor = DHT11(Pin(16, Pin.OUT, Pin.PULL_DOWN))
while True:
temp = sensor.temperature
humidity = sensor.humidity
print("Temperature: {}°C Humidity: {:.0f}% ".format(temp, humidity))
time.sleep(2)
Hasil Yang Di Tampikan:
#

Powered by BetterDocs