Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.5 (build 3282) - 23 February 2024

Cumulus MX V4 beta test release 4.0.0 (build 4017) - 17 March 2024

Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Hitchhiking with the Airlink interface of CMX

Discussion of the Cumulusutils tool and website generator.

Moderator: HansR

User avatar
HansR
Posts: 5831
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

Hitchhiking with the Airlink interface of CMX

Post by HansR »

In August I wrote about some sensor work I was doing and shortly after (roughly 12 hrs) ConligWX wrote about the AirLink. Apparently the AirLink was to be added to CMX as a sensor.

So version 3.9.0 of CMX did get the AirLink interface. I had been thinking this over and it became clear that interfacing to CMX to get the particle concentration data of any particle sensor would not have to be too difficult. So after a short exchange with Mark, I decided to build an interface to CMX (which polls the AirLink) and create a FakeAirLink. After a proof of concept I made a simple but workable application.

If you like working with hardware, have a Raspberry and want to spend some 35 euro on sensors, than I have the software to make it work.
And of course, CumulusUtils will soon support the AirLink (both the real and the fake) as well.

I published the code and you can find the release there as well under the tag (take the most recent).
The Readme should get you started. Other sensors are possible, ask for it (and send me one) and I'll implement if possible.

Git repository here, with code and release and info.
For general info on AirQuality, sensors and AQI interpretation I wrote a separate post.

NB: Although this is slightly a home built device (why I wrote the first message in the Homebuilt forum), the project turned towards CMX as the AirLink became available and a supported device for the Cumulus World. I had already planned to make an AirQuality module for CumulusUtils so combining all this, I decided to make this message in the CumulusUtils part of the forum. It fits. Homebuilt is too separate.
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Hitchhiking with the Airlink interface of CMX

Post by Phil23 »

Interesting Han's,

I've actually got a pair of Sensiron SPS30 Sensors here. Have had various thoughts on what to do with them but never proceeded.

Have two rPi's on hand, a couple of Arduino's & dozens of Micromites.

It was Micromite where I was originally planning to go, in particular adding it into an existing VOC Air Quality monitor I built.

VOC I found to be very interesting after building the unit, in particular the degrading of the air quality of a closed bedroom at night with poor ventilation.
VOC's increased during the night & found the peak to correspond with when my sleep was disrupted.
Also it proved a point that the VOC's pooled from the floor up as they increased in the room.

That could be another interesting sensor to add, cheap as chips, only catch is it requires a warm up period & a bit of a calibration routine occasionally.

Cheers

Phil.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
User avatar
HansR
Posts: 5831
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

Re: Hitchhiking with the Airlink interface of CMX

Post by HansR »

@Phil:
Yes, the sensirion is a very well known sensor, I may add it some time. A bit more complex interface but otherwise principally pretty much the same as the PMS1003 I did implement. The Micromites system is interesting, a microcosmos in itself. Never seen it before, might be useful for using analogue sensors such as indeed the VOC or other gas sensors. It adds another layer of coding and complexity but still. I'll look at it in more detail.

Thanks for the reply and the suggestions.
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
Phil23
Posts: 884
Joined: Sat 16 Jul 2016 11:59 pm
Weather Station: Davis VP2+ & GW1000 (Standalone)
Operating System: Win10 Pro / rPi Buster
Location: Australia

Re: Hitchhiking with the Airlink interface of CMX

Post by Phil23 »

HansR wrote: Sun 15 Nov 2020 6:39 am The Micromites system is interesting, a microcosmos in itself.
There is good support for most interfaces. I actually run 17 temp sensors here over 3 devices which integrate in the end.
There is also a version that runs on rPi, but it would need an additional A/D interface module to read analogue sensors.
:Now: :Today/Yesterday:

Image

Main Station Davis VP2+ Running Via Win10 Pro.
Secondary Stations, Ecowitt HP2551/GW1000 Via rPi 3 & 4 Running Buster GUI.
:Local Inverell Ecowitt Station: :Remote Ashford Ecowitt Station:
ExperiMentor
Posts: 214
Joined: Tue 24 Nov 2015 11:30 pm
Weather Station: Fine Offset & Davis Vantage Vue
Operating System: Windows 10; Raspbian Buster
Location: Switzerland

Re: Hitchhiking with the Airlink interface of CMX

Post by ExperiMentor »

Hans, Can you reccomend a cost-effective sensor?
User avatar
HansR
Posts: 5831
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

Re: Hitchhiking with the Airlink interface of CMX

Post by HansR »

Not really. It also depends on what you want to sense ;)

For PM sensor I am very happy with my PMSxyyy sensors. Cheap and workable. Lots of literature.
The SPS30 is very well known, proven but a bit more expensive
For temp/hum the SHT sensors (used by Davis) are very well proven and not too expensive)
If you want pressure as well you might want to go for the BME280
If you want to add VOC you might want to have the BME680.

And so on... not to talk about inside or outside and temp/hum correction.
It is not all that straight forward and requires some study and especially: what do you want to measure?
So many sensors.... I can't even start to have preference. And then I am not even talking about gas sensors (NO2, SO2 etc...)

Choices need to be your own.
Important is you know HOW to read the sensor, to store the data and how to present it.
Cost of the sensor is not the issue these days.
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
ExperiMentor
Posts: 214
Joined: Tue 24 Nov 2015 11:30 pm
Weather Station: Fine Offset & Davis Vantage Vue
Operating System: Windows 10; Raspbian Buster
Location: Switzerland

Re: Hitchhiking with the Airlink interface of CMX

Post by ExperiMentor »

Thanks for the great introduction - I need to get more into this, had no idea there was so much easily available and cheaply! I had thought the discussion was mainly about PM but guess it would be good to put together a full array for wide-ranging air quaity measurement. I can feel a project coming on!
User avatar
HansR
Posts: 5831
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

Re: Hitchhiking with the Airlink interface of CMX

Post by HansR »

Because WeatherDuino now has an AirQuality sensor module which actually does exactly the same as what I came up with (including mimicking the Airlink and using Sensor Community) I decided to stop this development. I wasn't doing too much anyway :|
If you want something like this: go for the AQM III.
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
watsonm
Posts: 208
Joined: Sun 03 Jan 2016 3:39 pm
Weather Station: N96GY -but like Triggers Broom!!
Operating System: Raspberry Pi4 Vers:11 Bullseye
Location: Poundbury, Dorset

Re: Hitchhiking with the Airlink interface of CMX

Post by watsonm »

Hans,
I have the PMS5003 and have it running on my Raspberry pi (indoors). All I am doing is getting the pm1, pm2.5 and pm10 data points
and sending them to CMX as extra Air quality sensors points 1, 2 and 3.

Is your Air link emulator processing the instant data to get the 1hr, 3hr, 24hr data points as I presume that is what is needed to post to CMX.

cheers Mike
(note for a change I am posting to forum rather than a private note! :D )
Regards Mike
Image
Raspberry Pi 4 Bullseye
Directly connected : BMP388 pressure sensor. DHT22 For internal Humidity/temp Sensor. PMS5003 Particle Sensor
Wireless connected: 3 (WS2083)Temp TXr's, WH57 Lightning Sensor, FO Solar sensor
User avatar
HansR
Posts: 5831
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

Re: Hitchhiking with the Airlink interface of CMX

Post by HansR »

watsonm wrote: Sun 07 Aug 2022 10:36 am Hans,
I have the PMS5003 and have it running on my Raspberry pi (indoors). All I am doing is getting the pm1, pm2.5 and pm10 data points
and sending them to CMX as extra Air quality sensors points 1, 2 and 3.

Is your Air link emulator processing the instant data to get the 1hr, 3hr, 24hr data points as I presume that is what is needed to post to CMX.

cheers Mike
(note for a change I am posting to forum rather than a private note! :D )
Yes, it is and it sends the data to CMX through the webserver.

The bad news is that I assume the PMS5003 is different from the PMS1003 which is the only one I implemented so it would require some adaptation for that device unless it reacts the same to the same commands as the PMS1003.

The badder news even is that the library I built the AirLink Emulator (RaspberrySharp by JTrotta) has been abandoned by its creator and replaced by the Microsoft System libraries e.g.

Code: Select all

    using System.IO;
    using System.Device.Gpio;
    using System.Device.I2c;
    using System.Device.Spi;
    using System.Threading;
    using Iot.Device.Sht3x;
    using Iot.Device.Bmxx80;
Which are written for .NET

I did look into it to change the libraries but that requires quite some work so it has been dropped for the moment. Nevertheless, the original is on github and could be used if you wish. You could also take out the webserver part and use that in your own piece of code of you wish.

Any program able to read the PMS5003 could easily implement the (or a) webserver be it in Python or in the Arduino IDE (which has several webservers available on the net. But it requires some programming and engineering. My code can be used as an example and or source.
Hans

https://meteo-wagenborgen.nl
CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
watsonm
Posts: 208
Joined: Sun 03 Jan 2016 3:39 pm
Weather Station: N96GY -but like Triggers Broom!!
Operating System: Raspberry Pi4 Vers:11 Bullseye
Location: Poundbury, Dorset

Re: Hitchhiking with the Airlink interface of CMX

Post by watsonm »

Hans,

I have created the code for getting the 1hr and 3hr avergae of the air quality and am trying to get it
into CMX -> extra sensors-> Airlink page. Looking at your EmulateAirlink.cs I see you using code like:

Code: Select all

"pm_2p5_last_1_hour\":{thisAirLink.PM25_last_1_hourList.Average():F2}," );
"pm_2p5_last_3_hours\":{thisAirLink.PM25_last_3_hourList.Average():F2}," );
"pm_2p5_last_24_hours\":{thisAirLink.PM25_last_24_hourList.Average():F2}," );
"pm_2p5_nowcast\"

I am using http post to input my data and none of this data appears in the Airlink page. Other weather data in the string appears correctly. I am not sure weather I need to set or clear any check boxexes in the CMX -> settings-> extra Sensor -> Air Quality or Davis Airlink pages

Part of my http posting line:

Code: Select all

 'pm25_ch3': '8', 'pm_2p5': '8', 'pm_10': '8', 'pm_2p5_last_1_hour': 8.0, 'pm_2p5_last_3_hours': 8.0, 
The 'pm25_ch3': '8', appears in the correct spot in the extra sensors page but the
'pm_2p5_last_1_hour': 8.0, does not appear anywhere in the Airlink page.

Am I using the correct tag in 'pm_2p5_last_1_hour'
Regards Mike
Image
Raspberry Pi 4 Bullseye
Directly connected : BMP388 pressure sensor. DHT22 For internal Humidity/temp Sensor. PMS5003 Particle Sensor
Wireless connected: 3 (WS2083)Temp TXr's, WH57 Lightning Sensor, FO Solar sensor
User avatar
HansR
Posts: 5831
Joined: Sat 20 Oct 2012 6:53 am
Weather Station: GW1100 (WS80/WH40)
Operating System: Raspberry OS/Bullseye
Location: Wagenborgen (NL)
Contact:

Re: Hitchhiking with the Airlink interface of CMX

Post by HansR »

watsonm wrote: Sun 07 Aug 2022 2:12 pm I have created the code for getting the 1hr and 3hr avergae of the air quality and am trying to get it
into CMX -> extra sensors-> Airlink page. Looking at your EmulateAirlink.cs I see you using code like:

Code: Select all

"pm_2p5_last_1_hour\":{thisAirLink.PM25_last_1_hourList.Average():F2}," );
"pm_2p5_last_3_hours\":{thisAirLink.PM25_last_3_hourList.Average():F2}," );
"pm_2p5_last_24_hours\":{thisAirLink.PM25_last_24_hourList.Average():F2}," );
"pm_2p5_nowcast\"

I am using http post to input my data and none of this data appears in the Airlink page. Other weather data in the string appears correctly. I am not sure weather I need to set or clear any check boxexes in the CMX -> settings-> extra Sensor -> Air Quality or Davis Airlink pages

Part of my http posting line:

Code: Select all

 'pm25_ch3': '8', 'pm_2p5': '8', 'pm_10': '8', 'pm_2p5_last_1_hour': 8.0, 'pm_2p5_last_3_hours': 8.0, 
The 'pm25_ch3': '8', appears in the correct spot in the extra sensors page but the
'pm_2p5_last_1_hour': 8.0, does not appear anywhere in the Airlink page.

Am I using the correct tag in 'pm_2p5_last_1_hour'
Mike, it need some more accurate steps, see points below:

1) You need to configure an AirLink in CMX. Since you are emulation an airlink, skip all official Davis required data, just input what CMX needs, see the screenshot below of my configuration (of course IP and station name must be yours). For an emulator you only need to set the indoor/outdoor tick and then the IP address and the AirLink hostname you use:
    Schermafbeelding 2022-08-07 164943.jpg
      2) The above configures CMX to send a request to the AirLink every requested interval. It does so according to the Davis spec. So if you put

      Code: Select all

      http://<airlink-ip-address-here>/v1/current_conditions
      in your browser the response will be the structure with all data. Your AirLink emulator needs to create such structure with the data you assembled and send it back to CMX in response. I don't think POST will do the trick (but do try, I never did), I think you really need to use a webserver which waits for a request and replies and sets out a new request.

      3) I don't know what language you are using but either you have to create that webserver yourself like I did or you need to find a library which does that part for you. If you do it in C# you can use my code, but no doubt that modern languages will have some webserver lib hanging around on the web.

      4) You can check the CMX logfile to see what it gets back on the AirLink request. That string must be equal to what you see when you put the request-string in the browser.

      5) The data which you do not wish to supply (temperature, nowcast or whatever) still needs to be present in the reply you send to CMX, it needs to be a complete answer (I think although Mark may be able to tell you what happens if certain data are missing). If you don't have temperature, set it to some value which will be accepted, start with 0 and see what happens ;) Note that Temp MUST be in Fahrenheit!

      6) Don't put the values in quotes. It is just a JSON structure so visual checks are easy and because you assemble it in the code with some trial and error you will quickly create the correct json-string.

      That's it. Not so difficult but the trick lies in the async webserver code.

      Good luck!
      You do not have the required permissions to view the files attached to this post.
      Hans

      https://meteo-wagenborgen.nl
      CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
      User avatar
      HansR
      Posts: 5831
      Joined: Sat 20 Oct 2012 6:53 am
      Weather Station: GW1100 (WS80/WH40)
      Operating System: Raspberry OS/Bullseye
      Location: Wagenborgen (NL)
      Contact:

      Re: Hitchhiking with the Airlink interface of CMX

      Post by HansR »

      And re-reading you post with the line you send it seems to me you are actually mixing the AirLink configuration with an Ecowitt Extra Sensor configuration. Is that correct?
      Hans

      https://meteo-wagenborgen.nl
      CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
      watsonm
      Posts: 208
      Joined: Sun 03 Jan 2016 3:39 pm
      Weather Station: N96GY -but like Triggers Broom!!
      Operating System: Raspberry Pi4 Vers:11 Bullseye
      Location: Poundbury, Dorset

      Re: Hitchhiking with the Airlink interface of CMX

      Post by watsonm »

      Hans,

      Yes I was trying to but decided that (at the moment) I don't want to build the AIRlink emulator in python. I
      was hoping I could just http post it to the table after I did the 1hr 3hr calculations.

      Instead I have decided to add the current readings as extra AQ sensor 1 and 2 and the one and
      three hour as 5 , 6, 7 and 8 while I think about it!! :shock:
      Regards Mike
      Image
      Raspberry Pi 4 Bullseye
      Directly connected : BMP388 pressure sensor. DHT22 For internal Humidity/temp Sensor. PMS5003 Particle Sensor
      Wireless connected: 3 (WS2083)Temp TXr's, WH57 Lightning Sensor, FO Solar sensor
      User avatar
      HansR
      Posts: 5831
      Joined: Sat 20 Oct 2012 6:53 am
      Weather Station: GW1100 (WS80/WH40)
      Operating System: Raspberry OS/Bullseye
      Location: Wagenborgen (NL)
      Contact:

      Re: Hitchhiking with the Airlink interface of CMX

      Post by HansR »

      OK
      Hans

      https://meteo-wagenborgen.nl
      CMX build 4017+ ● RPi 3B+ ● Raspbian Linux 6.1.21-v7+ armv7l ● dotnet 8.0.3
      Post Reply