Guide to publishing Shinyei sensor data on the World Air Quality Index project

Note. The content on this page is outdated.
For the most recent upload API document, go to https://aqicn.org/data-feed/upload-api/

This page is made for those interrested in measuring Air Quality based on the Shinyei sensor. For more information about the Shinyei sensor, please refer to this on-going experiment page: sensor/shinyei/.


--

Hardware Setup

For this experiement, the hardware used to retrieve the data from the Shinyei Sensor is a PC Duino - but any Raspberry PI would also work fine.

All which is needed, on the PC Duino side, to extract the information from the Shinyei sensor is two digital input. In our configuration, we use the GPIO6 and GPIO7 from the PC Duino. Since the PC duino also provide a 5V output, we directly power supply the SHinyei from the Pc Duino pins.

For now, threshold input (IN1) is left unsed, but it will be used later as a way to split particule by size, and hence detect both PM10 and PM2.5 particules.

Scripts

The scripts are available online from github. They are based on the Air Quality data-upload API described at api/sensor.

To run the scripts, you just need to use this simple command: python shinyei-lpo-reader.py. It will output data in the following style:

 $ python shinyei-lpo-reader.py

16:51:27: 13.02 9.27
16:51:32: 10.15 3.03
16:51:37: 8.58 1.86
16:51:42: 8.97 1.01
16:51:47: 8.32 1.05
16:51:52: 8.22 1.05
16:51:57: 7.33 0.75
16:52:02: 6.72 0.75
16:52:07: 6.05 0.75
16:52:12: 6.4 0.75
16:52:17: 7.13 0.75
--- 16:52:22 --- 0.073053159646 0.00751250729585 ---
Posting {'type': 'shinyei-pdp42ns-1u', 'unit': 'lpo', 'value': 0.07305315964603189} {'type': 'shinyei-pdp42ns-2.5u', 'unit': 'lpo', 'value': 0.007512507295851456} -> 200 OK
Server says {u'sensorID': u'589', u'result': u'ok', u'dataids': [2835085, 2835086]}
Firs column is obviously the current time. The second and third column are the measured LPO (in percentage, from 0 to 100). The script measures the LPO over 1 minute, so the 'current' LPO indication will be displayed 10 times. The 1 minute average is displayed as '--- 16:52:22 --- 0.073053159646 0.00751250729585 ---' (unit from 0 to 1). After that, the averaged LPO is posted ( Posting {'type': 'shinyei-pdp42ns-1u', 'unit': 'lpo', 'value': 0.07305315964603189} {'type': 'shinyei-pdp42ns-2.5u', 'unit': 'lpo', 'value': 0.007512507295851456} -> 200 OK ) to the server.


--

Configuration

Once your setup is working, do not forget to use your own sensor ID, by replacing the value "shinyei.test-sensor" in the file shinyei-lpo-reader.py with your own sensor ID. Sensor ID can be any string, but we recommand to use the convention sensor-type.(location+).your-name, such as for instance shinyei.china.beijing.haidian.john-doe.

 uploader = AirQualityUploader("shinyei.test-sensor")
Once you have choosen your own sensor ID, do not forget to protect it by password so that no-one else but you can upload data. For that, you just need to contact us and let us the ID you want to protect. We will then provide you the password to be used.

--

Still to be done

There are sitll many things to be done. Si if you want to join us and support our work, here are some of the things which we need help for:
  • Hardware connectivity based on the Raspberry PI, Beagle Bonne and other IOT Hardware.
  • Use an intermediate arduino-like to poll and pre-process the data from the Shinyei.
  • Improve the python-scripts with fail-safe support (i.e. keep the data even though if there is no WIFI connection).




āĻŦāĻžāϝāĻŧ⧁āϰ āϗ⧁āĻŖāĻŽāĻžāύ āĻāĻŦāĻ‚ āĻĻā§‚āώāĻŖ āĻĒāϰāĻŋāĻŽāĻžāĻĒ āϏāĻŽā§āĻĒāĻ°ā§āϕ⧇:

āĻāϝāĻŧāĻžāϰ āϕ⧋āϝāĻŧāĻžāϞāĻŋāϟāĻŋ āϞ⧇āϭ⧇āϞ āϏāĻŽā§āĻĒāĻ°ā§āϕ⧇

- āĻāϝāĻŧāĻžāϰ āϕ⧋āϝāĻŧāĻžāϞāĻŋāϟāĻŋ āχāύāĻĄā§‡āĻ•ā§āϏ (AQI) āĻŽāĻžāύāĻ¸ā§āĻŦāĻžāĻ¸ā§āĻĨā§āϝ āωāĻĻā§āĻŦ⧇āϗ⧇āϰ āĻ¸ā§āϤāϰ
0 - 50 āĻ­āĻžāϞ āĻŦāĻžāϝāĻŧ⧁ āĻŽāĻžāύāϕ⧇ āϏāĻ¨ā§āϤ⧋āώāϜāύāĻ• āĻŦāϞ⧇ āĻŽāύ⧇ āĻ•āϰāĻž āĻšāĻšā§āϛ⧇, āĻāĻŦāĻ‚ āĻŦāĻžāϝāĻŧ⧁ āĻĻā§‚āώāϪ⧇āϰ āϜāĻ¨ā§āϝ⧇ āĻ…āϤāĻŋ āϏāĻžāĻŽāĻžāĻ¨ā§āϝ āĻŦāĻž āϕ⧋āύ āĻā§āρāĻ•āĻŋāχ āĻĨāĻžāĻ•āϛ⧇ āύāĻž
51 -100 āĻŽāĻ§ā§āϝāĻĒāĻ¨ā§āĻĨā§€ āĻŦāĻžā§Ÿā§āϰ āĻŽāĻžāύ āĻ—ā§āϰāĻšāĻŖāϝ⧋āĻ—ā§āϝ; āĻ•āĻŋāĻ¨ā§āϤ⧁, āĻ•āĻŋāϛ⧁ āĻĻā§‚āώāĻŖāĻ•āĻžāϰāϕ⧇āϰ āϜāĻ¨ā§āϝ āϖ⧁āĻŦ āĻ•āĻŽ āϏāĻ‚āĻ–ā§āϝāĻ• āĻŽāĻžāύ⧁āώ⧇āϰ āĻĒāĻ•ā§āώ⧇ āϏāĻžāĻŽāĻžāĻ¨ā§āϝ āĻ¸ā§āĻŦāĻžāĻ¸ā§āĻĨā§āϝ⧇āϰ āωāĻĻā§āĻŦ⧇āĻ— āĻĨāĻžāĻ•āϤ⧇ āĻĒāĻžāϰ⧇ āϝāĻžāϰāĻž āĻŦāĻžāϝāĻŧ⧁ āĻĻā§‚āώāϪ⧇āϰ āϜāĻ¨ā§āϝ āĻ…āĻ¸ā§āĻŦāĻžāĻ­āĻžāĻŦāĻŋāĻ• āĻ­āĻžāĻŦ⧇ āϏāĻ‚āĻŦ⧇āĻĻāύāĻļā§€āϞāĨ¤
101-150 āĻ…āĻ¸ā§āĻŦāĻžāĻ¸ā§āĻĨā§āϝāĻ•āϰ āϏāĻ‚āĻŦ⧇āĻĻāύāĻļā§€āϞ āĻ—ā§āϰ⧁āĻĒ⧇āϰ āϏāĻ‚āĻŦ⧇āĻĻāύāĻļā§€āϞ āĻ—ā§āϰ⧁āĻĒ⧇āϰ āϏāĻĻāĻ¸ā§āϝāϰāĻž āĻ¸ā§āĻŦāĻžāĻ¸ā§āĻĨā§āϝ⧇āϰ āĻĒā§āϰāĻ­āĻžāĻŦ āĻĢ⧇āϞāϤ⧇ āĻĒāĻžāϰ⧇āĨ¤ āϏāĻžāϧāĻžāϰāĻŖ āϜāύāĻ—āĻŖ āĻĒā§āϰāĻ­āĻžāĻŦāĻŋāϤ āĻšāϤ⧇ āĻĒāĻžāϰ⧇ āύāĻžāĨ¤
151-200 āĻ…āĻ¸ā§āĻŦāĻžāĻ¸ā§āĻĨā§āϝāĻ•āϰ āĻĒā§āϰāĻ¤ā§āϝ⧇āϕ⧇āϰāχ āĻ¸ā§āĻŦāĻžāĻ¸ā§āĻĨā§āϝ⧇āϰ āĻ“āĻĒāϰ āĻĒā§āϰāĻ­āĻžāĻŦ āĻĒāĻĄāĻŧāϤ⧇ āĻļ⧁āϰ⧁ āĻšāϤ⧇ āĻĒāĻžāϰ⧇; āϏāĻ‚āĻŦ⧇āĻĻāύāĻļā§€āϞ āĻ—ā§āϰ⧁āĻĒ⧇āϰ āϏāĻĻāĻ¸ā§āϝāϰāĻž āφāϰāĻ“ āϗ⧁āϰ⧁āϤāϰ āĻ¸ā§āĻŦāĻžāĻ¸ā§āĻĨā§āϝ⧇āϰ āĻ“āĻĒāϰ āĻĒā§āϰāĻ­āĻžāĻŦ āĻ…āύ⧁āĻ­āĻŦ āĻ•āϰāϤ⧇ āĻĒāĻžāϰ⧇āύāĨ¤
201-300 āϖ⧁āĻŦ āĻ…āĻ¸ā§āĻŦāĻžāĻ¸ā§āĻĨā§āϝāĻ•āϰ āϜāϰ⧁āϰāĻŋ āĻ…āĻŦāĻ¸ā§āĻĨāĻž āĻ¸ā§āĻŦāĻžāĻ¸ā§āĻĨā§āϝ āϏāϤāĻ°ā§āĻ•āϤāĻžāĨ¤ āϏāĻŽāĻ—ā§āϰ āϜāύāϏāĻ‚āĻ–ā§āϝāĻžāϰ āĻĒā§āϰāĻ­āĻžāĻŦāĻŋāϤ āĻšāϤ⧇ āĻĒāĻžāϰ⧇āĨ¤
300+ āĻŦāĻŋāĻĒāĻœā§āϜāύāĻ• āĻ¸ā§āĻŦāĻžāĻ¸ā§āĻĨā§āϝ āϏāϤāĻ°ā§āĻ•āϤāĻž: āĻĒā§āϰāĻ¤ā§āϝ⧇āϕ⧇āϰāχ āφāϰāĻ“ āϗ⧁āϰ⧁āϤāϰ āĻ¸ā§āĻŦāĻžāĻ¸ā§āĻĨā§āϝ⧇āϰ āĻĒā§āϰāĻ­āĻžāĻŦ āĻĒāĻĄāĻŧāϤ⧇ āĻĒāĻžāϰ⧇

āĻŦāĻžāϝāĻŧ⧁āϰ āϗ⧁āĻŖāĻŽāĻžāύ āĻāĻŦāĻ‚ āĻĻā§‚āώāĻŖ āϏāĻŽā§āĻĒāĻ°ā§āϕ⧇ āφāϰāĻ“ āϜāĻžāύāϤ⧇, āωāχāĻ•āĻŋāĻĒāĻŋāĻĄāĻŋāϝāĻŧāĻž āĻāϝāĻŧāĻžāϰ āϕ⧋āϝāĻŧāĻžāϞāĻŋāϟāĻŋ āĻŦāĻŋāώāϝāĻŧ āĻŦāĻž āĻŦāĻžāϝāĻŧ⧁āϰ āϗ⧁āĻŖāĻŽāĻžāύ āĻāĻŦāĻ‚ āφāĻĒāύāĻžāϰ āĻ¸ā§āĻŦāĻžāĻ¸ā§āĻĨā§āϝ⧇āϰ āϜāĻ¨ā§āϝ āĻāϝāĻŧāĻžāϰāύāĻžāω āĻ—āĻžāχāĻĄ āĻĻ⧇āϖ⧁āύāĨ¤

āĻŦ⧇āχāϜāĻŋāĻ‚ āĻĄāĻžāĻ•ā§āϤāĻžāϰ āϰāĻŋāϚāĻžāĻ°ā§āĻĄ āϏ⧇āĻ¨ā§āϟ āϏāĻžāχāϰ āĻāĻŽāĻĄāĻŋāϰ āϖ⧁āĻŦ āĻĻāϰāĻ•āĻžāϰ⧀ āĻ¸ā§āĻŦāĻžāĻ¸ā§āĻĨā§āϝ āĻĒāϰāĻžāĻŽāĻ°ā§āĻļ⧇āϰ āϜāĻ¨ā§āϝ, www.myhealthbeijing.com āĻŦā§āϞāĻ— āĻĻ⧇āϖ⧁āύāĨ¤


āĻŦā§āϝāĻŦāĻšāĻžāϰ⧇āϰ āύ⧋āϟāĻŋāĻļ: āĻĒā§āϰāĻ•āĻžāĻļāύāĻžāϰ āϏāĻŽāϝāĻŧ āϏāĻŽāĻ¸ā§āϤ āĻŦāĻžāϝāĻŧ⧁ āϗ⧁āĻŖāĻŽāĻžāύ āϤāĻĨā§āϝ āĻ…-āĻŦ⧈āϧ āĻšāϝāĻŧ āĻāĻŦāĻ‚ āϗ⧁āĻŖāĻŽāĻžāύ āύāĻŋāĻļā§āϚāĻŋāϤāĻ•āϰāϪ⧇āϰ āĻ•āĻžāϰāϪ⧇ āĻāχ āϤāĻĨā§āϝāϟāĻŋ āϝ⧇ āϕ⧋āύāĻ“ āϏāĻŽāϝāĻŧ⧇ āύ⧋āϟāĻŋāĻļ āĻ›āĻžāĻĄāĻŧāĻžāχ āϏāĻ‚āĻļā§‹āϧāύ āĻ•āϰāĻž āϝ⧇āϤ⧇ āĻĒāĻžāϰ⧇āĨ¤ āĻ“āϝāĻŧāĻžāĻ°ā§āĻ˛ā§āĻĄ āĻāϝāĻŧāĻžāϰ āϕ⧋āϝāĻŧāĻžāϞāĻŋāϟāĻŋ āχāύāĻĄā§‡āĻ•ā§āϏ āĻĒā§āϰāĻ•āĻ˛ā§āĻĒāϟāĻŋ āĻāχ āϤāĻĨā§āϝāϗ⧁āϞāĻŋāϰ āϏāĻžāĻŽāĻ—ā§āϰ⧀āϰ āĻŽāĻ§ā§āϝ⧇ āĻ•āĻŽā§āĻĒāĻžāχāϞ āĻ•āϰāĻžāϰ āϜāĻ¨ā§āϝ āϏāĻŽāĻ¸ā§āϤ āϝ⧁āĻ•ā§āϤāĻŋāϏāĻ™ā§āĻ—āϤ āĻĻāĻ•ā§āώāϤāĻž āĻ“ āϝāĻ¤ā§āύ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻ•āϰ⧇āϛ⧇ āĻāĻŦāĻ‚ āϕ⧋āύāĻ“ āĻĒāϰāĻŋāĻ¸ā§āĻĨāĻŋāϤāĻŋāϤ⧇ āĻāϟāĻŋ āĻ“āϝāĻŧāĻžāĻ°ā§āĻ˛ā§āĻĄ āĻāϝāĻŧāĻžāϰ āϕ⧋āϝāĻŧāĻžāϞāĻŋāϟāĻŋ āχāύāĻĄā§‡āĻ•ā§āϏ āĻĒā§āϰāĻ•āĻ˛ā§āĻĒ āĻĻāϞ āĻŦāĻž āϤāĻžāϰ āĻāĻœā§‡āĻ¨ā§āϟāϗ⧁āϞāĻŋ āĻāχ āϤāĻĨā§āϝ āϏāϰāĻŦāϰāĻžāĻš āĻĨ⧇āϕ⧇ āϏāϰāĻžāϏāϰāĻŋ āĻŦāĻž āĻĒāϰ⧋āĻ•ā§āώāĻ­āĻžāĻŦ⧇ āωāĻĻā§āĻ­ā§‚āϤ āϕ⧋āύ āĻ•ā§āώāϤāĻŋ, āφāϘāĻžāϤ āĻŦāĻž āĻ•ā§āώāϤāĻŋāϰ āϜāĻ¨ā§āϝ āϚ⧁āĻ•ā§āϤāĻŋ, āύāĻŋāĻ°ā§āϝāĻžāϤāύ āĻŦāĻž āĻ…āĻ¨ā§āϝāĻĨāĻžāϝāĻŧ āĻĻāĻžāϝāĻŧāĻŦāĻĻā§āϧāĨ¤



Settings


Language Settings:


Temperature unit:
Celcius