dragoshenron / m2x-sample-cleverfaucet

Simple Smart Faucet using AT&T's M2X (Python + Raspberry Pi)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sample Smart Faucet using AT&T's M2X and Raspberry Pi

This Python app for your Raspberry Pi records how much water and what temperature water is being used at a faucet connected to your Pi using a flowmeter and a temperature sensor. It then will send that information to AT&T's M2X service where it is stored for future retrieval and analysis.

If you want to display the data from your faucet, here’s a quick app that you can deploy to Heroku: https://github.com/attm2x/m2x-sample-cleverfaucet-web

What you need

Dependencies

  • Python running on your Raspberry Pi (Tutorial)
  • m2x-python - v3.0.4
  • RPi.GPIO - If you are running Raspbian this should already be included with its Python installation

Instructions

  1. Clone this repository
$ git clone https://github.com/attm2x/m2x-sample-cleverfaucet
$ cd faucet
  1. Create a new M2X device.
  2. Copy the Device ID from the device page.
  3. From your M2X account page get your Master API Key.
  4. Create two data streams in that device. One named 'water_use' and the other named 'temperature'.
  5. In main.py replace MASTER_API_KEY and DEVICE_ID:
client = M2XClient(MASTER_API_KEY)
device = client.devices.get(DEVICE_ID)
with:
client = M2XClient('your_key_here')
device = client.devices.get('device_id_here')
  1. WARNING: Wiring this incorrectly could fry your Pi so proceed with caution.

    Use the following diagram to connect the sensors to your pi: Wiring diagram

    Here is the GPIO Diagram from the various Pi Models:

  2. Place the faucet directory on your Pi. Now simply run the following:

$ sudo ./start.sh
  1. Check out the data streams on M2X and you should see them update when you use the faucet!

##LICENSE

This sample application is released under the MIT license. See LICENSE for the terms.

About

Simple Smart Faucet using AT&T's M2X (Python + Raspberry Pi)

License:MIT License


Languages

Language:Python 93.1%Language:Shell 6.9%