Commit 3e8489f2 authored by Frank Heuer's avatar Frank Heuer

Update README.md

parent 4914ea69
# Introduction # Introduction
This library named SDS011 is meant for implementing in Python software thats goal is to measure air particles of <=10µm and <=2.5µm with the particle senor SDS011 developed by Nova Fitness Co.,Ltd, http://inovafitness.com/en/ The module named **SDS011 implements much more features of the PM2.5/PM10 particle sensor than most other modules foud in the web. Sleeping mode, duty cycle, firmware and sensor id, to name some of them, are implemented.** You can implement it in Python software whos goal is to measure air particles of <=10µm (PM10) and <=2.5µm (PM2.5) with the sensor developed by **Nova Fitness Co.,Ltd**, http://inovafitness.com/en/.
# Goal
Most code I found in web only has implemented the permanent measureing when the sensor is in "no dutycycle mode" (the factory default). But the sensor has much more capabilities such as "going to sleep", dutycycles of about 1 to 30 minutes, two working modes and so forth. Most code I found in web only has implemented the permanent measureing when the sensor is in "no dutycycle mode" (the factory default). But the sensor has much more capabilities such as "going to sleep", dutycycles of about 1 to 30 minutes, two working modes and so forth.
So I decided to implement this feature in a python library in order to So I decided to implement this feature in a python library in order to
1. going to measure air pollution with a Raspberry Pi
2. learn to code python
3. learn using git
So this is my first python project so don't let it stop you from suggesting improvements.
First, you have to edit the logging configuration in top of SDS011.py to your needs.
1. going to measure air pollution with a Raspberry Pi
2. build some useful code for everyone
3. learn to code python
4. learn using git
So this is my first python project but don't be afraid. The code is tested and working.
Don't let it stop you from suggesting improvements.
# Get started..
Just plug in your sensor to USB, open test.py, edit the constructor call to your needs (the device_path) and run test.py in your console.
See how durty or clean the air is, you breath in every day.
# No warranty # No warranty
SDS011 is distributed in the hope that it will be useful, SDS011 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
# Some advices
The Sensor comes with a Windows software but can be used with raspberry pi on USB or GPIO by using the serial in and output channels.
Not knowing the power consumption of the sensor, it is unknown yet, if setting the sensor to sleep mode causes Raspberry Pi to collapse when switching to measureing mode again. **Might be that you have to use external power (i.e. a powered USB hub) on Raspberry Pi.**
# Basic usage (example): In order to use it on raspberry pi on GPIO you have to **ensure that no other serial communication is happening.**
import time
from sds011 import SDS011
sensor = SDS011("COM3") # Windows
or
sensor = SDS011("/dev/ttyAMA0") # Raspberry Pi
print(reader.device_id)
sensor.reportmode == sensor.ReportModes.Passiv
retval = sensor.request()
print(retval)
sensor.reportmode = sensor.ReportModes.Initiative
time.sleep(3)
values = sensor.get_values()
print(values[0], "--", values[1])
The Sensor comes with a Windows software but can be used with raspberry pi GPIO feature by using the serial in and output channels.
In order to use it on raspberry pi one has to ensure that no other serial communication is happening.
So in /boot/cmdline the line So in /boot/cmdline the line
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline rootwait
...@@ -57,7 +43,6 @@ So to disable getty just type ...@@ -57,7 +43,6 @@ So to disable getty just type
in your terminal or disable it in your terminal or disable it
">sudo systemctl disable serial-getty@ttyAMA0.service" ">sudo systemctl disable serial-getty@ttyAMA0.service"
---------------------------------------------
Copyright 2016, Frank Heuer, Germany Copyright 2016, Frank Heuer, Germany
SDS011 is free software: you can redistribute it and/or modify SDS011 is free software: you can redistribute it and/or modify
...@@ -65,11 +50,6 @@ it under the terms of the GNU General Public License as published by ...@@ -65,11 +50,6 @@ it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
SDS011 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with SDS011. If not, see <http://www.gnu.org/licenses/>. along with SDS011. If not, see <http://www.gnu.org/licenses/>.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment