This simple construction illustrates the IOT concept and provides a solid base for expanding to more complicated sensors. The EXP Protocol can be used to add additional readings to the "Simple IOT Device", including sensors for CO2 or PM2.5. Since the Simple IOT device runs on a battery, power consumption can be implemented in the code, turning the ESP8266 Radio off to save power, and only reconnecting before data upload. A good approach is to have it take measurements every 30-60 minutes and sleep in between. There are four types of sleep modes for the ESP8266: No-sleep, Modem-sleep, Light-sleep, and Deep-sleep. They all have different functions and different current cost:
You can use the Deep-sleep mode to have the ESP8266 go idle when measurements are not needed . You can take temperature readings every 60minutes and have the Wemos D1 go to sleep in between. Then on wake-up, make sure the connection is up before retransmitting. The logic is as follows:
The sleep time is specified in microseconds (µs), and you can call it with:
ESP.deepSleep(50e6); // 50e6 is 50 seconds
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.