-
#Balccon2k17
10/19/2017 at 19:05 • 0 commentsI did a workshop on "Simple IOT" at the Balccon2k17 in Novi Sad, now at its fifth edition.
The participants received tens of kits to assemble (including some soldering) their "Simple IOT" devices, a cube like unit that runs on battery, measures temperature and sends all data online via Wifi. The workshop went great, and at the end we got several units up and running, talking to the server to report remote temperature readings.
More on this on the blog: https://www.uradmonitor.com/balccon2k17
If interested in building yours, you can find all hardware and software details on Github: https://github.com/radhoo/SimpleIOT
-
Improvements
09/07/2017 at 16:42 • 0 commentsThis 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:
- NO-SLEEP: The No-Sleep setting will keep everything on at all times. This will drain the most current.
- MODEM-SLEEP: Modem-sleep is the default mode for the ESP8266. It's only enabled when you're connected to an access point. In this mode, the ESP8266 will disable the modem (WiFi) as much as possible. It turns off the modem between DTIM Beacon intervals. This interval is set by your router.
- LIGHT-SLEEP: Light-sleep performs the same function as Modem-sleep, but also turns off the system clock and suspends the CPU. The CPU isn't off; it's just idling.
- DEEP-SLEEP: Everything is off but the Real Time Clock (RTC), which is how the computer keeps time. Since everything is off, this is the most power efficient option.
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:
- Read sensor
- Sleep for n microseconds
- Repeat
The sleep time is specified in microseconds (µs), and you can call it with:
ESP.deepSleep(50e6); // 50e6 is 50 seconds