Chat freely about anything...

User avatar
By Sirquil
#95894 CameraRainGauge.ino project updated 01/26/2023.

Added: Uploading data to Google Sheet by the month for a year. File in folder BME280 ChatGPT6 is copied into Google App script editor. Before pasting into editor; erase any existing code. Replace new sheet_id with sheet_id where Google App script was placed. For more detailed information see article:

"ESP32 Data Logging to Google Sheets with Google Scripts"

Project would have been impossible for me without the help of people from community; arduino.cc Forum, Adafruit.com Forum, ESP8266 Forum, Github.com, Random Nerd Tutorials Forum. Project started back in the Fall of 2013; with gifted "Arduino Uno." Thank you to all the people that have helped with the project!

Project served from ESP32 Project web site severed from ESP32.

Project web site served by Free Hosting Service

"CameraRainGauge.ino" was developed to provide a data logger accessible over the Internet, provide capability to manage files via file transfer protocol (FTP), over-the-air (OTA) firmware updates, two web sites, RTSP video feed, and uploading data to Google Sheets!

Live CameraRainGauge.ino data feed:

Heart of the project is task management; this is accomplished using network time protocol (NTP) servers to set ESP32 system time. UDP packets from the NTP server are decoded into MONTH,DATE, YEAR, HOUR, MINUTE, and SECOND. Conditional "if" statement "if((MINUTE % 15 == 0) && (SECOND==0))" are used to excute tasks at specified number of minutes and seconds; this statement evaluates "true" every fifthteen minutes and zero seconds. NTP is used to automatically configure time zone and daylight saving time., plus date-time stamps.

AsyncWebServer handles "GET" requests from the Internet and processing of web pages.

William
Last edited by Sirquil on Sun Feb 05, 2023 8:19 am, edited 2 times in total.
User avatar
By Sirquil
#95928 This is a Google Script that retrieves environmental data (datetime, temperature, heat index, humidity, dewpoint, pressure, and a difference value) from a web interface and appends it to a Google Spreadsheet. The sheet name is based on the current month and year, and a new sheet will be created with an additional number if the sheet with the same name already exists. If it's the last day of the current month, a new sheet for the next month will be created. The script has several functions, including getting the name of the current month, creating a new sheet with the specified name, adding headers to the new sheet, and appending the data to the sheet. Script is designed to create a new sheet at the end of each month with the name of the month and the year. The year will be incremented by 1 if the "flag" variable is set to 1. The "testForNextYear" function is supposed to update the "flag". The script checks if the current time is equal to the first day of the next year. If it is, the flag is set to 1.

Script modified by William Lucid; coding assist from OpenAI.com and ChatGPT. My first experience attemping to write GS Script; without OpenAI.com and ChatGPT, would have been an impossiable task!

Gist of BME280 ChatGPT Google Sheets App Script.

William
Attachments
GS Script
(2.36 KiB) Downloaded 41 times