Why do this? Sometimes we face the problem that how can I get the Raspberry Pi's IP address without a screen and unable to view the IP through the router? This is really a big problem, especially for the newbies. For people who are very familiar with the Raspberry Pi or other embedded systems, they would use the serial port to see the ip address. However, there's not always a USB-TTL serial tools....
DHT11 is a commonly used temperature and humidity sensor, but it is not easy to read on the Raspberry Pi. In the examples, most of them are analyzed by libraries or read signal pins directly. Although these methods are effective, they are not simple and convenient. The official Raspberry Pi system comes with a simple method that can easily read data from DHT11.
Open/boot/overlays/README and you will find the following lines:
Name: dht11 Info: Overlay for the DHT11/DHT21/DHT22 humidity/temperature sensors Also sometimes found with the part number(s) AM230x. Load: dtoverlay=dht11,<param>=<val> Params: gpiopin GPIO connected to the sensor's DATA output. (default 4)
This means that by adding dtoverlay=dht11 to config.txt, you can find the dht11 file under /dev/. The content is the humidity and temperature of DHT11.
First make sure you are using the latest version of Raspbian.
Connect the DHT11 (or DHT21/DHT22) signal pin to gpio4.
sudo nano /boot/config.txt
Add a new line at the end:
Save and exit.
reboot Raspberry Pi.
use the command blelow to see the data.
How to assign another pin?
in the config.txt you just added, and change 4 to the pin you want. Note that the pin numbers are BCM coded.