Compare commits
2 Commits
267a5652aa
...
46ab4f7dbb
Author | SHA1 | Date |
---|---|---|
interfisch | 46ab4f7dbb | |
interfisch | 02c39822bc |
|
@ -1,4 +1,4 @@
|
||||||
|
#ifdef SENSOR_ANEMOMETER
|
||||||
#include "sensor_anemometer.h"
|
#include "sensor_anemometer.h"
|
||||||
|
|
||||||
//uses ATS177 Latched hall sensor for rotation sensing
|
//uses ATS177 Latched hall sensor for rotation sensing
|
||||||
|
@ -66,3 +66,5 @@ void Sensor_Anemometer::sensorloop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
#ifndef SENSOR_LDR_H
|
#ifndef SENSOR_LDR_H
|
||||||
#define SENSOR_LDR_H
|
#define SENSOR_LDR_H
|
||||||
|
|
||||||
|
@ -40,3 +41,4 @@ public:
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#ifdef SENSOR_MHZ19B
|
||||||
#include "sensor_mhz19b.h"
|
#include "sensor_mhz19b.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,3 +155,5 @@ int Sensor_MHZ19B::mhz19_readValue_reimplemented(Stream *_streamRef, MHZ19 *_mhz
|
||||||
void Sensor_MHZ19B::calibrateZero() {
|
void Sensor_MHZ19B::calibrateZero() {
|
||||||
mhz19->calibrateZero();
|
mhz19->calibrateZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -32,7 +32,6 @@ private:
|
||||||
#define BAUD_RATE_MHZ19 9600
|
#define BAUD_RATE_MHZ19 9600
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define MHZ19CALIBRATIONTOPIC
|
#define MHZ19CALIBRATIONTOPIC
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
|
#ifdef SENSOR_RAINGAUGE
|
||||||
#include "sensor_raingauge.h"
|
#include "sensor_raingauge.h"
|
||||||
|
|
||||||
//uses ATS177 Latched hall sensor for rotation sensing
|
//uses ATS177 Latched hall sensor for rotation sensing
|
||||||
|
@ -79,3 +79,5 @@ void Sensor_Raingauge::sensorloop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,5 +1,4 @@
|
||||||
//copied from example code: https://github.com/adafruit/Adafruit_TCS34725/blob/master/examples/tcs34725autorange/tcs34725autorange.ino
|
//copied from example code: https://github.com/adafruit/Adafruit_TCS34725/blob/master/examples/tcs34725autorange/tcs34725autorange.ino
|
||||||
#ifdef SENSOR_TCS34725
|
|
||||||
|
|
||||||
#ifndef _TCS34725_AGC_H_
|
#ifndef _TCS34725_AGC_H_
|
||||||
#define _TCS34725_AGC_H_
|
#define _TCS34725_AGC_H_
|
||||||
|
@ -47,5 +46,3 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
|
@ -83,31 +83,6 @@ lib_deps =
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#Test
|
|
||||||
[env:sensoresptest]
|
|
||||||
platform = espressif8266 @ 2.5.0
|
|
||||||
board = d1_mini
|
|
||||||
framework = arduino
|
|
||||||
|
|
||||||
monitor_port = /dev/ttyUSB0
|
|
||||||
monitor_speed = 115200
|
|
||||||
|
|
||||||
build_flags =
|
|
||||||
|
|
||||||
|
|
||||||
-D SENSOR_RADAR
|
|
||||||
-D SENSOR_RADAR_PIN=D5
|
|
||||||
-D SENSOR_RADAR_readdelay=100
|
|
||||||
-D SENSOR_RADAR_senddelaymax=1000*60*10
|
|
||||||
|
|
||||||
-D SENSOR_LDR
|
|
||||||
-D SENSOR_LDR_PIN=A0
|
|
||||||
-D SENSOR_LDR_CALIB_1
|
|
||||||
|
|
||||||
|
|
||||||
lib_deps =
|
|
||||||
ArduinoJson@6.16.1 #dependency of homie. using older version because of "ambiguous overload for operator|" error
|
|
||||||
Homie@3.0.0
|
|
||||||
|
|
||||||
#Arbeitszimmer
|
#Arbeitszimmer
|
||||||
[env:sensoresp1]
|
[env:sensoresp1]
|
||||||
|
@ -323,7 +298,7 @@ lib_deps =
|
||||||
Homie@3.0.0
|
Homie@3.0.0
|
||||||
claws/BH1750@1.1.4
|
claws/BH1750@1.1.4
|
||||||
|
|
||||||
#Kueche
|
#Badezimmer
|
||||||
[env:sensoresp7]
|
[env:sensoresp7]
|
||||||
platform = espressif8266 @ 2.5.0
|
platform = espressif8266 @ 2.5.0
|
||||||
board = d1_mini
|
board = d1_mini
|
||||||
|
@ -343,9 +318,11 @@ build_flags =
|
||||||
-D SENSOR_VL53L1X_senddelaymax=1000*30
|
-D SENSOR_VL53L1X_senddelaymax=1000*30
|
||||||
-D SENSOR_VL53L1X_readdelay=500
|
-D SENSOR_VL53L1X_readdelay=500
|
||||||
|
|
||||||
-D SENSOR_SHT31
|
-D SENSOR_HTU21D
|
||||||
-D SENSOR_SHT31_humidity_minchange=5
|
-D dataHTU21D_temperature_minchange=0.2
|
||||||
-D SENSOR_SHT31_temperature_minchange=0.5
|
-D dataHTU21D_temperature_senddelaymax=1000*60*30
|
||||||
|
-D dataHTU21D_humidity_minchange=1.0
|
||||||
|
-D dataHTU21D_humidity_senddelaymax=1000*60*30
|
||||||
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
Bounce2
|
Bounce2
|
||||||
|
@ -353,7 +330,7 @@ lib_deps =
|
||||||
ArduinoJson@6.16.1
|
ArduinoJson@6.16.1
|
||||||
marvinroger/Homie @ ^3.0.1
|
marvinroger/Homie @ ^3.0.1
|
||||||
pololu/VL53L1X @ ^1.3.0
|
pololu/VL53L1X @ ^1.3.0
|
||||||
adafruit/Adafruit SHT31 Library@^2.2.0
|
adafruit/Adafruit HTU21DF Library @ ^1.0.5
|
||||||
|
|
||||||
#3D Printer
|
#3D Printer
|
||||||
[env:sensoresp3dprinter]
|
[env:sensoresp3dprinter]
|
||||||
|
@ -379,3 +356,35 @@ lib_deps =
|
||||||
Homie@3.0.0
|
Homie@3.0.0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#Test
|
||||||
|
[env:sensoresptest]
|
||||||
|
platform = espressif8266 @ 2.5.0
|
||||||
|
board = d1_mini
|
||||||
|
framework = arduino
|
||||||
|
|
||||||
|
monitor_port = /dev/ttyUSB0
|
||||||
|
monitor_speed = 115200
|
||||||
|
|
||||||
|
build_flags =
|
||||||
|
|
||||||
|
-D SENSOR_HTU21D
|
||||||
|
-D dataHTU21D_temperature_minchange=0.2
|
||||||
|
-D dataHTU21D_temperature_senddelaymax=1000*60*30
|
||||||
|
-D dataHTU21D_humidity_minchange=1.0
|
||||||
|
-D dataHTU21D_humidity_senddelaymax=1000*60*30
|
||||||
|
|
||||||
|
|
||||||
|
-D SENSOR_TCS34725
|
||||||
|
-D SENSOR_TCS34725_LUX_minchange=500
|
||||||
|
-D SENSOR_TCS34725_LUX_senddelaymax=1000*60*1
|
||||||
|
-D SENSOR_TCS34725_COLORTEMP_minchange=100
|
||||||
|
-D SENSOR_TCS34725_LUXFACTOR=0.3 #measured with luxmeter. with half tennis ball was 1.7ev less. 1/2^1.7=0,3078
|
||||||
|
|
||||||
|
lib_deps =
|
||||||
|
ArduinoJson@6.16.1 #dependency of homie. using older version because of "ambiguous overload for operator|" error
|
||||||
|
Homie@3.0.0
|
||||||
|
adafruit/Adafruit HTU21DF Library @ ^1.0.5
|
||||||
|
https://github.com/adafruit/Adafruit_TCS34725#1.3.5
|
36
src/main.cpp
36
src/main.cpp
|
@ -32,7 +32,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
|
|
||||||
|
|
||||||
#ifdef SENSOR_DHT22
|
#ifdef SENSOR_DHT22
|
||||||
#include "sensor_dht22.cpp"
|
#include "sensor_dht22.h"
|
||||||
Sensor_DHT22 sensor_dht22(SENSOR_DHT22_PIN);
|
Sensor_DHT22 sensor_dht22(SENSOR_DHT22_PIN);
|
||||||
|
|
||||||
#ifndef SENSOR_DHT22_temperature_minchange
|
#ifndef SENSOR_DHT22_temperature_minchange
|
||||||
|
@ -58,7 +58,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
|
|
||||||
|
|
||||||
#ifdef SENSOR_BMP180
|
#ifdef SENSOR_BMP180
|
||||||
#include "sensor_bmp180.cpp"
|
#include "sensor_bmp180.h"
|
||||||
Sensor_BMP180 sensor_bmp180;
|
Sensor_BMP180 sensor_bmp180;
|
||||||
|
|
||||||
#ifndef SENSOR_BMP180_temperature_minchange
|
#ifndef SENSOR_BMP180_temperature_minchange
|
||||||
|
@ -83,7 +83,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SENSOR_HTU21D
|
#ifdef SENSOR_HTU21D
|
||||||
#include "sensor_htu21d.cpp"
|
#include "sensor_htu21d.h"
|
||||||
Sensor_HTU21D sensor_htu21d;
|
Sensor_HTU21D sensor_htu21d;
|
||||||
|
|
||||||
#ifndef SENSOR_HTU21D_temperature_minchange
|
#ifndef SENSOR_HTU21D_temperature_minchange
|
||||||
|
@ -110,7 +110,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
|
|
||||||
|
|
||||||
#ifdef SENSOR_SHT31
|
#ifdef SENSOR_SHT31
|
||||||
#include "sensor_sht31.cpp"
|
#include "sensor_sht31.h"
|
||||||
Sensor_SHT31 sensor_sht31;
|
Sensor_SHT31 sensor_sht31;
|
||||||
|
|
||||||
#ifndef SENSOR_SHT31_temperature_minchange
|
#ifndef SENSOR_SHT31_temperature_minchange
|
||||||
|
@ -136,7 +136,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SENSOR_HS1101
|
#ifdef SENSOR_HS1101
|
||||||
#include "sensor_hs1101.cpp"
|
#include "sensor_hs1101.h"
|
||||||
Sensor_HS1101 sensor_hs1101(SENSOR_HS1101_PIN);
|
Sensor_HS1101 sensor_hs1101(SENSOR_HS1101_PIN);
|
||||||
|
|
||||||
#ifndef SENSOR_HS1101_humidity_minchange
|
#ifndef SENSOR_HS1101_humidity_minchange
|
||||||
|
@ -152,7 +152,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SENSOR_BH1750
|
#ifdef SENSOR_BH1750
|
||||||
#include "sensor_bh1750.cpp"
|
#include "sensor_bh1750.h"
|
||||||
Sensor_BH1750 sensor_bh1750;
|
Sensor_BH1750 sensor_bh1750;
|
||||||
|
|
||||||
#ifndef SENSOR_BH1750_light_minchange
|
#ifndef SENSOR_BH1750_light_minchange
|
||||||
|
@ -167,7 +167,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SENSOR_ML8511
|
#ifdef SENSOR_ML8511
|
||||||
#include "sensor_ml8511.cpp"
|
#include "sensor_ml8511.h"
|
||||||
Sensor_ML8511 sensor_ml8511(SENSOR_ML8511_PIN);
|
Sensor_ML8511 sensor_ml8511(SENSOR_ML8511_PIN);
|
||||||
|
|
||||||
#ifndef SENSOR_ML8511_minchange
|
#ifndef SENSOR_ML8511_minchange
|
||||||
|
@ -183,7 +183,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
|
|
||||||
|
|
||||||
#ifdef SENSOR_HCSR501
|
#ifdef SENSOR_HCSR501
|
||||||
#include "sensor_hcsr501.cpp"
|
#include "sensor_hcsr501.h"
|
||||||
Sensor_HCSR501 sensor_hcsr501(SENSOR_HCSR501_PIN);
|
Sensor_HCSR501 sensor_hcsr501(SENSOR_HCSR501_PIN);
|
||||||
|
|
||||||
#ifndef SENSOR_HCSR501_senddelaymax
|
#ifndef SENSOR_HCSR501_senddelaymax
|
||||||
|
@ -195,7 +195,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SENSOR_RADAR
|
#ifdef SENSOR_RADAR
|
||||||
#include "sensor_radar.cpp"
|
#include "sensor_radar.h"
|
||||||
Sensor_Radar sensor_radar(SENSOR_RADAR_PIN);
|
Sensor_Radar sensor_radar(SENSOR_RADAR_PIN);
|
||||||
|
|
||||||
#ifndef SENSOR_RADAR_senddelaymax
|
#ifndef SENSOR_RADAR_senddelaymax
|
||||||
|
@ -207,7 +207,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SENSOR_LDR
|
#ifdef SENSOR_LDR
|
||||||
#include "sensor_ldr.cpp"
|
#include "sensor_ldr.h"
|
||||||
Sensor_LDR sensor_ldr(SENSOR_LDR_PIN);
|
Sensor_LDR sensor_ldr(SENSOR_LDR_PIN);
|
||||||
|
|
||||||
#ifndef SENSOR_LDR_minchange
|
#ifndef SENSOR_LDR_minchange
|
||||||
|
@ -259,7 +259,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
|
|
||||||
|
|
||||||
#ifdef SENSOR_SDS018
|
#ifdef SENSOR_SDS018
|
||||||
#include "sensor_sds018.cpp"
|
#include "sensor_sds018.h"
|
||||||
Sensor_SDS018 sensor_sds018(SENSOR_SDS018_SERIAL_RX,SENSOR_SDS018_SERIAL_TX);
|
Sensor_SDS018 sensor_sds018(SENSOR_SDS018_SERIAL_RX,SENSOR_SDS018_SERIAL_TX);
|
||||||
#ifndef SENSOR_SDS018_PM10_minchange
|
#ifndef SENSOR_SDS018_PM10_minchange
|
||||||
#define SENSOR_SDS018_PM10_minchange 10.0
|
#define SENSOR_SDS018_PM10_minchange 10.0
|
||||||
|
@ -282,7 +282,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SENSOR_TCS34725
|
#ifdef SENSOR_TCS34725
|
||||||
#include "sensor_tcs34725.cpp"
|
#include "sensor_tcs34725.h"
|
||||||
Sensor_TCS34725 sensor_tcs34725;
|
Sensor_TCS34725 sensor_tcs34725;
|
||||||
#ifndef SENSOR_TCS34725_LUX_minchange
|
#ifndef SENSOR_TCS34725_LUX_minchange
|
||||||
#define SENSOR_TCS34725_LUX_minchange 500
|
#define SENSOR_TCS34725_LUX_minchange 500
|
||||||
|
@ -305,7 +305,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SENSOR_VL53L1X
|
#ifdef SENSOR_VL53L1X
|
||||||
#include "sensor_vl53l1x.cpp"
|
#include "sensor_vl53l1x.h"
|
||||||
Sensor_VL53L1X sensor_vl53l1x;
|
Sensor_VL53L1X sensor_vl53l1x;
|
||||||
#ifndef SENSOR_VL53L1X_minchange
|
#ifndef SENSOR_VL53L1X_minchange
|
||||||
#define SENSOR_VL53L1X_minchange 100
|
#define SENSOR_VL53L1X_minchange 100
|
||||||
|
@ -321,6 +321,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
#ifdef SENSOR_ANEMOMETER
|
#ifdef SENSOR_ANEMOMETER
|
||||||
void ICACHE_RAM_ATTR interrupt_anemometer();
|
void ICACHE_RAM_ATTR interrupt_anemometer();
|
||||||
#include "sensor_anemometer.cpp"
|
#include "sensor_anemometer.cpp"
|
||||||
|
|
||||||
//Sensor_Anemometer_Instance = new Sensor_Anemometer(SENSOR_Anemometer_PIN);
|
//Sensor_Anemometer_Instance = new Sensor_Anemometer(SENSOR_Anemometer_PIN);
|
||||||
Sensor_Anemometer sensor_anemometer(SENSOR_Anemometer_PIN);
|
Sensor_Anemometer sensor_anemometer(SENSOR_Anemometer_PIN);
|
||||||
|
|
||||||
|
@ -333,6 +334,9 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef SENSOR_Anemometer_minchange
|
#ifndef SENSOR_Anemometer_minchange
|
||||||
#define SENSOR_Anemometer_minchange 0.25
|
#define SENSOR_Anemometer_minchange 0.25
|
||||||
#endif
|
#endif
|
||||||
|
@ -345,12 +349,14 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SENSOR_RAINGAUGE
|
#ifdef SENSOR_RAINGAUGE
|
||||||
|
|
||||||
//uses ATS177 Latched Hall Sensor for rauge flip sensing
|
//uses ATS177 Latched Hall Sensor for rauge flip sensing
|
||||||
void ICACHE_RAM_ATTR interrupt_raingauge();
|
void ICACHE_RAM_ATTR interrupt_raingauge();
|
||||||
#include "sensor_raingauge.cpp"
|
#include "sensor_raingauge.cpp"
|
||||||
|
|
||||||
Sensor_Raingauge sensor_raingauge(SENSOR_Raingauge_PIN);
|
Sensor_Raingauge sensor_raingauge(SENSOR_Raingauge_PIN);
|
||||||
|
|
||||||
|
|
||||||
void ICACHE_RAM_ATTR interrupt_raingauge()
|
void ICACHE_RAM_ATTR interrupt_raingauge()
|
||||||
{
|
{
|
||||||
if (millis() - sensor_raingauge.raingauge_lastpulse_fordebounce >= RAINGAUGE_DEBOUNCETIME) { //ignore if pulse came too fast
|
if (millis() - sensor_raingauge.raingauge_lastpulse_fordebounce >= RAINGAUGE_DEBOUNCETIME) { //ignore if pulse came too fast
|
||||||
|
@ -374,7 +380,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
||||||
|
|
||||||
|
|
||||||
#ifdef SENSOR_MULTICHANNELGASGMXXX
|
#ifdef SENSOR_MULTICHANNELGASGMXXX
|
||||||
#include "sensor_multichannelgasgmxxx.cpp"
|
#include "sensor_multichannelgasgmxxx.h"
|
||||||
Sensor_MULTICHANNELGASGMXXX sensor_multichannelgasgmxxx;
|
Sensor_MULTICHANNELGASGMXXX sensor_multichannelgasgmxxx;
|
||||||
|
|
||||||
#ifndef SENSOR_MULTICHANNELGASGMXXX_no2_minchange
|
#ifndef SENSOR_MULTICHANNELGASGMXXX_no2_minchange
|
||||||
|
@ -432,7 +438,7 @@ void setup() {
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.println("Booting");
|
Serial.println("Booting");
|
||||||
|
|
||||||
delay(1000); //wait for sensors to get powered
|
delay(5000); //wait for sensors to get powered
|
||||||
|
|
||||||
|
|
||||||
#ifdef SENSOR_DHT22
|
#ifdef SENSOR_DHT22
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#ifdef SENSOR_BH1750
|
||||||
//Connect SCL to D1, SDA to D2, GND and 3v3
|
//Connect SCL to D1, SDA to D2, GND and 3v3
|
||||||
#include "sensor_bh1750.h"
|
#include "sensor_bh1750.h"
|
||||||
|
|
||||||
|
@ -63,3 +64,5 @@ void Sensor_BH1750::sensorloop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,4 @@
|
||||||
|
#ifdef SENSOR_BMP180
|
||||||
//Connect SCL to D1, SDA to D2, GND and 3v3
|
//Connect SCL to D1, SDA to D2, GND and 3v3
|
||||||
#include "sensor_bmp180.h"
|
#include "sensor_bmp180.h"
|
||||||
|
|
||||||
|
@ -103,3 +104,6 @@ void Sensor_BMP180::loop_BMP180_pressure()
|
||||||
d.lastsent=millis();
|
d.lastsent=millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,4 @@
|
||||||
|
#ifdef SENSOR_DHT22
|
||||||
// Digital pin connected to the DHT sensor. // dht pins: 1=power, 2=data, 3=NC, 4=GND. 10k from data to power needed
|
// Digital pin connected to the DHT sensor. // dht pins: 1=power, 2=data, 3=NC, 4=GND. 10k from data to power needed
|
||||||
#include "sensor_dht22.h"
|
#include "sensor_dht22.h"
|
||||||
|
|
||||||
|
@ -108,3 +109,5 @@ void Sensor_DHT22::loop_DHT22_humidity()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,4 @@
|
||||||
|
#ifdef SENSOR_HCSR501
|
||||||
// PIR Sensors HC-SR501
|
// PIR Sensors HC-SR501
|
||||||
// pir sensor needs 5v through an inductor for filtering. output level is 3.3v
|
// pir sensor needs 5v through an inductor for filtering. output level is 3.3v
|
||||||
// 100nF capacitor should be soldered between pins 12 and 13 of BISS0001 to stop interference from esp causing false triggers (in some setups). source: https://www.letscontrolit.com/forum/viewtopic.php?t=671
|
// 100nF capacitor should be soldered between pins 12 and 13 of BISS0001 to stop interference from esp causing false triggers (in some setups). source: https://www.letscontrolit.com/forum/viewtopic.php?t=671
|
||||||
|
@ -65,3 +66,6 @@ void Sensor_HCSR501::sensorloop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,4 +1,4 @@
|
||||||
|
#ifdef SENSOR_HS1101
|
||||||
#include "sensor_hs1101.h"
|
#include "sensor_hs1101.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,3 +102,5 @@ int Sensor_HS1101::get_mapped(const unsigned int* _in, const unsigned int* _out,
|
||||||
// interpolate in the right segment for the rest
|
// interpolate in the right segment for the rest
|
||||||
return map(val, _in[pos-1], _in[pos], _out[pos-1], _out[pos]);
|
return map(val, _in[pos-1], _in[pos], _out[pos-1], _out[pos]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,4 @@
|
||||||
|
#ifdef SENSOR_HTU21D
|
||||||
//Connect SCL to D1, SDA to D2, GND and 3v3
|
//Connect SCL to D1, SDA to D2, GND and 3v3
|
||||||
#include "sensor_htu21d.h"
|
#include "sensor_htu21d.h"
|
||||||
#include <Adafruit_HTU21DF.h>
|
#include <Adafruit_HTU21DF.h>
|
||||||
|
@ -52,13 +53,17 @@ void Sensor_HTU21D::sensorloop()
|
||||||
}
|
}
|
||||||
void Sensor_HTU21D::loop_HTU21D_temperature()
|
void Sensor_HTU21D::loop_HTU21D_temperature()
|
||||||
{
|
{
|
||||||
|
|
||||||
sensordata &d=data_temperature;
|
sensordata &d=data_temperature;
|
||||||
bool _changed=false;
|
bool _changed=false;
|
||||||
|
|
||||||
if (millis() >= (d.lastreadtime+d.readdelay)) {
|
if (millis() >= (d.lastreadtime+d.readdelay)) {
|
||||||
|
Serial.println("Reading htu21d temperature");
|
||||||
d.value = htu->readTemperature();
|
d.value = htu->readTemperature();
|
||||||
|
Serial.println(d.value);
|
||||||
if (fabs(d.lastsentvalue-d.value)>=d.minchange){
|
if (fabs(d.lastsentvalue-d.value)>=d.minchange){
|
||||||
_changed=true;
|
_changed=true;
|
||||||
|
Serial.println("HTU temp changed");
|
||||||
}
|
}
|
||||||
d.lastreadtime=millis();
|
d.lastreadtime=millis();
|
||||||
}
|
}
|
||||||
|
@ -103,3 +108,5 @@ void Sensor_HTU21D::loop_HTU21D_humidity()
|
||||||
d.lastsent=millis();
|
d.lastsent=millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,5 @@
|
||||||
|
#ifdef SENSOR_LDR
|
||||||
|
|
||||||
// High/Low Output LDR Sensor
|
// High/Low Output LDR Sensor
|
||||||
// For example: RCWL-0516 (needs 5v input (gnd, vin), 3.3v output level. high for 2seconds when movement detected)
|
// For example: RCWL-0516 (needs 5v input (gnd, vin), 3.3v output level. high for 2seconds when movement detected)
|
||||||
#include "sensor_ldr.h"
|
#include "sensor_ldr.h"
|
||||||
|
@ -87,3 +89,4 @@ int Sensor_LDR::get_lux(const unsigned int* _in, const unsigned int* _out, byte
|
||||||
// interpolate in the right segment for the rest
|
// interpolate in the right segment for the rest
|
||||||
return map(val, _in[pos-1], _in[pos], _out[pos-1], _out[pos]);
|
return map(val, _in[pos-1], _in[pos], _out[pos-1], _out[pos]);
|
||||||
}
|
}
|
||||||
|
#endif
|
|
@ -1,3 +1,4 @@
|
||||||
|
#ifdef SENSOR_ML8511
|
||||||
//ML8511 UV Sensor outputs an analog voltage. ML8511PIN needs to be an ADC pin
|
//ML8511 UV Sensor outputs an analog voltage. ML8511PIN needs to be an ADC pin
|
||||||
//value as uvIntensity (mW/cm^2)
|
//value as uvIntensity (mW/cm^2)
|
||||||
#include "sensor_ml8511.h"
|
#include "sensor_ml8511.h"
|
||||||
|
@ -78,3 +79,4 @@ float Sensor_ML8511::mapfloat(float x, float in_min, float in_max, float out_min
|
||||||
{
|
{
|
||||||
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
||||||
}
|
}
|
||||||
|
#endif
|
|
@ -1,3 +1,4 @@
|
||||||
|
#ifdef SENSOR_MULTICHANNELGASGMXXX
|
||||||
//Connect SCL to D1, SDA to D2, GND and 3v3
|
//Connect SCL to D1, SDA to D2, GND and 3v3
|
||||||
#include "sensor_multichannelgasgmxxx.h"
|
#include "sensor_multichannelgasgmxxx.h"
|
||||||
|
|
||||||
|
@ -178,3 +179,5 @@ Serial.print(gas.calcVol(val)); Serial.println("V");
|
||||||
val = gas.measure_CO(); Serial.print("CO: "); Serial.print(val); Serial.print(" eq ");
|
val = gas.measure_CO(); Serial.print("CO: "); Serial.print(val); Serial.print(" eq ");
|
||||||
Serial.print(gas.calcVol(val)); Serial.println("V");
|
Serial.print(gas.calcVol(val)); Serial.println("V");
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,4 @@
|
||||||
|
#ifdef SENSOR_RADAR
|
||||||
// High/Low Output Radar Sensor
|
// High/Low Output Radar Sensor
|
||||||
// For example: RCWL-0516 (needs 5v input (gnd, vin), 3.3v output level. high for 2seconds when movement detected)
|
// For example: RCWL-0516 (needs 5v input (gnd, vin), 3.3v output level. high for 2seconds when movement detected)
|
||||||
#include "sensor_radar.h"
|
#include "sensor_radar.h"
|
||||||
|
@ -59,3 +60,5 @@ void Sensor_Radar::sensorloop()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,4 @@
|
||||||
|
#ifdef SENSOR_SDS018
|
||||||
#include "sensor_sds018.h"
|
#include "sensor_sds018.h"
|
||||||
|
|
||||||
// SDS018 example: https://github.com/crystaldust/sds018/blob/master/sds018.ino
|
// SDS018 example: https://github.com/crystaldust/sds018/blob/master/sds018.ino
|
||||||
|
@ -155,3 +156,4 @@ void Sensor_SDS018::readSDS018()
|
||||||
sds018_swSerial->flush();
|
sds018_swSerial->flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
|
@ -1,3 +1,4 @@
|
||||||
|
#ifdef SENSOR_SHT31
|
||||||
//Connect SCL to D1, SDA to D2, GND and 3v3
|
//Connect SCL to D1, SDA to D2, GND and 3v3
|
||||||
#include "sensor_sht31.h"
|
#include "sensor_sht31.h"
|
||||||
|
|
||||||
|
@ -128,3 +129,5 @@ void Sensor_SHT31::checkHeater(float humidity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,4 +1,4 @@
|
||||||
|
#ifdef SENSOR_TCS34725
|
||||||
#include "sensor_tcs34725.h"
|
#include "sensor_tcs34725.h"
|
||||||
//#include "Adafruit_TCS34725.h"
|
//#include "Adafruit_TCS34725.h"
|
||||||
//Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X); //initializer from standart class
|
//Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X); //initializer from standart class
|
||||||
|
@ -157,3 +157,5 @@ void Sensor_TCS34725::loop_colortemp()
|
||||||
d.lastsent=millis();
|
d.lastsent=millis();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,3 +1,4 @@
|
||||||
|
#ifdef SENSOR_VL53L1X
|
||||||
//Connect SCL to D1, SDA to D2, GND and 3v3
|
//Connect SCL to D1, SDA to D2, GND and 3v3
|
||||||
#include "sensor_vl53l1x.h"
|
#include "sensor_vl53l1x.h"
|
||||||
|
|
||||||
|
@ -97,3 +98,5 @@ void Sensor_VL53L1X::sensorloop()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,5 +1,5 @@
|
||||||
#ifdef SENSOR_TCS34725
|
|
||||||
|
|
||||||
|
#ifdef SENSOR_TCS34725
|
||||||
//#include <Wire.h>
|
//#include <Wire.h>
|
||||||
//#include "Adafruit_TCS34725.h"
|
//#include "Adafruit_TCS34725.h"
|
||||||
#include "tcs34725_agc.h"
|
#include "tcs34725_agc.h"
|
||||||
|
|
Loading…
Reference in New Issue