Skip to content

Commit

Permalink
hardware v5 smoggie-kit
Browse files Browse the repository at this point in the history
  • Loading branch information
uradmonitor committed Aug 2, 2022
1 parent 6bc1a1a commit 51c5c49
Show file tree
Hide file tree
Showing 103 changed files with 1,362,975 additions and 734,022 deletions.
46 changes: 0 additions & 46 deletions code/smoggie/aux.h

This file was deleted.

27 changes: 7 additions & 20 deletions code/smoggie/calibration.cpp
Original file line number Diff line number Diff line change
@@ -1,28 +1,15 @@
/**
* Project: uRADMonitor model A/A2/A3/INDUSTRIAL, part of Global environmental monitoring network
* Web: www.uradmonitor.com
* License: Proprietary, all rights reserved.
*
* License: GPL v3
* Project: SMOGGIE is an ultra-low cost automated air quality monitor with a rain proof enclosure and a simple mount system to make installation easy.
* It features a high quality laser scatering Particulate Matter sensor for PM1, PM2.5 and PM10 and an additional sensor for temperature, pressure and humidity.
* It connects to the internet via Wifi and can be powered by a standard 5V micro-usb cable. Readings are accessed via the uRADMonitor API or decentralized via your local network. This monitor is lab tested for data accuracy.
* This file contains proprietary information which may be legally privileged. Any unauthorized use or dissemination is prohibited.
* It is for the intended recipient only. If you are not the intended recipient you must not use, disclose, distribute, copy or print this file.
*
* Copyright 2013-2015 Radu Motisan, [email protected]
* Copyright 2015-2021 Magnasci SRL, www.magnasci.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* Copyright 2013-2015 Radu Motisan, [email protected]
* Copyright 2015-2018 Magnasci SRL, www.magnasci.com
**/


#include "calibration.h"
#include "config.h"
// temperature, pressure, humidity, voc, co2, ch2o, pm25, noise, pm1, pm10, o3, ze03s1, ze03s2, ze03s3, ze03s4
Expand Down
30 changes: 9 additions & 21 deletions code/smoggie/calibration.h
Original file line number Diff line number Diff line change
@@ -1,30 +1,18 @@
/**
* Project: uRADMonitor model A/A2/A3/INDUSTRIAL, part of Global environmental monitoring network
* Web: www.uradmonitor.com
* License: Proprietary, all rights reserved.
*
* License: GPL v3
* Project: SMOGGIE is an ultra-low cost automated air quality monitor with a rain proof enclosure and a simple mount system to make installation easy.
* It features a high quality laser scatering Particulate Matter sensor for PM1, PM2.5 and PM10 and an additional sensor for temperature, pressure and humidity.
* It connects to the internet via Wifi and can be powered by a standard 5V micro-usb cable. Readings are accessed via the uRADMonitor API or decentralized via your local network. This monitor is lab tested for data accuracy.
* This file contains proprietary information which may be legally privileged. Any unauthorized use or dissemination is prohibited.
* It is for the intended recipient only. If you are not the intended recipient you must not use, disclose, distribute, copy or print this file.
*
* Copyright 2013-2015 Radu Motisan, [email protected]
* Copyright 2015-2021 Magnasci SRL, www.magnasci.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* Copyright 2013-2015 Radu Motisan, [email protected]
* Copyright 2015-2020 Magnasci SRL, www.magnasci.com
**/

#pragma once
#include <stdint.h>
#include "aux.h"
#include "misc.h"



Expand Down
75 changes: 8 additions & 67 deletions code/smoggie/config.h
Original file line number Diff line number Diff line change
@@ -1,30 +1,6 @@
/**
*
* License: GPL v3
* Project: SMOGGIE is an ultra-low cost automated air quality monitor with a rain proof enclosure and a simple mount system to make installation easy.
* It features a high quality laser scatering Particulate Matter sensor for PM1, PM2.5 and PM10 and an additional sensor for temperature, pressure and humidity.
* It connects to the internet via Wifi and can be powered by a standard 5V micro-usb cable. Readings are accessed via the uRADMonitor API or decentralized via your local network. This monitor is lab tested for data accuracy.
*
* Copyright 2013-2015 Radu Motisan, [email protected]
* Copyright 2015-2021 Magnasci SRL, www.magnasci.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
**/

#pragma once

#define VER_SW 22
#define VER_SW 25



Expand All @@ -36,46 +12,11 @@
#include <EEPROM.h>
#include <Wire.h>

#define SMOGGIE_PM 0x16
#define SMOGGIE_CO2 0x17
#define SMOGGIE_CH2O 0x18
#define SMOGGIE_O3 0x19
#define SMOGGIE_GAS 0x1A
#define SMOGGIE_RADON 0x1D
#define MODEL_A3 0x82
#define MODEL_NOISE 0x1E
#define SMOGGIE_PM_KIT 0x20

// device config
//#include "src/config/devices-16/16000XXX_PMSA003_generic.h"
//#include "src/config/devices-16/16000XXX_PMS1003_generic.h"
//#include "src/config/devices-16/16000XXX_PMS3003_generic.h"
//#include "src/config/devices-16/16000XXX_PMS9003M_generic.h"
//#include "src/config/devices-16/16000XXX_PMS5003_generic.h"
//#include "src/config/devices-16/16000XXX_PMS6003_generic.h"
//#include "src/config/devices-16/16000XXX_PM2009_generic.h"
//#include "src/config/devices-16/16000XXX_ZH03A_generic.h"
//#include "src/config/devices-16/16000XXX_SDS11_generic.h"
//#include "src/config/devices-16/16000XXX_SDS18_generic.h"
//#include "src/config/devices-16/16000XXX_MIX6071_generic.h"
//#include "src/config/devices-16/16000XXX_MIX6070_generic.h"
// --- CO2
//#include "src/config/devices-17/17000015.h" // SMOGGIE-CO2
//#include "src/config/devices-17/17000XXX_CM1106.h" // SMOGGIE-CO2-CUBIC
//#include "src/config/devices-17/17000XXX_CM1107.h" // SMOGGIE-CO2-CUBIC
//#include "src/config/devices-17/17000XXX_MHZ19B.h" // SMOGGIE-CO2-WINSEN/MIXSEN
//#include "src/config/devices-17/17000XXX_MIX6010.h" // SMOGGIE-CO2-/MIXSEN

//-- GAS
#include "src/config/devices-1A/1A000XXX.h" // SMOGGIE-GAS
//#include "src/config/devices-1D/1D0000XX_generic.h" // RADON
//#include "src/config/devices-82/820001D3.h" // MODEL-A3 PM

//-- NOISE
//#include "src/config/devices-1E/1E000XXX_SM7901.h" // MODEL NOISE
//#include "src/config/devices-1E/1E000XXX_DIGINOISE.h" // MODEL NOISE


#define DEFAULT_DEV_NUMBER 0x3
#include "src/config/devices-20/2000XXX_PMS5003_generic.h"


//#define DEBUG

Expand All @@ -84,7 +25,7 @@



#include "aux.h"
#include "misc.h"
#include "Calibration.h"
#include "limits.h"

Expand All @@ -96,7 +37,7 @@ typedef struct {
uint8_t flag_mute; // 1
uint16_t disableap; // 2
uint8_t flag_encrypt;

char ssid[64]; // 64
char key[64]; // 64
char userid[64]; // 64
Expand All @@ -105,7 +46,7 @@ typedef struct {
char ownkey[64];
char server[64];
char script[64];

uint32_t cal[CAL_VALUES]; // 60B: CAL_VALUES * 4 size, concatenated as AABB for ax+b

} t_settings; // total:
67 changes: 38 additions & 29 deletions code/smoggie/data_client.cpp
Original file line number Diff line number Diff line change
@@ -1,31 +1,3 @@
/**
*
* License: GPL v3
* Project: SMOGGIE is an ultra-low cost automated air quality monitor with a rain proof enclosure and a simple mount system to make installation easy.
* It features a high quality laser scatering Particulate Matter sensor for PM1, PM2.5 and PM10 and an additional sensor for temperature, pressure and humidity.
* It connects to the internet via Wifi and can be powered by a standard 5V micro-usb cable. Readings are accessed via the uRADMonitor API or decentralized via your local network. This monitor is lab tested for data accuracy.
*
* Copyright 2013-2015 Radu Motisan, [email protected]
* Copyright 2015-2021 Magnasci SRL, www.magnasci.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
**/


// TODO : This file should be customised to send the data to your end point. A new release on Github will implement the uRADMonitor DIDAP: device with no allocated ID - Dynamic ID Allocation Protocol.
// Note: DIDAP is already on Github in the uRADMonitor KIT1 repo.

#include "data_client.h"
#include <Arduino.h>

Expand All @@ -37,5 +9,42 @@ void DataClient::init(uradmonitor *urad, char *buf, uint16_t len) {

// HTTP Post to uRADMonitor server
bool DataClient::sendData() {

//Serial.println("sending");
// prepare data
m_urad->data.packData(m_urad->settings.flag_encrypt, m_buf, m_len, m_urad->getDeviceID(), m_urad->sec, VER_HW, VER_SW);
//Serial.printf("Prep send [%s][did:%08lX]\n", m_buf, m_urad->getDeviceID());
// send it via EX protocol
if ( client.connect(m_urad->settings.server, 80)) {
// build HTTP packet
client.print("POST "); client.print(m_urad->settings.script); client.print("/");
client.print(m_buf); client.println(" HTTP/1.1");
client.print("Host: "); client.println(m_urad->settings.server);
client.println("Accept: */*");
client.println("Content-Length: 0");
client.printf("X-User-id: %s\r\n", m_urad->settings.userid);
client.printf("X-User-hash: %s\r\n", m_urad->settings.userkey);
client.printf("X-Device-id: %08lX\r\n", m_urad->getDeviceID());
client.println("Content-Type: text/plain");
client.println("Connection: close");
client.println();

// read answer
int n = 0;
char value[20] = {0};
uint16_t code = 0;
while (n = client.readBytesUntil('\n', m_buf, m_len - 1)) {
m_buf[n] = 0;
if (find(m_buf, "HTTP/", " ", " ", value, 20))
code = atoi(value);
//Serial.printf("(%s)[%s]\n", value, m_buf);
if (strchr(m_buf, '{') && strchr(m_buf, '}'))
m_urad->callback_answer(code, m_buf);
}

client.stop();
return true;
} else {
//Serial.println("can't connect");
return false;
}
}
24 changes: 0 additions & 24 deletions code/smoggie/data_client.h
Original file line number Diff line number Diff line change
@@ -1,27 +1,3 @@
/**
*
* License: GPL v3
* Project: SMOGGIE is an ultra-low cost automated air quality monitor with a rain proof enclosure and a simple mount system to make installation easy.
* It features a high quality laser scatering Particulate Matter sensor for PM1, PM2.5 and PM10 and an additional sensor for temperature, pressure and humidity.
* It connects to the internet via Wifi and can be powered by a standard 5V micro-usb cable. Readings are accessed via the uRADMonitor API or decentralized via your local network. This monitor is lab tested for data accuracy.
*
* Copyright 2013-2015 Radu Motisan, [email protected]
* Copyright 2015-2021 Magnasci SRL, www.magnasci.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
**/

#pragma once

#include "uradmonitor.h"
Expand Down
26 changes: 1 addition & 25 deletions code/smoggie/limits.h
Original file line number Diff line number Diff line change
@@ -1,30 +1,6 @@
/**
*
* License: GPL v3
* Project: SMOGGIE is an ultra-low cost automated air quality monitor with a rain proof enclosure and a simple mount system to make installation easy.
* It features a high quality laser scatering Particulate Matter sensor for PM1, PM2.5 and PM10 and an additional sensor for temperature, pressure and humidity.
* It connects to the internet via Wifi and can be powered by a standard 5V micro-usb cable. Readings are accessed via the uRADMonitor API or decentralized via your local network. This monitor is lab tested for data accuracy.
*
* Copyright 2013-2015 Radu Motisan, [email protected]
* Copyright 2015-2021 Magnasci SRL, www.magnasci.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
**/

#pragma once

#if DEV_CLASS == SMOGGIE_PM || DEV_CLASS == MODEL_A3
#if DEV_CLASS == SMOGGIE_PM || DEV_CLASS == MODEL_A3 || DEV_CLASS == SMOGGIE_PM_KIT
#define LIMIT_GREEN 25
#define LIMIT_YELLOW 70
#elif DEV_CLASS == SMOGGIE_CO2
Expand Down
27 changes: 1 addition & 26 deletions code/smoggie/aux.cpp → code/smoggie/misc.cpp
Original file line number Diff line number Diff line change
@@ -1,29 +1,4 @@
/**
*
* License: GPL v3
* Project: SMOGGIE is an ultra-low cost automated air quality monitor with a rain proof enclosure and a simple mount system to make installation easy.
* It features a high quality laser scatering Particulate Matter sensor for PM1, PM2.5 and PM10 and an additional sensor for temperature, pressure and humidity.
* It connects to the internet via Wifi and can be powered by a standard 5V micro-usb cable. Readings are accessed via the uRADMonitor API or decentralized via your local network. This monitor is lab tested for data accuracy.
*
* Copyright 2013-2015 Radu Motisan, [email protected]
* Copyright 2015-2021 Magnasci SRL, www.magnasci.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program 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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
**/


#include "aux.h"
#include "misc.h"
#include <string.h>
#include <math.h>

Expand Down
Loading

0 comments on commit 51c5c49

Please sign in to comment.