Code Monkey home page Code Monkey logo

esp8266livingsensor's Introduction

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.

esp8266livingsensor's People

Contributors

obono avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.