However, this method works very well and it is easy to implement. Please note that this method has some limitations: first, it uses a third party service, and second, you need to be careful with the amount of requests you make in one day. You should be able to take this project example and apply it to your own projects. This way, the ESP is awake only when we need to take readings. We’ve also used the ESP deep sleep capabilities to save power. As an example, we’ve published readings from the BME280 sensor. In this post we’ve shown you how to publish your sensor readings with your ESP32 or ESP8266 to a spreadsheet on Google Sheets using the IFTTT platform. On the other hand, the ESP8266 publishes new readings approximately every 28 to 29 minutes. The ESP32 chip has a built-in clock, so the readings are very accurate and it publishes to the spreadsheet every 30 minutes. Make sure you select the right board and COM port.Įvery 30 minutes, the ESP32 or ESP8266 wakes up to take sensor readings and publishes the readings in a spreadsheet on Google Sheets. Upload the code to your ESP32 or ESP8266. While(WiFi.status() != WL_CONNECTED & (timeout- > 0)) " DemonstrationĪfter making all the necessary changes. Establish a Wi-Fi connection with your router Deep sleep mode for 3600 seconds (60 minutes)ĮSP.deepSleep(TIME_TO_SLEEP * uS_TO_S_FACTOR) start deep sleep for 3600 seconds (60 minutes) Serial.println("Could not find a valid BME280 sensor, check wiring!") Įsp_sleep_enable_timer_wakeup(TIME_TO_SLEEP * uS_TO_S_FACTOR) Adafruit_BME280 bme(BME_CS, BME_MOSI, BME_MISO, BME_SCK) // software SPI Adafruit_BME280 bme(BME_CS) // hardware SPI Uint64_t uS_TO_S_FACTOR = 1000000 // Conversion factor for micro seconds to seconds const char* resource = "/trigger/bme280_readings/with/key/nAZjOph元d-ZO4N3k64-1A7gTlNSrxMJdmq圓" How your resource variable should look like, but with your own API KEY (that API KEY below is just an example): Replace with your unique IFTTT URL resourceĬonst char* resource = "REPLACE_WITH_YOUR_IFTTT_URL_RESOURCE" *Ĭonst char* ssid = "REPLACE_WITH_YOUR_SSID" Ĭonst char* password = "REPLACE_WITH_YOUR_PASSWORD" Note: this code works both with the ESP32 and the ESP8266. But don’t upload it yet! You need to make a few modifications to make it work for you. Mac and Linux instructions – ESP32 Board in Arduino IDEĪfter making sure you have the ESP32 add-on installed, you can copy the following code to your Arduino IDE.Windows instructions – ESP32 Board in Arduino IDE.Follow one of the next tutorials to prepare your Arduino IDE, if you haven’t already. There’s an add-on for the Arduino IDE allows you to program the ESP32 using the Arduino IDE and its programming language. Scroll all the way down to find the library and install it.Īfter installing the libraries, restart your Arduino IDE. Go to Sketch > Include Library > Manage Libraries and type “ Adafruit Unified Sensor” in the search box. Follow the next steps to install the library in your Arduino IDE: To use the BME280 library, you also need to install the Adafruit_Sensor library. Search for “ adafruit bme280 ” on the Search box and install the library. Open your Arduino IDE and go to Sketch > Include Library > Manage Libraries. To take readings from the BME280 sensor module we’ll use the Adafruit_BME280 library. Recommended reading: ESP8266 with BME280 using Arduino IDE (Pressure, Temperature, Humidity) Installing the BME280 library Note: to use deep sleep with the ESP8266, you need to wire D0 (GPIO16) to the RST pin.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |