Skip to content

A solution to record indoor environment using Google spreadsheet and ESP-WROOM-02 with several sensors.

License

Notifications You must be signed in to change notification settings

obono/ESP8266LivingSensor

Repository files navigation

ESP8266 Living Sensor

Description

A solution to record indoor environment using Google Sheets and ESP-WROOM-02 with several sensors.

Concept image

Recording server

Google Sheets is utilized for recording server.

  • Create a new spreadsheet
  • Open script editor
    1. Click Tools from the menu bar
    2. Select "Script editor" subitem
  • Replace the default script code with the content of "main.gs" and save
    • You must edit TOKEN to random characters for security.
const TOKEN = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
  • Run setup() function
    1. Choose "setup" from the functions drop-down list
    2. Click ⏵ icon
  • Publish web app
    1. Click Publish from the menu bar
    2. Click "Deploy as a web app..."
    3. Give the project a version number
    4. Set app access to "Anyone, even anonymous"
    5. Click Deploy
      • If prompted, review and authorize permissions.
    6. Copy web app URL from Success prompt

Sensor device

This device measures the temperature, illuminance and sound level, and upload them to the sever every 3 minutes.

Hardware

Components

  • ESP-WROOM-02
  • Sensors
  • LDO module (3.3V): M-3V3SIP
  • USB to serial UART module: AE-FT234X
  • Resistors
    • 200kΩ × 2
    • 10kΩ × 6
    • 2.2kΩ × 1
    • 390Ω × 1
  • Electrolytic capacitor
    • 1µF × 1
  • Transistor
  • Wires, connectors, switches, etc...

Circuit diagram

Main circuit

Main circuit diagram

Writer circuit

Writer circuit diagram

Production Example

Production Example

Software

Build and transfer

Clone the source code and open the project file "ESP8266LivingSensor.ino" with Arduino IDE.

You must import ESP8266 board.

This sketch depends on following libraries. (You can add these by library manager)

Also this uses following library.

You must modify "Credentials.h" according to your situation.

  • MY_SSID and MY_PASSWORD for your Wi-Fi access point
    • If you assign static IP address to the device, uncomment #ifdef STATIC_ADDRESS and edit staticIP, gateway, subnet and dns.
  • GAS_PATH and GAS_TOKEN for your recoding server
    • GAS_PATH depends on the web app URL.
    • GAS_TOKEN must be same as TOKEN of web app script.
#define MY_SSID     "SSID"
#define MY_PASSWORD "PASSWORD"
//#define STATIC_ADDRESS

#ifdef STATIC_ADDRESS
IPAddress staticIP(192, 168, 1, 100);
IPAddress gateway(192, 168, 1, 1);
IPAddress subnet(255, 255, 255, 0);
IPAddress dns(192, 169, 1, 1);
#endif

#define GAS_HOST    "script.google.com"
#define GAS_PATH    "/macros/s/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/exec"
#define GAS_TOKEN   "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

You can build the source code with following configuration.

  • Board: "Generic ESP8266 Module"
  • Builtin Led: "2"
  • Upload Speed: "921600"
  • CPU Frequency: "160 MHz"
  • Crystal Frequency: "26 MHz"
  • Flash Size: "4MB (FS:2MB OTA:~1019KB"
  • Flash Mode: "QIO (fast)"
  • Flash Frequency: "26 MHz"
  • Reset Method: "dtr (aka modemcu)"
  • Debug port: "Disabled"
  • Debug Level: "None"
  • lwIP Variant: "v2 IPv6 Higher Bandwidth"
  • VTables: "Flash"
  • Exceptions: "Legacy (new can return nullptr)"
  • Erase Flash: "Only Sketch"
  • Espressif FW: "nonos-sdk 2.2.1+119 (191122)"
  • SSL Support: "Basic SSL ciphers (lower ROM use)"

Then, you can transfer binary data to ESP-WROOM-02 throungh the writer circuit.

License

MIT License

These codes are licensed under MIT License.

About

A solution to record indoor environment using Google spreadsheet and ESP-WROOM-02 with several sensors.

Topics

Resources

License

Stars

Watchers

Forks