[PYTHON] Use Grove-Temperature & Humidity Sensor (DHT11) on Raspberry Pi

Introduction

I'm glad I bought the HAT board and temperature sensor, but it wasn't working, so I went instead of verifying the operation.

Price etc.

Preparing the Grove Base Hat for Raspberry Pi

Refer to Seeed Studio Product Page Enter the following command to set up.

curl -sL https://github.com/Seeed-Studio/grove.py/raw/master/install.sh | sudo bash -s -

After waiting for a while, the following message will be displayed.

Successfully installed grove.py-0.6
#######################################################
  Lastest Grove.py from github install complete   !!!!!
#######################################################

Operates Grove --Temperature & Humidity Sensor (DHT11).

Refer to Seeed Studio Product Page Connect the sensor to the Hat-based PWM.

Install the library with the following command.

git clone https://github.com/Seeed-Studio/Seeed_Python_DHT.git
cd Seeed_Python_DHT
sudo python setup.py install

After installation, the following message will be displayed.

Installed /usr/local/lib/python2.7/dist-packages/seeed_python_dht-0.0.1-py2.7.egg
Processing dependencies for seeed-python-dht==0.0.1
Finished processing dependencies for seeed-python-dht==0.0.1

The sample code is in the folder you copied from git, so run it

python examples/dht_simpleread.py

When executed, the temperature and humidity are returned as follows.

DHT11, humidity 66.0%, temperature 23.0*
DHT11, humidity 68.0%, temperature 21.0*
DHT11, humidity 74.0%, temperature 21.0*
DHT11, humidity 74.0%, temperature 21.0*

Digression

Refer to the following site for the program to measure temperature with go https://github.com/d2r2/go-dht

Add the following modifications in the sample code of example1

sensorType := dht.DHT11
pin := 12

If you run it as a root user, you can measure temperature and humidity.

Recommended Posts

Use Grove-Temperature & Humidity Sensor (DHT11) on Raspberry Pi
Use the Grove sensor on the Raspberry Pi
Use NeoPixel on Raspberry Pi
Use BME280 temperature / humidity / barometric pressure sensor from Python on Raspberry Pi 2
Use PIR motion sensor with raspberry Pi
pigpio on Raspberry pi
Make DHT11 available on Raspberry Pi + python (memo)
Get temperature and humidity with DHT11 and Raspberry Pi
Cython on Raspberry Pi
Record temperature and humidity with systemd on Raspberry Pi
Try using the temperature sensor (LM75B) on the Raspberry Pi.
Ubuntu 20.04 on raspberry pi 4 with OpenCV and use with python
Introduced pyenv on Raspberry Pi
Install OpenCV4 on Raspberry Pi 3
Install TensorFlow 1.15.0 on Raspberry Pi
Testing uart communication on Raspberry Pi
Use vl53l0x with Raspberry Pi (python)
raspberry pi 4 centos7 install on docker
Install ghoto2 on Raspberry Pi (memo)
OpenCV installation procedure on Raspberry Pi
Power on / off Raspberry pi on Arduino
Detect switch status on Raspberry Pi 3
Install OpenMedia Vault 5 on Raspberry Pi 4
L Chika on Raspberry Pi C #
Build wxPython on Ubuntu 20.04 on raspberry pi 4
Use python on Raspberry Pi 3 to illuminate the LED (Hello World)
A memo to simply use the illuminance sensor TSL2561 with Raspberry Pi 2
"Honwaka Notification Lamp" on Raspberry Pi Part 2
Detect "brightness" using python on Raspberry Pi 3!
USB boot on Raspberry Pi 4 Model B
"Honwaka Notification Lamp" on Raspberry Pi Part 1
Enable UART + serial communication on Raspberry Pi
Adafruit Python BluefruitLE works on Raspberry Pi.
Use python on Raspberry Pi 3 to light the LED with switch control!
Accelerate Deep Learning on Raspberry Pi 4 CPU
Set swap space on Ubuntu on Raspberry Pi
Programming normally with Node-RED programming on Raspberry Pi 3
Install 64-bit OS (bate) on Raspberry Pi
Improved motion sensor made with Raspberry Pi
Install docker-compose on 64-bit Raspberry Pi OS
Run servomotor on Raspberry Pi 3 using python
"Honwaka Notification Lamp" on Raspberry Pi Part 3
Working with sensors on Mathematica on Raspberry Pi
Build OpenCV-Python environment on Raspberry Pi B +
Detect temperature using python on Raspberry Pi 3!
Mount Windows shared folder on Raspberry Pi
Matrix multiplication on Raspberry Pi GPU (Part 2)
How to install NumPy on Raspberry Pi
I installed OpenCV-Python on my Raspberry Pi
Working with GPS on Raspberry Pi 3 Python
Use "TSL2561 Illuminance Sensor Module Manufacturer Part Number: TSL2561" manufactured by Strawberry Linux on Raspberry pi 3 (trial and error)
Using the 1-Wire Digital Temperature Sensor DS18B20 from Python on a Raspberry Pi
Use python on Raspberry Pi 3 and turn on the LED when it gets dark!
Use Raspberry Pi Python to TMP36 analog temperature sensor and MCP3008 AD converter
Why detectMultiScale () is slow on Raspberry Pi B +
Build a Django environment on Raspberry Pi (MySQL)
Try using a QR code on a Raspberry Pi
How to use Raspberry Pi pie camera Python
Detect magnet switches using python on Raspberry Pi 3!
Enjoy electronic work with GPIO on Raspberry Pi
Power on / off your PC with raspberry pi