This project is originally developed for sensing the temperature and humidity in my indoor hydroponic farm. It's utilizing DHT11 temperature and humidity sensor that attached to ESP8266 wifi chip module. I don't need the pricey Arduino or Raspberry Pi for this kind of project.
note: You can also use DHT22 sensor for this project.
- Install the build toolchain for ESP8266. I won't explain it here, but you can check at esp-open-sdk's repository.
- Copy
user_config_example.h
and rename it touser_config.h
. You can change the wifi setting in this file. - Open
Makefile
and change the path setting ofXTENSA_TOOLS_ROOT
,SDK_BASE
,ESPPORT
, andEXTRA_INCDIR
to your build toolchain installation path. - If you use DHT22 sensor instead of DHT11, you can change it at
user_main.c
line 20. ReplaceSENSOR_DHT11
withSENSOR_DHT22
.
- run
make
to build the firmware. - run
make flash
to burn the firmware into ESP8266 chip.
DHT11 Pin | ESP8266 Pin |
---|---|
+ | vcc 3.3v |
out/data | GPIO 2 |
- | GND |
- Don't call it IoT device if it's not connected to the internet, so I need send the data to my server by using CoAP or MQTT protocol.
- Currently the ESP will boot only if GPIO 2 not attached to the DHT data pin at start up, then attach it later. I need to resolve this issue.
You can buy me a cup of coffee if you think this code is useful :)