Compare commits
No commits in common. "46ab4f7dbb886c9bc3188081e6e4eb81405107e6" and "267a5652aad13c101b1c0702b151c4c2b5457451" have entirely different histories.
46ab4f7dbb
...
267a5652aa
|
@ -1,4 +1,4 @@
|
|||
#ifdef SENSOR_ANEMOMETER
|
||||
|
||||
#include "sensor_anemometer.h"
|
||||
|
||||
//uses ATS177 Latched hall sensor for rotation sensing
|
||||
|
@ -66,5 +66,3 @@ void Sensor_Anemometer::sensorloop()
|
|||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,4 +1,3 @@
|
|||
#ifdef SENSOR_BH1750
|
||||
//Connect SCL to D1, SDA to D2, GND and 3v3
|
||||
#include "sensor_bh1750.h"
|
||||
|
||||
|
@ -64,5 +63,3 @@ void Sensor_BH1750::sensorloop()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,4 +1,3 @@
|
|||
#ifdef SENSOR_BMP180
|
||||
//Connect SCL to D1, SDA to D2, GND and 3v3
|
||||
#include "sensor_bmp180.h"
|
||||
|
||||
|
@ -104,6 +103,3 @@ void Sensor_BMP180::loop_BMP180_pressure()
|
|||
d.lastsent=millis();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -1,4 +1,3 @@
|
|||
#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
|
||||
#include "sensor_dht22.h"
|
||||
|
||||
|
@ -109,5 +108,3 @@ void Sensor_DHT22::loop_DHT22_humidity()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -1,4 +1,3 @@
|
|||
#ifdef SENSOR_HCSR501
|
||||
// PIR Sensors HC-SR501
|
||||
// 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
|
||||
|
@ -66,6 +65,3 @@ void Sensor_HCSR501::sensorloop()
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
#ifdef SENSOR_HS1101
|
||||
|
||||
#include "sensor_hs1101.h"
|
||||
|
||||
|
||||
|
@ -102,5 +102,3 @@ int Sensor_HS1101::get_mapped(const unsigned int* _in, const unsigned int* _out,
|
|||
// interpolate in the right segment for the rest
|
||||
return map(val, _in[pos-1], _in[pos], _out[pos-1], _out[pos]);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,4 +1,3 @@
|
|||
#ifdef SENSOR_HTU21D
|
||||
//Connect SCL to D1, SDA to D2, GND and 3v3
|
||||
#include "sensor_htu21d.h"
|
||||
#include <Adafruit_HTU21DF.h>
|
||||
|
@ -53,17 +52,13 @@ void Sensor_HTU21D::sensorloop()
|
|||
}
|
||||
void Sensor_HTU21D::loop_HTU21D_temperature()
|
||||
{
|
||||
|
||||
sensordata &d=data_temperature;
|
||||
bool _changed=false;
|
||||
|
||||
if (millis() >= (d.lastreadtime+d.readdelay)) {
|
||||
Serial.println("Reading htu21d temperature");
|
||||
d.value = htu->readTemperature();
|
||||
Serial.println(d.value);
|
||||
if (fabs(d.lastsentvalue-d.value)>=d.minchange){
|
||||
_changed=true;
|
||||
Serial.println("HTU temp changed");
|
||||
}
|
||||
d.lastreadtime=millis();
|
||||
}
|
||||
|
@ -108,5 +103,3 @@ void Sensor_HTU21D::loop_HTU21D_humidity()
|
|||
d.lastsent=millis();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,5 +1,3 @@
|
|||
#ifdef SENSOR_LDR
|
||||
|
||||
// High/Low Output LDR Sensor
|
||||
// For example: RCWL-0516 (needs 5v input (gnd, vin), 3.3v output level. high for 2seconds when movement detected)
|
||||
#include "sensor_ldr.h"
|
||||
|
@ -89,4 +87,3 @@ int Sensor_LDR::get_lux(const unsigned int* _in, const unsigned int* _out, byte
|
|||
// interpolate in the right segment for the rest
|
||||
return map(val, _in[pos-1], _in[pos], _out[pos-1], _out[pos]);
|
||||
}
|
||||
#endif
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
#ifndef SENSOR_LDR_H
|
||||
#define SENSOR_LDR_H
|
||||
|
||||
|
@ -41,4 +40,3 @@ public:
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#ifdef SENSOR_MHZ19B
|
||||
#include "sensor_mhz19b.h"
|
||||
|
||||
|
||||
|
@ -155,5 +154,3 @@ int Sensor_MHZ19B::mhz19_readValue_reimplemented(Stream *_streamRef, MHZ19 *_mhz
|
|||
void Sensor_MHZ19B::calibrateZero() {
|
||||
mhz19->calibrateZero();
|
||||
}
|
||||
|
||||
#endif
|
|
@ -32,6 +32,7 @@ private:
|
|||
#define BAUD_RATE_MHZ19 9600
|
||||
|
||||
|
||||
|
||||
#define MHZ19CALIBRATIONTOPIC
|
||||
|
||||
public:
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#ifdef SENSOR_ML8511
|
||||
//ML8511 UV Sensor outputs an analog voltage. ML8511PIN needs to be an ADC pin
|
||||
//value as uvIntensity (mW/cm^2)
|
||||
#include "sensor_ml8511.h"
|
||||
|
@ -79,4 +78,3 @@ 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;
|
||||
}
|
||||
#endif
|
|
@ -1,4 +1,3 @@
|
|||
#ifdef SENSOR_MULTICHANNELGASGMXXX
|
||||
//Connect SCL to D1, SDA to D2, GND and 3v3
|
||||
#include "sensor_multichannelgasgmxxx.h"
|
||||
|
||||
|
@ -179,5 +178,3 @@ Serial.print(gas.calcVol(val)); Serial.println("V");
|
|||
val = gas.measure_CO(); Serial.print("CO: "); Serial.print(val); Serial.print(" eq ");
|
||||
Serial.print(gas.calcVol(val)); Serial.println("V");
|
||||
*/
|
||||
|
||||
#endif
|
|
@ -1,4 +1,3 @@
|
|||
#ifdef SENSOR_RADAR
|
||||
// High/Low Output Radar Sensor
|
||||
// For example: RCWL-0516 (needs 5v input (gnd, vin), 3.3v output level. high for 2seconds when movement detected)
|
||||
#include "sensor_radar.h"
|
||||
|
@ -60,5 +59,3 @@ void Sensor_Radar::sensorloop()
|
|||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
#ifdef SENSOR_RAINGAUGE
|
||||
|
||||
#include "sensor_raingauge.h"
|
||||
|
||||
//uses ATS177 Latched hall sensor for rotation sensing
|
||||
|
@ -79,5 +79,3 @@ void Sensor_Raingauge::sensorloop()
|
|||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -1,4 +1,3 @@
|
|||
#ifdef SENSOR_SDS018
|
||||
#include "sensor_sds018.h"
|
||||
|
||||
// SDS018 example: https://github.com/crystaldust/sds018/blob/master/sds018.ino
|
||||
|
@ -156,4 +155,3 @@ void Sensor_SDS018::readSDS018()
|
|||
sds018_swSerial->flush();
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -1,4 +1,3 @@
|
|||
#ifdef SENSOR_SHT31
|
||||
//Connect SCL to D1, SDA to D2, GND and 3v3
|
||||
#include "sensor_sht31.h"
|
||||
|
||||
|
@ -129,5 +128,3 @@ void Sensor_SHT31::checkHeater(float humidity) {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
#ifdef SENSOR_TCS34725
|
||||
|
||||
#include "sensor_tcs34725.h"
|
||||
//#include "Adafruit_TCS34725.h"
|
||||
//Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X); //initializer from standart class
|
||||
|
@ -157,5 +157,3 @@ void Sensor_TCS34725::loop_colortemp()
|
|||
d.lastsent=millis();
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,4 +1,3 @@
|
|||
#ifdef SENSOR_VL53L1X
|
||||
//Connect SCL to D1, SDA to D2, GND and 3v3
|
||||
#include "sensor_vl53l1x.h"
|
||||
|
||||
|
@ -98,5 +97,3 @@ void Sensor_VL53L1X::sensorloop()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -83,6 +83,31 @@ 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
|
||||
[env:sensoresp1]
|
||||
|
@ -298,7 +323,7 @@ lib_deps =
|
|||
Homie@3.0.0
|
||||
claws/BH1750@1.1.4
|
||||
|
||||
#Badezimmer
|
||||
#Kueche
|
||||
[env:sensoresp7]
|
||||
platform = espressif8266 @ 2.5.0
|
||||
board = d1_mini
|
||||
|
@ -318,11 +343,9 @@ build_flags =
|
|||
-D SENSOR_VL53L1X_senddelaymax=1000*30
|
||||
-D SENSOR_VL53L1X_readdelay=500
|
||||
|
||||
-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_SHT31
|
||||
-D SENSOR_SHT31_humidity_minchange=5
|
||||
-D SENSOR_SHT31_temperature_minchange=0.5
|
||||
|
||||
lib_deps =
|
||||
Bounce2
|
||||
|
@ -330,7 +353,7 @@ lib_deps =
|
|||
ArduinoJson@6.16.1
|
||||
marvinroger/Homie @ ^3.0.1
|
||||
pololu/VL53L1X @ ^1.3.0
|
||||
adafruit/Adafruit HTU21DF Library @ ^1.0.5
|
||||
adafruit/Adafruit SHT31 Library@^2.2.0
|
||||
|
||||
#3D Printer
|
||||
[env:sensoresp3dprinter]
|
||||
|
@ -356,35 +379,3 @@ lib_deps =
|
|||
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
|
||||
#include "sensor_dht22.h"
|
||||
#include "sensor_dht22.cpp"
|
||||
Sensor_DHT22 sensor_dht22(SENSOR_DHT22_PIN);
|
||||
|
||||
#ifndef SENSOR_DHT22_temperature_minchange
|
||||
|
@ -58,7 +58,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
|
||||
|
||||
#ifdef SENSOR_BMP180
|
||||
#include "sensor_bmp180.h"
|
||||
#include "sensor_bmp180.cpp"
|
||||
Sensor_BMP180 sensor_bmp180;
|
||||
|
||||
#ifndef SENSOR_BMP180_temperature_minchange
|
||||
|
@ -83,7 +83,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
#endif
|
||||
|
||||
#ifdef SENSOR_HTU21D
|
||||
#include "sensor_htu21d.h"
|
||||
#include "sensor_htu21d.cpp"
|
||||
Sensor_HTU21D sensor_htu21d;
|
||||
|
||||
#ifndef SENSOR_HTU21D_temperature_minchange
|
||||
|
@ -110,7 +110,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
|
||||
|
||||
#ifdef SENSOR_SHT31
|
||||
#include "sensor_sht31.h"
|
||||
#include "sensor_sht31.cpp"
|
||||
Sensor_SHT31 sensor_sht31;
|
||||
|
||||
#ifndef SENSOR_SHT31_temperature_minchange
|
||||
|
@ -136,7 +136,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
#endif
|
||||
|
||||
#ifdef SENSOR_HS1101
|
||||
#include "sensor_hs1101.h"
|
||||
#include "sensor_hs1101.cpp"
|
||||
Sensor_HS1101 sensor_hs1101(SENSOR_HS1101_PIN);
|
||||
|
||||
#ifndef SENSOR_HS1101_humidity_minchange
|
||||
|
@ -152,7 +152,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
#endif
|
||||
|
||||
#ifdef SENSOR_BH1750
|
||||
#include "sensor_bh1750.h"
|
||||
#include "sensor_bh1750.cpp"
|
||||
Sensor_BH1750 sensor_bh1750;
|
||||
|
||||
#ifndef SENSOR_BH1750_light_minchange
|
||||
|
@ -167,7 +167,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
#endif
|
||||
|
||||
#ifdef SENSOR_ML8511
|
||||
#include "sensor_ml8511.h"
|
||||
#include "sensor_ml8511.cpp"
|
||||
Sensor_ML8511 sensor_ml8511(SENSOR_ML8511_PIN);
|
||||
|
||||
#ifndef SENSOR_ML8511_minchange
|
||||
|
@ -183,7 +183,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
|
||||
|
||||
#ifdef SENSOR_HCSR501
|
||||
#include "sensor_hcsr501.h"
|
||||
#include "sensor_hcsr501.cpp"
|
||||
Sensor_HCSR501 sensor_hcsr501(SENSOR_HCSR501_PIN);
|
||||
|
||||
#ifndef SENSOR_HCSR501_senddelaymax
|
||||
|
@ -195,7 +195,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
#endif
|
||||
|
||||
#ifdef SENSOR_RADAR
|
||||
#include "sensor_radar.h"
|
||||
#include "sensor_radar.cpp"
|
||||
Sensor_Radar sensor_radar(SENSOR_RADAR_PIN);
|
||||
|
||||
#ifndef SENSOR_RADAR_senddelaymax
|
||||
|
@ -207,7 +207,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
#endif
|
||||
|
||||
#ifdef SENSOR_LDR
|
||||
#include "sensor_ldr.h"
|
||||
#include "sensor_ldr.cpp"
|
||||
Sensor_LDR sensor_ldr(SENSOR_LDR_PIN);
|
||||
|
||||
#ifndef SENSOR_LDR_minchange
|
||||
|
@ -259,7 +259,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
|
||||
|
||||
#ifdef SENSOR_SDS018
|
||||
#include "sensor_sds018.h"
|
||||
#include "sensor_sds018.cpp"
|
||||
Sensor_SDS018 sensor_sds018(SENSOR_SDS018_SERIAL_RX,SENSOR_SDS018_SERIAL_TX);
|
||||
#ifndef SENSOR_SDS018_PM10_minchange
|
||||
#define SENSOR_SDS018_PM10_minchange 10.0
|
||||
|
@ -282,7 +282,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
#endif
|
||||
|
||||
#ifdef SENSOR_TCS34725
|
||||
#include "sensor_tcs34725.h"
|
||||
#include "sensor_tcs34725.cpp"
|
||||
Sensor_TCS34725 sensor_tcs34725;
|
||||
#ifndef SENSOR_TCS34725_LUX_minchange
|
||||
#define SENSOR_TCS34725_LUX_minchange 500
|
||||
|
@ -305,7 +305,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
#endif
|
||||
|
||||
#ifdef SENSOR_VL53L1X
|
||||
#include "sensor_vl53l1x.h"
|
||||
#include "sensor_vl53l1x.cpp"
|
||||
Sensor_VL53L1X sensor_vl53l1x;
|
||||
#ifndef SENSOR_VL53L1X_minchange
|
||||
#define SENSOR_VL53L1X_minchange 100
|
||||
|
@ -321,7 +321,6 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
#ifdef SENSOR_ANEMOMETER
|
||||
void ICACHE_RAM_ATTR interrupt_anemometer();
|
||||
#include "sensor_anemometer.cpp"
|
||||
|
||||
//Sensor_Anemometer_Instance = new Sensor_Anemometer(SENSOR_Anemometer_PIN);
|
||||
Sensor_Anemometer sensor_anemometer(SENSOR_Anemometer_PIN);
|
||||
|
||||
|
@ -334,9 +333,6 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef SENSOR_Anemometer_minchange
|
||||
#define SENSOR_Anemometer_minchange 0.25
|
||||
#endif
|
||||
|
@ -349,14 +345,12 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
#endif
|
||||
|
||||
#ifdef SENSOR_RAINGAUGE
|
||||
|
||||
//uses ATS177 Latched Hall Sensor for rauge flip sensing
|
||||
void ICACHE_RAM_ATTR interrupt_raingauge();
|
||||
#include "sensor_raingauge.cpp"
|
||||
|
||||
Sensor_Raingauge sensor_raingauge(SENSOR_Raingauge_PIN);
|
||||
|
||||
|
||||
void ICACHE_RAM_ATTR interrupt_raingauge()
|
||||
{
|
||||
if (millis() - sensor_raingauge.raingauge_lastpulse_fordebounce >= RAINGAUGE_DEBOUNCETIME) { //ignore if pulse came too fast
|
||||
|
@ -380,7 +374,7 @@ HomieNode sensorNode("sensors", "Sensors","sensors"); //id, name, type
|
|||
|
||||
|
||||
#ifdef SENSOR_MULTICHANNELGASGMXXX
|
||||
#include "sensor_multichannelgasgmxxx.h"
|
||||
#include "sensor_multichannelgasgmxxx.cpp"
|
||||
Sensor_MULTICHANNELGASGMXXX sensor_multichannelgasgmxxx;
|
||||
|
||||
#ifndef SENSOR_MULTICHANNELGASGMXXX_no2_minchange
|
||||
|
@ -438,7 +432,7 @@ void setup() {
|
|||
Serial.println();
|
||||
Serial.println("Booting");
|
||||
|
||||
delay(5000); //wait for sensors to get powered
|
||||
delay(1000); //wait for sensors to get powered
|
||||
|
||||
|
||||
#ifdef SENSOR_DHT22
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
#ifdef SENSOR_TCS34725
|
||||
|
||||
//#include <Wire.h>
|
||||
//#include "Adafruit_TCS34725.h"
|
||||
#include "tcs34725_agc.h"
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
//copied from example code: https://github.com/adafruit/Adafruit_TCS34725/blob/master/examples/tcs34725autorange/tcs34725autorange.ino
|
||||
#ifdef SENSOR_TCS34725
|
||||
|
||||
#ifndef _TCS34725_AGC_H_
|
||||
#define _TCS34725_AGC_H_
|
||||
|
@ -46,3 +47,5 @@ public:
|
|||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue