Skip to content
ショップ

IoT services using Google Sheets (ESP32 Setup)

Assemble the leaves, write a sketch, and make sure the data is written to Google Sheets.

Use the following leaves.

TypeNameQ’ty
AZ62Connector Cover 2
AI014-Sensors1
AX07Back to back1
AP02ESP32 MCU1
AV042V~4.5V1
AZ63Nut Plate2
AAA battery holder1
AAA battery3
M2*8mm screw2
M2*12mm screw2
φ10x2mm magnet1

Stack the ESP32 MCU leaf and the 4-Sensors leaf on top of each other and screw them together as shown below.

assemble1

Write the program in the Arduino IDE.

Note the following bullets in the Github source code, modify it, and write it to ESP32 leaf.

  1. Substitute the following constants for the information of the WiFi to be accessed.
const char* SSID = "wifi_ssid"; // WiFi SSID
const char* PASSWORD = "wifi_password"; // WiFi Password
  1. Substitute the following constants for the web app information you just created.
    • From the app-specific URL:const char* KEY = AKfycbxbxoqWzuN8Eztplnhf3ywC-0QpWc8utkIY1QLngj4fHJFRvZKh
const char* KEY = "google_scripts_key";
  1. If you want to adjust the time interval for writing sensor data, substitute the following constants.
    • Units are in seconds.
uint64_t DEEP_SLEEP_TIME_SEC = 60;
#include <Arduino.h>
#include <Wire.h>
#include <HTTPClient.h>
#include <HTS221.h>
#include <ClosedCube_OPT3001.h>
// Unique ID
String UniqueID = "Leafony_AP02";
// Connecting WiFi Settings
const char* SSID = "wifi_ssid"; // WiFi SSID
const char* PASSWORD = "wifi_password"; // WiFi Password
// Accessed Google Script Settings
const char* APP_SERVER = "script.google.com";
const char* KEY = "google_scripts_key";
// Device sleep time (sec) to reduce Joule heat
uint64_t DEEP_SLEEP_TIME_SEC = 60;
// 省略

Run Arduino and sequential sensor data will be written to Google Sheets.