Author Topic: Make your own Purpleair  (Read 4309 times)

0 Members and 1 Guest are viewing this topic.

Offline azchrisf

  • Cobra Weather Dominator Operator
  • Senior Contributor
  • ****
  • Posts: 238
    • Copperwood WX
Make your own Purpleair
« on: February 13, 2018, 08:20:56 AM »
I cam across this article on Adafruit - it's about the Arduino and the same Plantower sensor Purpleair uses.
If you wanted to make a sh**-ton of these things, you could probably do it cheaper.

Here's the article:
https://learn.adafruit.com/pm25-air-quality-sensor

Online wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1279
    • My PWS at Leuven Belgium Europe
Re: Make your own Purpleair
« Reply #1 on: February 13, 2018, 09:13:58 AM »
I cam across this article on Adafruit - it's about the Arduino and the same Plantower sensor Purpleair uses.
If you wanted to make a sh**-ton of these things, you could probably do it cheaper.

Here's the article:
https://learn.adafruit.com/pm25-air-quality-sensor
Or use this one, the "luftdaten" sensor, already hundreds of stations in Europe, how-to-build in multiple languages (sorry the English version is not the best one), Open-Data, Open-source of all scripts via Github.

One big map and multiple local = city wide maps such as Leuven or Brussels
In my home town of Leuven-Belgium they = the inhabitants,  are rolling out a hundred of these sensors.
I have one  on my own website also, on the home page a small expandable block and a full page at http://weer.sluispark.be/index.php?p=mnu_aqhi_luft&lang=en

The scripts used,  look the same as for the Purpleair,check this  user site and also the normal AQ scripts as used in the US at this demo site

The sensors plus arduino board cost less then 30 dollar and there is a shopping-list with links to the ali*** chiness site.

There are a few users in Northern America also. it is becoming quit a success here as multiple cities sponsor this development by organising how-to-build workshops a.s.o.

Wim
Development and maintenance of Leuven-Template&Scripts  at: https://support.leuven-template.eu/
My PWS at home https://weer.sluispark.be/
And at my daughters house https://www.weerstation-herent.be/

Offline azchrisf

  • Cobra Weather Dominator Operator
  • Senior Contributor
  • ****
  • Posts: 238
    • Copperwood WX
Re: Make your own Purpleair
« Reply #2 on: February 13, 2018, 09:23:09 AM »
That's quite interesting.
Where are the script source? I'd love to look at them and see if they can improve the Purpleair one I released.

Offline SLOweather

  • Administrator
  • Forecaster
  • *****
  • Posts: 3435
    • http://www.sloweather.com
Re: Make your own Purpleair
« Reply #3 on: February 13, 2018, 09:29:02 AM »
That's quite interesting.
Where are the script source? I'd love to look at them and see if they can improve the Purpleair one I released.

https://github.com/opendata-stuttgart ?

Offline droiddk

  • Senior Contributor
  • ****
  • Posts: 235
Re: Make your own Purpleair
« Reply #4 on: February 13, 2018, 09:52:24 AM »
Or use this one, the "luftdaten" sensor

Hi, can you supply link for the Hardware?

Is it this one: https://luftdaten.info/feinstaubsensor-bauen/ ?

Regards

Online wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1279
    • My PWS at Leuven Belgium Europe
Re: Make your own Purpleair
« Reply #5 on: February 13, 2018, 09:54:55 AM »
That's quite interesting.
Where are the script source? I'd love to look at them and see if they can improve the Purpleair one I released.

https://github.com/opendata-stuttgart ?
Thanks, that is the most important one. All city wide nets use those scripts also to build their own versions. But the arduino code remains the same.
The sensor can upload to the two main sites, API Luftdaten.info for the sensor database and API Madavi.de for the graphs.
Then there are pre-set uploads to OpenSenseMap and api.luftdaten.info, for which  you have to set your own credentials.

And most important, every 2 1/2 minute measurement (pm2.5/pm10/temp/hum)  can be uploaded to your own website also. Or to a local/city site. The website script which receives the data, can re-upload the data to another site a.s.o.  The uploaded JSON with the  sensor measurements  can be saved as is, and / or converted to CSV and / or saved in a 24/hr csv.  Probably someone also made a version to store the data in a DB.

For the users here in Leuven, one big plus (beside the price) is the open-source. Every line of the code can be checked. Also automatic firmware updates can be switched off.

I attach a copy of the config page of the sensor which you address locally by IP and has its own webserver with multiple pages.

Wim
« Last Edit: February 13, 2018, 10:01:07 AM by wvdkuil »
Development and maintenance of Leuven-Template&Scripts  at: https://support.leuven-template.eu/
My PWS at home https://weer.sluispark.be/
And at my daughters house https://www.weerstation-herent.be/

Online wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1279
    • My PWS at Leuven Belgium Europe
Re: Make your own Purpleair
« Reply #6 on: February 13, 2018, 09:56:41 AM »
Or use this one, the "luftdaten" sensor

Hi, can you supply link for the Hardware?

Is it this one: https://luftdaten.info/feinstaubsensor-bauen/ ?

Regards
https://luftdaten.info/en/construction-manual/ is the almost all english one. Only the shopping list part is still untranslated. Below that it is english.
Wim
Development and maintenance of Leuven-Template&Scripts  at: https://support.leuven-template.eu/
My PWS at home https://weer.sluispark.be/
And at my daughters house https://www.weerstation-herent.be/

Offline droiddk

  • Senior Contributor
  • ****
  • Posts: 235
Re: Make your own Purpleair
« Reply #7 on: February 13, 2018, 09:58:13 AM »
Or use this one, the "luftdaten" sensor

Hi, can you supply link for the Hardware?

Is it this one: https://luftdaten.info/feinstaubsensor-bauen/ ?

Regards
https://luftdaten.info/en/construction-manual/ is the almost all english one. Only the shopping list part is still untranslated. Below that it is english.
Wim

Thanks

Offline Toxic

  • Senior Contributor
  • ****
  • Posts: 260
  • #conligwx
    • conligwx.org
Re: Make your own Purpleair
« Reply #8 on: February 13, 2018, 10:04:36 AM »
« Last Edit: February 13, 2018, 10:16:41 AM by Toxic »

Offline SLOweather

  • Administrator
  • Forecaster
  • *****
  • Posts: 3435
    • http://www.sloweather.com
Re: Make your own Purpleair
« Reply #9 on: March 09, 2018, 12:05:24 PM »
These were out of stock when I read this post. I put myself on the "back in-stock" notification. I received the notification Monday, and ordered one that day. At the time, they had 73 in stock. I received shipping notification Tuesday, and received the Plantower device yesterday.

In checking the Adafruit site this morning, they are already out of stock again.

Just hooked it up this morning and it works well with the demo script.

I cam across this article on Adafruit - it's about the Arduino and the same Plantower sensor Purpleair uses.
If you wanted to make a sh**-ton of these things, you could probably do it cheaper.

Here's the article:
https://learn.adafruit.com/pm25-air-quality-sensor

Offline blacklistedcard

  • Member
  • *
  • Posts: 39
Re: Make your own Purpleair
« Reply #10 on: March 23, 2018, 10:38:54 AM »
Should get my unit today.  They are back in stock. Is everyone just using the hackair scripts/code?

Offline blacklistedcard

  • Member
  • *
  • Posts: 39
Re: Make your own Purpleair
« Reply #11 on: March 23, 2018, 03:12:34 PM »
I got my parts.  Let's see if I can get it up and running.

Offline azchrisf

  • Cobra Weather Dominator Operator
  • Senior Contributor
  • ****
  • Posts: 238
    • Copperwood WX
Re: Make your own Purpleair
« Reply #12 on: March 23, 2018, 03:16:38 PM »
Should be pretty straightforward. Good luck and let us know how it goes!

Sent from my Pixel using Tapatalk


Offline blacklistedcard

  • Member
  • *
  • Posts: 39
Re: Make your own Purpleair
« Reply #13 on: March 24, 2018, 01:30:02 PM »
I got it working.   I had to change the Wemos  example to get it running with the Adafruit ESP8266.  I still have to figure why my DHT22 sensor is not working, but itís running live right now. 

Offline blacklistedcard

  • Member
  • *
  • Posts: 39
Re: Make your own Purpleair
« Reply #14 on: March 25, 2018, 07:24:10 PM »
I got everything going with HackAir.   The Adafruit HUZZAH ESP8266, Adafruit DHT22 and the Plantower PMS5003 with the breakout board.
I like the Android application.....

Here is the output form the serial monitor....

*WM: AutoConnect
*WM: Connecting as wifi client...
*WM: Using last saved values, should be faster
*WM: Connection result:
*WM: 0
*WM: SET AP STA
*WM:
*WM: Configuring access point...
*WM: Adafruit-HUZZAH-ESP8266
*WM: AP IP address:
*WM: 192.168.4.1
*WM: HTTP server started
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Scan done
*WM: MY-NETWORK
*WM: -59
*WM: HP-Print-31-Deskjet 2540 series
*WM: -90
*WM: BELL900
*WM: -90
*WM: Sent config page
*WM: Request redirected to captive portal
*WM: Handle root
*WM: Request redirected to captive portal
*WM: Handle root
*WM: WiFi save
*WM: Sent wifi save page
*WM: Connecting to new AP
*WM: Connecting as wifi client...
*WM: Connection result:
*WM: 3
The Adafruit HUZZAH ESP8266 Air Quality Sensor is connected to the 2.4ghz wireless network!!!
The Adafruit HUZZAH ESP8266 Air Quality Sensor local IP address is: 192.168.1.249
The Adafruit DHT22 sensor humidity reading is: 16.40%
The Adafruit HUZZAH ESP8266 Air Quality Sensor has connected to the HackAir server successfully!!!
{"reading":{"PM2.5_AirPollutantValue":"2.00","PM10_AirPollutantValue":"2.00"},"battery":"6.90","tamper":"0","error":"0"}
HTTP/1.1 201 Created
Server: nginx/1.13.0
Date: Sun, 25 Mar 2018 22:54:38 GMT
Content-Type: application/json
Content-Length: 1190
Connection: close
Vary: Authorization
X-Powered-By: PHP/5.6.30
Cache-Control: private, must-revalidate
ETag: "03c55ce4c668e93389d5b739907b65f30d67d994"
Strict-Transport-Security: max-age=31536000

{"code":201,"status":"success","count":2,"resources":[{"pollutant_q":{"name":"PM2.5_AirPollutantValue","value":"2.00","unit":"mg"},"pollutant_i":{"name":"PM2.5_AirPollutantIndex","index":"perfect"},"city":"","loc":{"type":"Point","coordinates":[-XX.184753894806,XX.761821406998]},"datetime":{"$date":{"$numberLong":"1522018478000"}},"date_str":"2018-03-25T22:54:38.000Z","source_type":"sensors_arduino","source_info":{"user":{"id":1189,"username":"ME"},"sensor":{"id":467,"battery":6,"tamper":0,"error":0}},"updated_at":"2018-03-25 22:54:38","created_at":"2018-03-25 22:54:38","_id":"5ab828ae2f702f036a4ebfca"},{"pollutant_q":{"name":"PM10_AirPollutantValue","value":"2.00","unit":"mg"},"pollutant_i":{"name":"PM10_AirPollutantIndex","index":"perfect"},"city":"","loc":{"type":"Point","coordinates":[-XX.184753894806,XX.761821406998]},"datetime":{"$date":{"$numberLong":"1522018478000"}},"date_str":"2018-03-25T22:54:38.000Z","source_type":"sensors_arduino","source_info":{"user":{"id":1189,"username":"ME"},"sensor":{"id":467,"battery":6,"tamper":0,"error":0}},"updated_at":"2018-03-25 22:54:38","created_at":"2018-03-25 22:54:38","_id":"5ab828ae2f702f036a4ebfcb"}],"message":null}
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 57425
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 67425
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 77426
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 87426
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 97426
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 107426
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 117426
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 127426
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 137426
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 147427
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 157427
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 167427
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 177427
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 187427
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 197427
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 207427
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 217428
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 227428
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 237428
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 247428
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 257428
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 267428
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 277428
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 287431
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 297431
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 307431
The Adafruit DHT22 sensor humidity reading is: 16.50%
The Adafruit HUZZAH ESP8266 Air Quality Sensor has connected to the HackAir server successfully!!!
{"reading":{"PM2.5_AirPollutantValue":"2.00","PM10_AirPollutantValue":"2.00"},"battery":"6.94","tamper":"0","error":"0"}
HTTP/1.1 201 Created
Server: nginx/1.13.0
Date: Sun, 25 Mar 2018 22:59:02 GMT
Content-Type: application/json
Content-Length: 1190
Connection: close
Vary: Authorization
X-Powered-By: PHP/5.6.30
Cache-Control: private, must-revalidate
ETag: "b52165342ca7e2d51d8e44e567e2121031fd80ce"
Strict-Transport-Security: max-age=31536000

{"code":201,"status":"success","count":2,"resources":[{"pollutant_q":{"name":"PM2.5_AirPollutantValue","value":"2.00","unit":"mg"},"pollutant_i":{"name":"PM2.5_AirPollutantIndex","index":"perfect"},"city":"","loc":{"type":"Point","coordinates":[-XX.184753894806,XX.761821406998]},"datetime":{"$date":{"$numberLong":"1522018742000"}},"date_str":"2018-03-25T22:59:02.000Z","source_type":"sensors_arduino","source_info":{"user":{"id":1189,"username":"ME"},"sensor":{"id":467,"battery":6,"tamper":0,"error":0}},"updated_at":"2018-03-25 22:59:02","created_at":"2018-03-25 22:59:02","_id":"5ab829b62f702f7f696d0f8c"},{"pollutant_q":{"name":"PM10_AirPollutantValue","value":"2.00","unit":"mg"},"pollutant_i":{"name":"PM10_AirPollutantIndex","index":"perfect"},"city":"","loc":{"type":"Point","coordinates":[-XX.184753894806,XX.761821406998]},"datetime":{"$date":{"$numberLong":"1522018742000"}},"date_str":"2018-03-25T22:59:02.000Z","source_type":"sensors_arduino","source_info":{"user":{"id":1189,"username":"ME"},"sensor":{"id":467,"battery":6,"tamper":0,"error":0}},"updated_at":"2018-03-25 22:59:02","created_at":"2018-03-25 22:59:02","_id":"5ab829b62f702f7f696d0f8d"}],"message":null}
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 321293
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 331293
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 341294
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 351294
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 361294
The Plantower PMS5003 and Adafruit DHT22 sensors are turned off and sleeping: 371294





Offline blacklistedcard

  • Member
  • *
  • Posts: 39
Re: Make your own Purpleair
« Reply #15 on: March 26, 2018, 06:13:35 PM »
Working on the code for power saving mode with the Planower PMS5003 module.   With the HackAir code, it's missing.....

Dwaine

Offline blacklistedcard

  • Member
  • *
  • Posts: 39
Re: Make your own Purpleair
« Reply #16 on: March 27, 2018, 02:19:03 AM »
I got the power saving mode working with 30 second warm up period. 

Offline azchrisf

  • Cobra Weather Dominator Operator
  • Senior Contributor
  • ****
  • Posts: 238
    • Copperwood WX
Re: Make your own Purpleair
« Reply #17 on: March 27, 2018, 03:10:13 AM »
When you finish up make sure to share your code, I'm sure it will make a lot of people happy to not have to reinvent the wheel

Great job so far definitely following!

Sent from my Pixel using Tapatalk

Offline blacklistedcard

  • Member
  • *
  • Posts: 39
Re: Make your own Purpleair
« Reply #18 on: March 27, 2018, 04:25:18 AM »
When you finish up make sure to share your code, I'm sure it will make a lot of people happy to not have to reinvent the wheel

Great job so far definitely following!

Sent from my Pixel using Tapatalk

Pretty much finished it.   The only problem is the map does not reflect any updated measurements.   Under my Hackair profile it has all the received measurements perfectly fine.  No issue, but you look at the map it only has the first measurement when the sensor was first created.  I sent the Hackair people an email asking what the problem is. 

Itís a funny problem.  I think something is broken on their end.   

Offline blacklistedcard

  • Member
  • *
  • Posts: 39
Re: Make your own Purpleair
« Reply #19 on: March 27, 2018, 04:34:53 AM »
The Hackair map......

Offline blacklistedcard

  • Member
  • *
  • Posts: 39
Re: Make your own Purpleair
« Reply #20 on: March 30, 2018, 05:59:27 AM »
I have opened up an issue with hackair about the non existing updates on the map with sensor(s) updates.   Another user confirmed the same situation with their sensor.   I'm also adding RGB LED lighting to my project.  The RGB LEDS will match the sensor readings and adjust the colour.

Offline safuser

  • Member
  • *
  • Posts: 18
Re: Make your own Purpleair
« Reply #21 on: March 31, 2018, 07:43:00 PM »
Is your code posted anywhere?  I am doing something very similar, just with a PMS7003 and a DHT35 sensor.

Offline blacklistedcard

  • Member
  • *
  • Posts: 39
Re: Make your own Purpleair
« Reply #22 on: April 01, 2018, 02:29:07 AM »
I just used their code and changed the pin configurations and compiled.  Right now I'm just waiting for my RGB LEDS to show up.

Offline blacklistedcard

  • Member
  • *
  • Posts: 39
Re: Make your own Purpleair
« Reply #23 on: April 01, 2018, 02:32:07 AM »
I have been working on my enclosure for the sensors.  I found a nice led at home Depot and will hook up RGB LEDs to show a visual status of the air quality. 

It will be some addition Arduino code added to the firmware.

Offline blacklistedcard

  • Member
  • *
  • Posts: 39
Re: Make your own Purpleair
« Reply #24 on: April 01, 2018, 03:32:00 AM »
Here is a picture of the LED on to get a better understanding of the lighting.

It will be nice just to look at the sensor and know the air quality.