GithubHelp home page GithubHelp logo

vtt-info / esp32-weather-google-sheets Goto Github PK

View Code? Open in Web Editor NEW

This project forked from artem-smotrakov/esp32-weather-google-sheets

0.0 0.0 0.0 995 KB

Weather station based on ESP32 and MicroPython with sending data to Google Sheets

License: MIT License

Shell 2.08% Python 97.92%

esp32-weather-google-sheets's Introduction

Weather station based on ESP32 and MicroPython

This is a weather station based on ESP32 and MicroPython.

Here is a list of main features:

  • Measuring temperature and humidity with DHT22 sensor
  • Sending data to a Google sheet
  • Supporting Google OAuth 2.0 service to get access to the sheet
  • Configuring the device via web browser

The sheet doesn't need to be publicly available on the Internet. The device doesn't require any middleman such as PushingBox or IFTTT.

How to make a weather station

Here is a circuit and a breadboard view.

The project uses MicroPython 1.11. Older or newer versions may also work. The project uses the following tools:

  • esptool for flashing ESP32
  • mpfshell for uploading files to ESP32
  • minicom for connecting to ESP32 for debugging purposes
  • openssl and rsa package for reading cryptographic keys

Preparing a service account in Google IAM

To access a Google sheet, the project needs a service account:

The key is encoded in PKCS1 format. Unfortunately the project doesn't support PKCS1 yet. You need to convert the key to the format which the project undrstand:

$ cd scripts
$ sh extract_key.sh ../google_key.json ../key.json

You'll need key.json and an email for the sercvice account.

Creating a Google sheet

Create a Google sheet and extract its ID from the URL

https://docs.google.com/spreadsheets/d/<ID_is_here>/edit#gid=0

Share the sheet with your service account. The sheet doesn't need to be publicly accessible from the Internet.

Preparing a configuration file

main.conf contains a configuration for the device. Provide the following parameters:

  • ssid and password are credentials for your Wi-Fi
  • google_service_account_email is an email for the Google's service account
  • google_sheet_id is the Google's sheet ID
  • measurement_interval is a mesurement interval in Xh Ym Zs format, for example, 1h 2m 3s

Uploading MicroPython

The following scripts may be used to upload MicroPython to ESP32:

$ sh scripts/erase.sh
$ sh scripts/flash.sh
$ sh scripts/verify.sh

Uploading code and configs

You can run sh scripts/upload.sh to upload the code, the configuration file and the key.

Then, you can connect to the board with sh scripts/minicon.sh command to check if everything works fine.

Configuration mode

The switch turns on the configuration mode. In this mode the device sets up a Wi-Fi access point, and start an HTTP server on http://192.168.4.1. The server provides a web page for updating the configuration of the device.

Acknowledgement

Further enhancements

Here is a list of possbile enhancements:

  1. Support BMP280 barometric pressure sensor
  2. Support DS18B20 temperature sensor
  3. Support MH-Z19 CO2 sensor
  4. Support PKCS1

esp32-weather-google-sheets's People

Contributors

artem-smotrakov 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.