Giter VIP home page Giter VIP logo

weatherpi's Introduction

WeatheRPi

Indoor Weather web app (and REST API) powered by a Raspberry Pi.

The web interface looks like this -

Weather data can also be obtained using a REST API (GET /api). Example -

$ curl 192.168.1.200:8080/api
{"place": "Home", "temperature": {"units": "F", "value": 81.7}, "humidity": 44.6}

Hardware Details

You will need the following -

  • Raspberry Pi (any model)
  • DHT-22 (or DHT-11) temperature/humidity sensor
  • 10k resistor (as pull-up)

Connections

For the DHT, pin 1 is the leftmost (when facing the front i.e. the "grid" side) and pin 4 is the rightmost.

  • Pin 1 -> 3V3
  • Pin 2 -> Data to BCM GPIO #4 (change code to use other pins)
  • Pin 2 -> 10k resistor -> 3V3
  • Pin 3 - Not used
  • Pin 4 -> Ground

Installation

Pre-requisites

This code uses the Adafruit_DHT library to talk to the DHT sensor. The easiest way to install it is using pip (sudo will be required if not using a virtual environment) -

$ pip install git+https://github.com/adafruit/Adafruit_Python_DHT

If that fails, installing a few things may be required -

$ sudo apt-get install python-pip build-essential python-dev python-openssl

Configuration

This step is required only if the defaults need to be changed. The code uses the following defaults -

  • Web server is started on port 8080
  • Data pin is connected to BCM GPIO #4 on the Raspberry Pi
  • Sensor used is DHT-22

These can be changed in weatherpi.py

Running the web server

It needs to be run with root previliges to be able to use GPIO.

$ sudo python weatherpi.py

License

FreeBSD

weatherpi's People

Contributors

hrishikesh195 avatar

Stargazers

 avatar

Watchers

 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.