Giter Site home page Giter Site logo

sds-sensor-reader's Introduction

SDS Sensor Reader

This python script can be used to read the data from the SDS011/SDS18/SDS021 and upload it to the the aqicn.org server.

The script continuously reads the data from the SDS sensor, and, every minute, uploads the averge, median and standard deviation to the server.

Installation

Make sure to update the USB port and sensor ID configuration in the script, line 15 and 16:

SENSORID = "YOUR-SENSOR-ID"
USBPORT  = "/dev/ttyUSB0"

For the SENSORID, use a name like country.city.organization|name.sensor-name. For instance usa.nyc.nuy.outdoor-01 or uae.dubai.johndoe.outdoor-patio.

For the USB port, you need to check on which USB port is the serial USB converter mounted. Check https://learn.sparkfun.com/tutorials/terminal-basics/connecting-to-your-device for more information.

Running the script

Just use: python sds-reader.py

Output example:

Starting reading sensor YOUR-SENSOR-ID on port /dev/ttyUSB0
[ 0.8] Samples: 1 PM2.5: 335 PM10: 642 StdDev(PM2.5):0.0
[ 1.8] Samples: 2 PM2.5: 328 PM10: 625 StdDev(PM2.5):3.5
[ 2.8] Samples: 3 PM2.5: 323 PM10: 613 StdDev(PM2.5):4.9
[ 3.8] Samples: 4 PM2.5: 318 PM10: 601 StdDev(PM2.5):6.3
[ 4.8] Samples: 5 PM2.5: 310 PM10: 577 StdDev(PM2.5):8.5
[ 5.8] Samples: 6 PM2.5: 307 PM10: 569 StdDev(PM2.5):9.8
...
[54.2] Samples:55 PM2.5: 315 PM10: 568 StdDev(PM2.5):7.5
[55.2] Samples:56 PM2.5: 313 PM10: 569 StdDev(PM2.5):7.6
[56.2] Samples:57 PM2.5: 312 PM10: 565 StdDev(PM2.5):7.6
[57.2] Samples:58 PM2.5: 311 PM10: 563 StdDev(PM2.5):7.7
[58.2] Samples:59 PM2.5: 315 PM10: 570 StdDev(PM2.5):7.7
[59.2] Samples:60 PM2.5: 316 PM10: 572 StdDev(PM2.5):7.7
Posting 673 bytes -> 200 OK 
Data posting ok!
upload queue(...): all done.
[ 0.0] Samples: 1 PM2.5: 313 PM10: 567 StdDev(PM2.5):0.0
[ 1.0] Samples: 2 PM2.5: 312 PM10: 567 StdDev(PM2.5):0.5

sds-sensor-reader's People

Contributors

ronanj avatar

Watchers

 avatar  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.