Giter Club home page Giter Club logo

alvarowolfx / weather-station-gcp-mongoose-os Goto Github PK

View Code? Open in Web Editor NEW
48.0 5.0 20.0 485 KB

A Weather station made with an ESP32, sending data through Google Cloud IoT Core and storing in BigQuery

Home Page: https://medium.com/@alvaroviebrantz/build-a-weather-station-using-google-cloud-iot-core-and-mongooseos-7a78b69822c5

License: MIT License

HTML 40.36% JavaScript 57.39% Shell 1.33% C 0.92%
iot mongoose-os google-cloud iot-core cloud-iot firebase serverless bigquery

weather-station-gcp-mongoose-os's Introduction

Build a Weather station using Google Cloud IoT Core and Mongoose OS

WebApp: https://weather-station-iot-170004.firebaseapp.com

Setup Google cloud tools and project

  • Install beta components:
    • gcloud components install beta
  • Authenticate with Google Cloud:
    • gcloud auth login
  • Create cloud project — choose your unique project name:
    • gcloud projects create YOUR_PROJECT_NAME
  • Set current project
    • gcloud config set project YOUR_PROJECT_NAME

Create IoT Core resources

  • Add permissions for IoT Core
    • gcloud projects add-iam-policy-binding YOUR_PROJECT_NAME --member=serviceAccount:[email protected] --role=roles/pubsub.publisher
  • Create PubSub topic for device data:
    • gcloud beta pubsub topics create telemetry-topic
  • Create PubSub subscription for device data:
    • gcloud beta pubsub subscriptions create --topic telemetry-topic telemetry-subscription
  • Create device registry:
    • gcloud beta iot registries create weather-station-registry --region us-central1 -event-notification-config=topic=projects/YOUR_PROJECT_NAME/topics/telemetry-topic

Upload firmware with Mongoose OS Tools

To use it we need to download and install it from the official website. Follow the installation instructions on https://mongoose-os.com/docs/quickstart/setup.html.

  • mos build --arch esp32 or mos build --arch esp8266
  • mos flash

Provision and config

  • mos wifi your_ssid your_pass
  • mos gcp-iot-setup --gcp-project your_project --gcp-region us-central1 --gcp-registry your_registry

Setup BigQuery Dataset and Table

Here we will use it to store all of ours collected sensor data to run some queries and to build reports later using Data Studio. To start let’s create a Dataset and a Table store our data. To do this, open the BigQuery Web UI, and follow the instructions:

  • Access bigquery.cloud.google.com
  • Click the down arrow icon and click on “Create new dataset”.
  • Name you Dataset “weather_station_iot”.
  • Create a Table “raw_data” with the following fields and types: --- PUT IMAGE HERE ---

Setup Firebase, deploy functions and webapp

  • npm install -g firebase-tools or yarn global add firebase-tools
  • firebase init
  • firebase functions:config:set bigquery.datasetname="weather_station_iot" bigquery.tablename="raw_data"
  • firebase deploy

weather-station-gcp-mongoose-os's People

Contributors

4xx avatar alvarowolfx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

weather-station-gcp-mongoose-os's Issues

command waits for further input

Iam new at firebase and GCP.I dont understand why this comma d is not executing.It waits for further input with >

firebase functions:config:set bigquery.datasetname="weather_station_iot" bigquery.tablename="raw_data”

Compilation terminated due to mgosh_gcp.h not found

/esp8266/build_contexts/build_ctx_226160062/src/main.c:2:22: fatal error: mgos_gcp.h: No such file or directory
[Jan 19 23:43:03.736] #include "mgos_gcp.h"

[Jan 19 23:43:03.736] ^
[Jan 19 23:43:03.736] compilation terminated.

I guess this is due to no include file i.e /include/mgos_gcp.h is absent in mgosh library.

Firebase init overwrites firebase.json

When running the firebase init command firebase.json gets overwritten. This removes the
"rewrites": [
{ "source": "/getReportData", "function": "getReportData" },
{
"source": "**",
"destination": "/index.html"
}
]
part, leading to a 404 when the web app tries to call getReportData.

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.