diff --git a/README.md b/README.md index ae1f59e..c12617a 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,16 @@ This is a Tornado project reading from MCP3008 ADC using raspberry pi. +There is a MQ135 sensor on channel 0, a MQ138 on channel 1, and a Sharp dust sensor on channel 2. +More information/documents can be found on the [blog post](https://grapeot.me/smart-air-purifier.html). ## SPI * Need to first enable by running `sudo raspi-config`. -* Python requires package spidev +* Python requires package `spidev`. * Example: [link](http://jeremyblythe.blogspot.ca/2012/09/raspberry-pi-hardware-spi-analog-inputs.html) -* We also have code [here](https://bitbucket.org/grapeot/gassensorapi). + +## Usage + +* Tested on Raspbian +* Use `deploy.sh` to install dependencies. +* Use `launch.sh` to launch. +* Visit `http://:5000/` to check the visualization. diff --git a/deploy.sh b/deploy.sh index f332d75..a60d58a 100644 --- a/deploy.sh +++ b/deploy.sh @@ -1,9 +1,16 @@ # install python dependencies sudo apt-get update -sudo apt-get install python3-dev python3-pip +sudo apt-get install python3-dev python3-pip swig2.0 pip3 install spidev rpi.gpio +# Compile and install the wiringpi library, detailed instructions available at https://github.com/WiringPi/WiringPi-Python +git clone https://github.com/WiringPi/WiringPi-Python +cd WiringPi +swig2.0 -python -threads wiringpi.i +sudo python3 setup.py build install +cd .. # install nodejs + pm2 to launch curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.0/install.sh | bash nvm install node npm install -g pm2 + diff --git a/static/main.js b/static/main.js deleted file mode 100644 index 5f3b698..0000000 --- a/static/main.js +++ /dev/null @@ -1,13 +0,0 @@ -$(function() { - $('#msg').hide(); - $.get('/api/v1/jobs').done(function(data) { - if (data.status != 'success') { - $('#msg').html('Status failed.') - $('#msg').show() - return; - } - for (var item in data.result) { - $('#items').append('
  • ' + item.toString() + '
  • '); - } - }); -}); diff --git a/views/api.html b/views/api.html deleted file mode 100644 index 3de5b52..0000000 --- a/views/api.html +++ /dev/null @@ -1,13 +0,0 @@ -{% extends "layout.html" %} - -{% block extraHeader %} - -{% end %} - -{% block body %} - -

    {{ title }}

    -

    - - -{% end %}