Connexion d'une sonde DHT11 sur une Raspberry

Connexion d'une sonde DHT11 sur une Raspberry

Connexion d'une sonde DHT11 sur une Raspberry

Le branchement d'une sonde DHT11 sur une raspberry Pi 3 est très simple lorsqu'on prends le problème par le bon bout.

Il faut

  • Sonde DHT11 (environ 5€ chez Gotronic)
100% Complete

Câblage

Câblage d'une sonde DHT11 sur une raspberry Pi 3

Câblage d'une sonde DHT11 sur une raspberry Pi 3

Logiciel

Installer les librairies Adafruit et python :

git clone https://github.com/adafruit/Adafruit_Python_DHT.git

cd Adafruit_Python_DHT

sudo apt-get update

sudo apt-get install build-essential python-dev python-openssl

sudo python setup.py install

L'accès au GPio est obligatoirement à faire un sudo sur Raspberry.Test d'exemple avec un DHT11 branché sur le port gpio 4 :

cd /home/pi/Adafruit_Python_DHT/examples

./AdafruitDHT.py 11 4

Va retourner un truc dans le style :

Temp=20.0*  Humidity=75.0%

Attention, la sonde ne répond qu'une fois par seconde.

Copyright © 2015 Alex-design.fr All rights reserved.