mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-19 19:52:08 +02:00
Updated library to work with ESP8266 board manager version 3.0.0
This commit is contained in:
@ -11,7 +11,7 @@
|
|||||||
#include <SoftwareSerial.h>
|
#include <SoftwareSerial.h>
|
||||||
#include "Arduino.h"
|
#include "Arduino.h"
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <Math.h>
|
#include <math.h>
|
||||||
|
|
||||||
|
|
||||||
// Constructor /////////////////////////////////////////////////////////////////
|
// Constructor /////////////////////////////////////////////////////////////////
|
||||||
|
@ -3,6 +3,6 @@ AirGradient Arduino Library for ESP8266 (Wemos D1 MINI)
|
|||||||
|
|
||||||
Build your own low cost air quality sensor with optional display measuring PM2.5, CO2, Temperature and Humidity.
|
Build your own low cost air quality sensor with optional display measuring PM2.5, CO2, Temperature and Humidity.
|
||||||
|
|
||||||
This library makes it easy to read the sensor data from the Plantower PMS5003 PM2.5 sensor, the Senseair S8 and the SHT30/31 Temperature and Humidity sensor. Visit our blog for detailed build instructions and PCB layout.
|
This library makes it easy to read the sensor data from the Plantower PMS5003 PM2.5 sensor, the Senseair S8 and the SHT30/31 Temperature and Humidity sensor. Visit our DIY section for detailed build instructions and PCB layout.
|
||||||
|
|
||||||
https://www.airgradient.com/blog/
|
https://www.airgradient.com/diy/
|
||||||
|
BIN
examples/C02_PM_SHT/.DS_Store
vendored
BIN
examples/C02_PM_SHT/.DS_Store
vendored
Binary file not shown.
@ -10,11 +10,11 @@ Plantower PMS5003 (Fine Particle Sensor)
|
|||||||
SenseAir S8 (CO2 Sensor)
|
SenseAir S8 (CO2 Sensor)
|
||||||
SHT30/31 (Temperature/Humidity Sensor)
|
SHT30/31 (Temperature/Humidity Sensor)
|
||||||
|
|
||||||
Dependent Libraries:
|
Please install ESP8266 board manager (tested with version 3.0.0)
|
||||||
|
|
||||||
The codes needs the following libraries installed:
|
The codes needs the following libraries installed:
|
||||||
ESP8266 board with standard libraries
|
"WifiManager by tzapu, tablatronix" tested with Version 2.0.3-alpha
|
||||||
WifiManager by tzar, tablatronix tested with Version 2.0.3-alpha
|
"ESP8266 and ESP32 OLED driver for SSD1306 displays by ThingPulse, Fabrice Weinberg" tested with Version 4.1.0
|
||||||
ESP8266 and ESP32 OLED driver for SSD1306 displays by ThingPulse, Fabrice Weinberg tested with Version 4.1.0
|
|
||||||
|
|
||||||
Configuration:
|
Configuration:
|
||||||
Please set in the code below which sensor you are using and if you want to connect it to WiFi.
|
Please set in the code below which sensor you are using and if you want to connect it to WiFi.
|
||||||
@ -99,8 +99,9 @@ void loop(){
|
|||||||
Serial.println(payload);
|
Serial.println(payload);
|
||||||
String POSTURL = APIROOT + "sensors/airgradient:" + String(ESP.getChipId(),HEX) + "/measures";
|
String POSTURL = APIROOT + "sensors/airgradient:" + String(ESP.getChipId(),HEX) + "/measures";
|
||||||
Serial.println(POSTURL);
|
Serial.println(POSTURL);
|
||||||
|
WiFiClient client;
|
||||||
HTTPClient http;
|
HTTPClient http;
|
||||||
http.begin(POSTURL);
|
http.begin(client, POSTURL);
|
||||||
http.addHeader("content-type", "application/json");
|
http.addHeader("content-type", "application/json");
|
||||||
int httpCode = http.POST(payload);
|
int httpCode = http.POST(payload);
|
||||||
String response = http.getString();
|
String response = http.getString();
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
This is the code for the AirGradient DIY Air Quality Sensor with an ESP8266 Microcontroller.
|
||||||
|
|
||||||
|
It is a high quality sensor showing PM2.5, CO2, Temperature and Humidity on a small display and can send data over Wifi.
|
||||||
|
|
||||||
|
For build instructions please visit https://www.airgradient.com/diy/
|
||||||
|
|
||||||
|
Compatible with the following sensors:
|
||||||
|
SenseAir S8 (CO2 Sensor)
|
||||||
|
|
||||||
|
Please install ESP8266 board manager (tested with version 3.0.0)
|
||||||
|
|
||||||
|
If you are a school or university contact us for a free trial on the AirGradient platform.
|
||||||
|
https://www.airgradient.com/schools/
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
#include <AirGradient.h>
|
#include <AirGradient.h>
|
||||||
AirGradient ag = AirGradient();
|
AirGradient ag = AirGradient();
|
||||||
|
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
#include <AirGradient.h>
|
|
||||||
AirGradient ag = AirGradient();
|
|
||||||
|
|
||||||
void setup(){
|
|
||||||
Serial.begin(9600);
|
|
||||||
ag.MHZ19_Init(MHZ19B);
|
|
||||||
}
|
|
||||||
|
|
||||||
void loop(){
|
|
||||||
|
|
||||||
int MHZ19_C02 = ag.readMHZ19();
|
|
||||||
Serial.print("C02: ");
|
|
||||||
Serial.println(MHZ19_C02);
|
|
||||||
|
|
||||||
delay(5000);
|
|
||||||
}
|
|
@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
This is the code for the AirGradient DIY Air Quality Sensor with an ESP8266 Microcontroller.
|
||||||
|
|
||||||
|
It is a high quality sensor showing PM2.5, CO2, Temperature and Humidity on a small display and can send data over Wifi.
|
||||||
|
|
||||||
|
For build instructions please visit https://www.airgradient.com/diy/
|
||||||
|
|
||||||
|
Compatible with the following sensors:
|
||||||
|
Plantower PMS5003 (Fine Particle Sensor)
|
||||||
|
|
||||||
|
Please install ESP8266 board manager (tested with version 3.0.0)
|
||||||
|
|
||||||
|
If you are a school or university contact us for a free trial on the AirGradient platform.
|
||||||
|
https://www.airgradient.com/schools/
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
#include <AirGradient.h>
|
#include <AirGradient.h>
|
||||||
AirGradient ag = AirGradient();
|
AirGradient ag = AirGradient();
|
||||||
|
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
This is the code for the AirGradient DIY Air Quality Sensor with an ESP8266 Microcontroller.
|
||||||
|
|
||||||
|
It is a high quality sensor showing PM2.5, CO2, Temperature and Humidity on a small display and can send data over Wifi.
|
||||||
|
|
||||||
|
For build instructions please visit https://www.airgradient.com/diy/
|
||||||
|
|
||||||
|
Compatible with the following sensors:
|
||||||
|
SHT30/31 (Temperature/Humidity Sensor)
|
||||||
|
|
||||||
|
Please install ESP8266 board manager (tested with version 3.0.0)
|
||||||
|
|
||||||
|
If you are a school or university contact us for a free trial on the AirGradient platform.
|
||||||
|
https://www.airgradient.com/schools/
|
||||||
|
|
||||||
|
MIT License
|
||||||
|
*/
|
||||||
|
|
||||||
#include <AirGradient.h>
|
#include <AirGradient.h>
|
||||||
AirGradient ag = AirGradient();
|
AirGradient ag = AirGradient();
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name=AirGradient Air Quality Sensor
|
name=AirGradient Air Quality Sensor
|
||||||
version=1.3.4
|
version=1.3.5
|
||||||
author=AirGradient <support@airgradient.com>
|
author=AirGradient <support@airgradient.com>
|
||||||
maintainer=AirGradient <support@airgradient.com>
|
maintainer=AirGradient <support@airgradient.com>
|
||||||
sentence=ESP8266 library for an air quality sensor featuring PM2.5, CO2, Temperature and Humidity with OLED display.
|
sentence=ESP8266 library for an air quality sensor featuring PM2.5, CO2, Temperature and Humidity with OLED display.
|
||||||
|
41
readme.txt
41
readme.txt
@ -1,39 +1,8 @@
|
|||||||
This is an example C++ library for Arduino 0004+, based on one created by
|
AirGradient Arduino Library for ESP8266 (Wemos D1 MINI)
|
||||||
Nicholas Zambetti for Wiring 0006+
|
=====================================================================================================
|
||||||
|
|
||||||
Installation
|
Build your own low cost air quality sensor with optional display measuring PM2.5, CO2, Temperature and Humidity.
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
To install this library, just place this entire folder as a subfolder in your
|
This library makes it easy to read the sensor data from the Plantower PMS5003 PM2.5 sensor, the Senseair S8 and the SHT30/31 Temperature and Humidity sensor. Visit our DIY section for detailed build instructions and PCB layout.
|
||||||
Arduino/lib/targets/libraries folder.
|
|
||||||
|
|
||||||
When installed, this library should look like:
|
|
||||||
|
|
||||||
Arduino/lib/targets/libraries/Test (this library's folder)
|
|
||||||
Arduino/lib/targets/libraries/Test/Test.cpp (the library implementation file)
|
|
||||||
Arduino/lib/targets/libraries/Test/Test.h (the library description file)
|
|
||||||
Arduino/lib/targets/libraries/Test/keywords.txt (the syntax coloring file)
|
|
||||||
Arduino/lib/targets/libraries/Test/examples (the examples in the "open" menu)
|
|
||||||
Arduino/lib/targets/libraries/Test/readme.txt (this file)
|
|
||||||
|
|
||||||
Building
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
After this library is installed, you just have to start the Arduino application.
|
|
||||||
You may see a few warning messages as it's built.
|
|
||||||
|
|
||||||
To use this library in a sketch, go to the Sketch | Import Library menu and
|
|
||||||
select Test. This will add a corresponding line to the top of your sketch:
|
|
||||||
#include <Test.h>
|
|
||||||
|
|
||||||
To stop using this library, delete that line from your sketch.
|
|
||||||
|
|
||||||
Geeky information:
|
|
||||||
After a successful build of this library, a new file named "Test.o" will appear
|
|
||||||
in "Arduino/lib/targets/libraries/Test". This file is the built/compiled library
|
|
||||||
code.
|
|
||||||
|
|
||||||
If you choose to modify the code for this library (i.e. "Test.cpp" or "Test.h"),
|
|
||||||
then you must first 'unbuild' this library by deleting the "Test.o" file. The
|
|
||||||
new "Test.o" with your code will appear after the next press of "verify"
|
|
||||||
|
|
||||||
|
https://www.airgradient.com/diy/
|
||||||
|
Reference in New Issue
Block a user