Part 1: DHT11 and MCP9700
⚠️IMPORTANT⚠️
- Disconnect the power/USB cable from the Development/Expansion board before connecting sensors or changing a sensor pin. This allows us to check that everything is correct before powering the board.
- Always check if the sensor works on 5V or 3.3V before connecting your sensor to the board. If you are unsure check the sensor datasheet or consult it with a TA.
- We recommend using colored wires to make it easier to distinguish which wires are which.
- We recommend using a breadboard if you have several sensors it makes the connection more visible.
DHT11 Temperature and Humidity Sensor
The DHT11 is a digital sensor measuring temprature and humidity. Raspberry Pi Pico W MicroPython has a builtin library for this sensor so you do not need to import an extra library when you write code to read its values. As you can see it the following image there are different pin settings for DHT11 based on the manufacturer. If you have one like in the left part you can recongized the pin by the sign beside each. GND presented usually by (-), VCC by (+), and Data Pin by (S). So please double check before connecting your sensor to the Raspberry Pi.
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
You can find DHT example in LNU GitHub. The connection looks like the following figure but always check your sensor pin setting first to make sure they match.
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Example Code
You find a sample code below which can be copied to your main.py
and test your dht11.
MCP9700 Analog Temperature Sensor
The MCP9700 is an analog temperature sensor that can measure temperatures between -40°C to +150°C.
Pinout & Characteristics
MCP9700 pinout |
MCP9700 Characteristics |
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
|
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
|
- The VDD pin is the voltage in pin, so in our case, we connect that pin to 3.3V on the Pico W.
- The GND pin is the ground pin, and we connect it to the GND pin on the Pico W.
- The VOUT pin is the signal pin, which will output a voltage proportional to the actual temperature. We connect this pin to pin 27 on the Pico W.
Example code
To start measuring the temperature with your MCP9700, add the following code snippet to main.py
and run the program (by saving the file while development mode
is activated).