amc2022:grouph:here
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| amc2022:grouph:here [2022/09/09 21:18] – gustavo001 | amc2022:grouph:here [2023/01/05 14:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== | + | ====== |
| {{ : | {{ : | ||
| + | //**figure 4.1**// Deep-Sleep set up for ESP32/ | ||
| ====== | ====== | ||
| {{ : | {{ : | ||
| - | ====== | + | //**figure 4.2**// Graph depicting Deep-Sleep schematics set up for ESP32/ |
| + | |||
| + | |||
| + | ====== | ||
| <code c++> | <code c++> | ||
| - | *//There are 2 ways to wake up a system, those are called Interrupts | + | *//There are 2 ways to wake up a system, those are called Interrupts. |
| - | *//hardware Interrupts | + | *//hardware Interrupts |
| - | *//Software Interrupts occur when we program the device like through a wake up alarm or timer | + | *//Software Interrupts occur when we program the device, like through a wake up alarm or timer. |
| #define uS_TO_S_FACTOR 1000000 | #define uS_TO_S_FACTOR 1000000 | ||
| Line 18: | Line 21: | ||
| RTC_DATA_ATTR int bootCount = 0; | RTC_DATA_ATTR int bootCount = 0; | ||
| + | *//Data has to be stored in the Real time Clock (RTC) fast memory because the CPU memory is wiped on every boot. | ||
| + | *// The amount of data has to be minimal due to size limitations : 8bit fast memory and 8bit Slow memory. | ||
| - | *//Keeps data of times awaken in internal RTC | + | *//Power outages and resetting the board will erase the RTC memory, therefore its use should be limited to non essential information. |
| + | *// | ||
| Line 26: | Line 31: | ||
| **************Wake Up Print ************************************************************** | **************Wake Up Print ************************************************************** | ||
| - | void print_wakeup_reason(){ | + | void print_wakeup_reason(){ |
| esp_sleep_wakeup_cause_t wakeup_reason; | esp_sleep_wakeup_cause_t wakeup_reason; | ||
| Line 39: | Line 44: | ||
| } | } | ||
| - | *//We made the system wake up due to the internal timer and a pushed button, the reason for the push button is that in the case we want to take a measurement at our will without having to wait for the timers. | + | *//We made the system wake up due to the internal timer and a pushed button, |
| + | *// the reason for the push button is that in the case we can take a measurement at our will without having to wait for the timers. | ||
| + | *//An external clock could be added to the device, however Grafana already designates time and date of transferred data. | ||
| void setup(){ | void setup(){ | ||
| Line 58: | Line 65: | ||
| for(int i=0; | for(int i=0; | ||
| { | { | ||
| - | digitalWrite(32, | + | digitalWrite(32, |
| delay(1000); | delay(1000); | ||
| digitalWrite(32, | digitalWrite(32, | ||
| Line 85: | Line 92: | ||
| - | esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR); | + | esp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR); |
| - | Serial.println(" | + | Serial.println(" |
| " Seconds" | " Seconds" | ||
| - | Serial.println(" | + | Serial.println(" |
| delay(1000); | delay(1000); | ||
| - | Serial.flush(); | + | Serial.flush(); |
| + | | ||
| esp_deep_sleep_start(); | esp_deep_sleep_start(); | ||
| | | ||
| Line 99: | Line 107: | ||
| </ | </ | ||
| - | ====== | + | |
| + | *** There is no loop section in our coding because the micro controller will go into deep sleep before reaching that part// | ||
| + | of the code, which means everything has to be written in the void set up section of the sketch.// | ||
| + | |||
| ====== | ====== | ||
| {{ : | {{ : | ||
amc2022/grouph/here.1662751121.txt.gz · Last modified: 2023/01/05 14:38 (external edit)