Skip to content

A simple project to connect a DHT22 temperature sensor to the internet using a NodeMCU and post data using MQTT.

Notifications You must be signed in to change notification settings

robertprice/NodeMCU_MQTT_Temperature

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

NodeMCU MQTT Temperature

A simple project to connect a DHT22 temperature sensor to the internet using a NodeMCU and post data using MQTT.

Parts

  • NodeMCU (v3)
  • DHT22

Setup

Wiring diagram

There is a shortcut between D0 and RST, this is to enable the module to go into deepsleep and wake up automatically. When flashing the NodeMCU remove this. You may also have to press the Flash button to allow uploads if you change the code.

The DHT22 is linked to pin D7, but this can be changed in the config.h if you wish.

You will also need to set your WIFI_SSID and WIFI_PASS in config.h as well as the address of your MQTT host.

You need to include the following libraries

Using the device

The device posts the temperature and humidity to a the MQTT host in your config.h. It posts to the shed/humdity and shed/temperature topics as a with a payload of a stringified float like "20.40".

To read the values, just subscribe to the same topic and read the incoming messages from your favourite programming language.

About

A simple project to connect a DHT22 temperature sensor to the internet using a NodeMCU and post data using MQTT.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published