ESP8266 ESP-01 & DHT11 Sensor A DHT Temperature and Humidity Sensor, $11 for 5 pieces (on 2017.07.03), soldered to an ESP8266 ESP-01, with code to connect to an access point, and on request, show the data shown above (with a 30 second refresh) in a browser. Pretty handy if you just want to provide 5V with a USB cable to the programmer (or 3.3V using wires). http://www.elec-cafe.com/ shows all the magic on how to do the temperature and humidity part.Humidity (%) : 44.00 Temperature (°C) : 29.00 Temperature (°F) : 84.20 http://192.168.16.17/ // http://www.elec-cafe.com/temperature-sensor-on-the-web-with-esp8266-and-ds18b20/ int counter; unsigned int tNow; unsigned int tPrevious; WiFiServer server( 80 ); DHT11 dht11( PIN ); void setup( ) { Serial.begin( 115200 ); delay( 10 ); Serial.println( VERSION ); WiFi.mode( WIFI_STA ); Serial.println( ); Serial.print( "Connecting: " ); Serial.println( ssid ); WiFi.begin( ssid, password ); while ( WiFi.status( ) != WL_CONNECTED ) { delay( 500 ); Serial.print( "." ); } // while not connected // Serial.println( "all the needed info" ); } // if time to print on Serial port // client.println all your information here... client.print( "</body>\n</html>" ); delay( DHT11_RETRY_DELAY ); // delay for reread if ( Serial.available( ) > 0 ) { int inByte = Serial.read( ); if ( inByte == '!' ) ESP.reset( ); // reset if ( inByte == '?' ) info( ); } // if Serial.available( ) } // loop( ) |
Electronics and Software > ESP8266 >