Code Monkey home page Code Monkey logo

my-meteorological-station's Introduction


My meteorological station

My meteorological station is a Web app to manage homemade weather stations built with Raspberry Pi.

This is a project for Google Summer of Code 2017 - Physical Web organization.


Table of content


Getting started

Build your station (Raspberry Pi)

Station requirements

  • Raspberry pi (model 2B or 3B)
  • Sensor Adafruit DHT22 (3 pins)
  • Sensor Adafruit BMP 180 (4 pins)
  • Micro SD card (minimum 8GB)
  • Micro usb power adapter
  • 7 GPIO cable (female both ends)

Connect sensors to GPIO

This image shows how RPi GPIO pins are labeled.

DHT22 sensor:

  • + to 3.3v pin
  • out to pin 17
  • - to Ground pin

BMP180 sensor:

  • VIN to 3.3v pin
  • GND to Ground pin
  • SLC to pin 3
  • SDA to pin 2

The final result can be like this:

Install and configure Raspbian

  1. Follow the official steps to install Raspbian OS using NOOBS (the easiest way).

  2. Enable SSH and I2C port.

    Go to Preferences > Raspberry Pi Configuration > Interfaces tab > Enable SSH and I2C like the next image.

  1. Get and annotate RPi ip typing ifconfig in the terminal.

When the server installation is completed and the application is running, you can add a new station and the station is automatically configured by the server (copying all scripts and enabling services using ssh).

Server installation

Server requirements

Install Node.js 8
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt-get install -y nodejs
Create a firebase project
  1. Enable Google sign in

    Go to Authentication > Sign-in merthod > Google > Enable

  2. Add database rules

    Go to database > Rules and copy this rules.

     {
     	"rules": {
     		"beacons": {
     			"$uid": {
     				".read": "$uid === auth.uid",
     				".write": "$uid === auth.uid"
     			}
     		},
     		"stations": {
     			".read": true,
     			".write": false,
     			"$uid": {
     				".read": true,
     				".write": "$uid === auth.uid"
     			}
     		},
     		"users": {
     			"$uid": {
     				".read": "$uid === auth.uid",
     				".write": "$uid === auth.uid"
     			}
     		}
    
     	}
     }
    
  3. Get client data

    Create a file named firebase-config.json with this structure:

     {
     	"apiKey": "",
     	"authDomain": "",
     	"databaseURL": "",
     	"projectId": "",
     	"storageBucket": "",
     	"messagingSenderId": ""
     }
    

    Go to Project Settings > Add Firebase to your web app button and fill all fields with the data from your project.

  4. Get admin data

    Go to Project Settings > Service accounts > Generate new private key

    Download and rename key to firebase-admin.json.

Get a maps api key

Create a Google Cloud project, go to APIs & services, enable Maps Javascript API and Maps Geocoding API and create a key.

Create a file named maps-key.json with this structure and paste your key.

{
	"apikey": ""
}
Create a twitter app

Create a file called twitter-config.json with this structure:

{
	"consumer_key": "",
	"consumer_secret": "",
	"access_token": "",
	"access_token_secret": ""
}

Create a new twitter app, go to Keys and Access Tokens and fill all fields with the values from your project.

Start server

  1. Clone this repository

     git clone https://github.com/gerard87/my-meteorological-station.git
    
  2. Copy config files

    Copy to the root of the project the four config files:

    • firebase-config.json
    • firebase-admin.json
    • maps-key.json
    • twitter-config.json
  3. Install dependencies

     npm install
    
  4. Start server

     npm start
    

Google assistant and API.AI configuration

  1. Go to https://api.ai/ and create a new agent.

  2. Click settings > Export and import > Restore from zip.

  3. Select the mmsagent.zip inside /assistant/agent folder.

  4. Go to Fullfitment and enter the URL: https://<your_server_URL>/assistant

License

MIT © Gerard Farré Gomez

my-meteorological-station's People

Contributors

gerard87 avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

liquidgalaxylab

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.