Poluino / Firmware

https://weatherstationproject.com
8 stars 0 forks source link

ESP32 Firmware Enhancements #2

Open ChromeUniverse opened 4 years ago

ChromeUniverse commented 4 years ago

Ideas for firmware revisions

  1. Turn off ESP32's Wi-Fi between POSTs
  2. Tell the ESP32 to enter sleep/deep-sleep between POSTs
  3. Record sensor measurements and upload data all at once, once per day (e.g. time: midnight, midday, etc.) NOTE: requires external memory (e.g.: SD card, SPI flash, probably not EEPROM) + external RTC (e.g.: DS1307 & coin cell)
danielalexis commented 4 years ago
  1. I dont think we can turn off wifi because it takes a lot of power when connecting
  2. That could be done but it requires testing
  3. I was thinking of either making a specific api to save data or it saves automatically every 5 min
dhruvsujatha commented 4 years ago

@danielalexis ESP32 entering Deep Sleep after a POST is very much doable. In fact, the ESP32 will consume only mere microWatts of power when compared to the 50 milliWatts when connected to WiFi. This could be a viable option in resource-scarce environments such as the power of a battery / solar cell. I would say this is a decent idea from @ChromeUniverse but we need to do a lot of testing.

With regards to the API, I believe @danielalexis is working on it right now. We do need more flexibility with the API which we will have a call later today to finalize. Let me throw in a few of my suggestions down below as well:

  1. We need APIs to recognize the board and save data every hour in the UTC Time.

  2. We also need an API to GET data from the database. This can be used for the Discord bot as well as the ML Pipeline in the future. For this, we need a security system to prevent unauthorized access.

danielalexis commented 3 years ago

@Luberr-Dhruv is it possible for you test this? I want to make sure the following is tested:

ChromeUniverse commented 3 years ago

@danielalexis The ESP32 turns off its radio when it enters deep-sleep. It'll need to reconnect to Wi-Fi when it wakes up again.

Power modes as described by the ESP32 datasheet:

– Active mode: The chip radio is powered on. The chip can receive, transmit, or listen. – Modem-sleep mode: The CPU is operational and the clock is configurable. The Wi-Fi/Bluetooth baseband and radio are disabled. – Light-sleep mode: The CPU is paused. The RTC memory and RTC peripherals, as well as the ULP co-processor are running. Any wake-up events (MAC, host, RTC timer, or external interrupts) will wake up the chip. – Deep-sleep mode: Only the RTC memory and RTC peripherals are powered on. Wi-Fi and Bluetooth connection data are stored in the RTC memory. The ULP co-processor is functional. – Hibernation mode: The internal 8-MHz oscillator and ULP co-processor are disabled. The RTC recovery memory is powered down. Only one RTC timer on the slow clock and certain RTC GPIOs are active. The RTC timer or the RTC GPIOs can wake up the chip from the Hibernation mode

danielalexis commented 3 years ago

I dont think its worth due to the the power it requires to reconnect

ChromeUniverse commented 3 years ago

@danielalexis I still think it might be worth it, but we need to run some tests to measure the current draw and get some numbers. I'm pretty sure someone's already done these calculations, though.