Coder Social home page Coder Social logo

esp8266-temperature's Introduction

esp8266-temperature

This code is the base of my self-developed "smart-home" temperature and humidity sensor based on an ESP8266 with the DHT11. The measurments are sent to a MQTT server.

How does it work

The wiring is really easy. Powered is the ESP8266 with USB or by a power supply on the VIN pin. The DHT11 sensor works with 5V or 3.3V, so the VCC pin can be connected to the 3.3V output from the ESP8266 directly. The DATA pin of the DHT11 needs to be connected to a gpio of the ESP8266. A 10kOhm resistor between the DATA pin and VCC should be used to ensure proper communication. For my setup I use the gpio D5 for the DATA pin.

For the development and upload of the code I use platformio.

Wiring

wiring diagram

Configuration

Because I use several ESP8266 for different rooms, I made the code variablized. The configuration can be set inside the file include/configuration.h. This is a blueprint of the configuration.h:

#define SSID "<your-ssid>"
#define WLAN_PASSWORD "<your-wifi-password>"

#define DHT_PIN <number-of-the-used-gpio>
#define DHT_TYPE <type-of-the-dht-sensor> // Possible values are DHT11 or DHT22

#define MQTT_SERVER "<mqtt-server-ip-or-dns>"
#define MQTT_HEALTH_TOPIC "<health-topic>"
#define MQTT_TEMPERATURE_TOPIC "<temperature-topic>"
#define MQTT_HUMIDITY_TOPIC "<humidity-topic>"

upload

I use the following command to run the upload:

pio run -t upload && pio device monitor -b 115200

This also monitors the serial out.

esp8266-temperature's People

Contributors

chr157i4n avatar jannotjarks avatar claasiihasii avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.