Arduino + ESP8266 + DHT11 : relevé de température vers un serveur HTTP

Introduction

Suite au précédent article qui a permis de faire un HTTP GET sur un serveur en Wifi, grâce au module ESP8266, j’ai ajouté un détecteur de température : le module DHT11, au prix de 2.35 €.

data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAoHBwgHBgoICAgLCgoLDhgQDg0NDh0VFhEYIx8lJCIfIiEmKzcvJik0KSEiMEExNDk7Pj4+JS5ESUM8SDc9Pjv/2wBDAQoLCw4NDhwQEBw7KCIoOzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozv/wAARCAEsASwDASIAAhEBAxEB/8QAHAABAAICAwEAAAAAAAAAAAAAAAUGAwQBAgcI/8QAPBAAAQMDAgQEAwcEAAYDAQAAAQACAwQFERIhBjFBURMiYXEUMoEHI0JSkcHRFWKhsSQzQ3KC4RYl8PH/xAAaAQEAAwEBAQAAAAAAAAAAAAAAAQIEAwUG/8QAIhEAAgICAwADAQEBAAAAAAAAAAECEQMSBCExEyJBUWEU/9oADAMBAAIRAxEAPwD2ZERAEREAREQBERAEREAREQBERAEREAREQBERAEXBTKA5RcZXKAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiLjKA4cQ0Ek4AVaud8eZy2neWtaeY6rYv8AdBGw0sTtz85H+lVnvyea9Di8e1vI8vmcpp6QLPb+Iw7EdWMf3j91PMlbK0PY4OaeRC84DyOqkLfdZ6J40Oy3q08ir5uIn3Apg5zXUy9ItK33KG4RameVzfmaei3F5rTi6Z60ZKStHKIigkIiIAiIgCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgOFoXa4NoaYkH7x2zQtqeZlPE6WR2GtGVSrlXPrKl0jicdB2C08bD8krfiMnKz/FGl6zVnmdI8uccknJKwFckrple0lR4DduzsEkkEUeoo3GNzj3WUx7YcAQVANeycRGjubXvJ8MnDx6L0ZtdTGmFQJmmI8nZXl9XZmOf4tLiN45t6H+Fv0uuCnEbnknmd9srJm4yySs3YOU8UdX2ejRTRzM1xvDmnqF3VEo7s+3zNIkw0nzN6FXenmZUQMlYcteMhefmwvEz0+PyFmX+mVERcDSEREAREQBERAEREAREQBERAEREAREQBERAEREAREQBcFFAcXcQssVqcWyAVMoIj/tHVx9v94QG27iWzsrzRSV0UcwcWYecAuHMAnZSYe0jIcCPdfNNdWyVlUZiXY5NBOSB/KnLZxFxJYYYn/fOpH40smaS0+x6KVCTDcV+nrHENYDO2lL9I059Cq/KwtO61a26SVlLDVTRGGUx+ZhdnT9VHUl/PxbaN7TJrOG4XtceOuNI+f5UtsrolHBdMLK/nsuG4DTkc1oMhDXav8ADYYozuubRepcCGca2pXWkvcZITn+0rrbqHD8uGA3muMnLbo7wjHW2TpcHt1tzg910C41aRnOAFhp7lTTzugLg145LqcfWaFyZVxO8YNL4x1b091PcMcUy00TaaVhljHLu1dHNLefJa7IYYXufGwNLueFznjjkVM64sssTuJaYeJz8QfFjHhk7Y5hT1PUR1MQlidqaeq82qKltOzUTv0UzwlxBF4rqWeQND92EnbKw8jjRUdono8XlylLWbLsixumjYGl72tDuWTzXcHO4Xnnp2couFyhIREQBERAEREAREQBERAEREAREQBERAERcIDFV1UNFSyVNQ8MiiaXOcegC8G4y4jmvd0le4kNzhrPyNHJv7n19lb/ALSuK9za6V4LInecg/M/t7N/37LzqhtFxushbRUks7ubnNbsPcqUrZPhv8J2QXevMkwzT0+HPH5j0C9DlDS3QWNLRjykbeirPDtmvFidMayB0DZQCDqBBI9vdT7LhDO7RIQ1/dexxktLPC5038tGhdKad0bpIMvIHydVr2S2GlYauob/AMRL0P4B2UxIMdVjzlaaMOx0mmELDITy5LHR3OCqzHIQx4691pXR0uDlpDeQxyURCx5mBGc52wucp06OkMbkrLe9mn26FY+qx0wfHA1r3ZP+lla3UcNO+OXVdEcn6aVfK9rA0Ahp5uwoeueY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gCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgCIiAIiIAiIgCIiA//Z

Ce module intègre des résistances pour assurer son bon fonctionnement. On peut trouver le composant sans la plaque où celui-ci est soudé, mais il faudra ajouter les composants électroniques nécessaires lors du branchement.

 

 

Connexion

De multiples articles décrivent comment faire un relevé de température avec le module DHT11. Il faut penser à le brancher sur le 5v et laisser le 3.3v pourESP8266.

L’article suivant décrit ce qu’il faut faire pour stabiliser les tensions : https://github.com/esp8266/Arduino/blob/master/doc/boards.md#improved-stability

J’ai juste ajouté un condensateur de 100µF pour éviter les reboot intempestifs du composant ESP8266 (pour cause d’instabilité du signal).

 

Code complet

Voici le code pour Arduino :

#include <SoftwareSerial.h>
#include "DHT.h"

/** DHT **/
#define DHTPIN 5
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);

/** ESP8266 **/
String ssid = "NETGEAR";
String key = "xxxxxxxx";
String serverHost = "192.168.1.100";
String serverPort = "80";

SoftwareSerial esp8266(1, 0); // RX, TX
bool done = false;

void setup() {

  /** DHT **/
  dht.begin();

  /** ESP8266 **/
  esp8266.begin(115200);
  delay(500);
  esp8266.println("AT+RST");

  /**
   * Initialisation
   */
  delay(1000);
  esp8266.println("AT");
  done = esp8266.find("OK");
  if(!done){
    delay(1000);
    done = esp8266.find("OK");
  }

  /**
   * Se mettreen mode CLIENT
   */
  esp8266.println("AT+CWMODE=1");
  done = esp8266.find("OK");
  if(!done){
    delay(1000);
    done = esp8266.find("OK");
  }

  /**
   * Connexion auWifi
   */
  esp8266.println("AT+CWJAP=\""+ssid+"\",\""+key+"\"");
  done = esp8266.find("OK");
  while(!done){
    delay(1000);
    done = esp8266.find("OK");
  }

  /**
   * Se mettre en mode multiple connexions
   */
  esp8266.println("AT+CIPMUX=1");
  done = esp8266.find("OK");
  if(!done){
    delay(1000);
    done = esp8266.find("OK");
  }

  /**
   * Récupération de l'adresse IP
   */
  esp8266.println("AT+CIFSR");
  done = esp8266.find("STAIP");
  if(!done){
    delay(1000);
    done = esp8266.find("OK");
  }

}

void loop() {
  int maxLoops = 5;

  /**
   * DHT11 : Temperature
   */

  float temperature = dht.readTemperature();
  if( isnan(temperature) ){
    return;
  }
  // convert float --> String
  String temperatureStr = "";
  char temperatureChar[15];
  dtostrf(temperature,5,2,temperatureChar);
  temperatureStr = temperatureChar;

  /**
   * HTTP GET
   */
  String cmd = "AT+CIPSTART=4,\"TCP\",\""+serverHost+"\","+serverPort;
  esp8266.println(cmd);
  delay(500);
  done = esp8266.find("OK");
  int currentLoop = 0;
  while(!done){
    delay(500);
    done = esp8266.find("OK");
    if(currentLoop >= maxLoops){
      break;
    }
    currentLoop++;
  }

  String url = "/lda/index.php/data/createdatajson/append?datflval="+
    temperatureStr +
    "&thing=FIRST";
  String cmdGET = "GET " + url + " HTTP/1.1\r\n"+
    "Host: "+serverHost+"\r\nUser-Agent: ESP8266_HTTP_Client\r\nConnection: close\r\n\r\n";
  esp8266.print("AT+CIPSEND=4,");
  esp8266.println(cmdGET.length());
  delay(1000);
  done = esp8266.find(">");
  currentLoop = 0;
  while(!done){
    delay(500);
    done = esp8266.find(">");
    if(currentLoop >= maxLoops){
      break;
    }
    currentLoop++;
  }
  esp8266.println(cmdGET + "\r\n\r\n");
  delay(1000);

  esp8266.println("AT+CIPSTATUS");
  delay(1000);

  // Fermeture de toutes les connexions
  esp8266.println("AT+CIPCLOSE=5");
  delay(1000);

  // repart à zero
  esp8266.println("AT");

  // 4 secondes sont déjà passées
  delay(16000);

}

 

 

Annexe

Photos du projet avec la platine d’essai :

 

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *

*

Vous pouvez utiliser ces balises et attributs HTML : <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>