Adventures with Electronics is a father and son project to learn how to connect up and code 37 different electronic sensors using a Raspberry Pi Pico.

After setting up the software and firmware needed to write python code on a Raspberry Pi Pico, this is the first step in the adventure in electronics. It uses a DHT11 sensor to read the temperature and humidity and display the values on the screen of a pico explorer board:

About the sensor

The DHT11 sensor itself has 4 pins and needs a resistor to be connected before it can be used. The version I have comes on a breakout board which already has this resistor and only has three connectors.

Pin numberNameDescription
1SSignal pin for reading values
2VDDPower supply (3.3v or 5v)
3GNDGround (0v)

The circuit

The code

"""
Adventures in Electronics
* Firmware:
 - CircuitPython v9.2.1
* Hardware:
 - Raspberry pi pico in pico explorer board
 - DHT11 temperature and humidity sensor
     Pin1 (S 	=> GP0)
     Pin2 (VDD	=> 3v3)
     Pin3 (GND	=> GND)
* Description:
 Reads temperature ('C) and humidity (%) every second and
 displays readings on screen
"""
import picoexplorer
import adafruit_dht
import board
import time

dhtDevice = adafruit_dht.DHT11(board.GP0)
picoexplorer.init()
while True:
    # read temperature
    temperature_c = dhtDevice.temperature
    
    t = "Temp: {:.1f} C".format(temperature_c)
    picoexplorer.set_line(3, t)
    
    # read humidity
    humidity = dhtDevice.humidity
    h = "Humidity: {}% ".format(humidity)
    picoexplorer.set_line(4, h)
    
    # display both values to console
    print(t,h)

    # shouldn't read values more than 1Hz
    time.sleep(1.0)

Link to code (including the picoexplorer module and other required libraries) here.