add sensoresp5
This commit is contained in:
parent
1422636c6b
commit
99a57c594c
|
@ -12,11 +12,12 @@
|
|||
|
||||
[platformio]
|
||||
#For Config upload comment in data_dir line and flash with platformio run -t uploadfs --environment sensorespx
|
||||
data_dir=data_sensoresp0
|
||||
#data_dir=data_sensoresp0
|
||||
#data_dir=data_sensoresp1
|
||||
#data_dir=data_sensoresp2
|
||||
#data_dir=data_sensoresp3
|
||||
#data_dir=data_sensoresp4
|
||||
data_dir=data_sensoresp5
|
||||
|
||||
|
||||
#Outdoor
|
||||
|
@ -205,3 +206,35 @@ lib_deps =
|
|||
Homie@3.0.0
|
||||
|
||||
|
||||
#Kueche
|
||||
[env:sensoresp5]
|
||||
platform = espressif8266
|
||||
board = d1_mini
|
||||
framework = arduino
|
||||
|
||||
monitor_port = /dev/ttyUSB0
|
||||
monitor_speed = 115200
|
||||
|
||||
build_flags =
|
||||
-D SENSOR_DHT22
|
||||
-D DHTPIN=D7
|
||||
-D dataDHT22_temperature_minchange=0.2
|
||||
-D dataDHT22_humidity_minchange=1.0
|
||||
|
||||
-D SENSOR_PIR
|
||||
-D PIRPIN=D0
|
||||
-D dataPIR_readdelay=100
|
||||
-D dataPIR_senddelaymax=1000*60*10
|
||||
|
||||
-D SENSOR_BH1750
|
||||
-D dataBH1750_minchange=10.0
|
||||
-D dataBH1750_senddelaymax=1000*60*2
|
||||
|
||||
|
||||
lib_deps =
|
||||
adafruit/DHT sensor library@1.3.10
|
||||
claws/BH1750@1.1.4
|
||||
ArduinoJson@6.16.1 #dependency of homie. using older version because of "ambiguous overload for operator|" error
|
||||
Homie@3.0.0
|
||||
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ struct sensordata
|
|||
//SCL=D1, SDA=D2
|
||||
#include <Wire.h>
|
||||
#include <BH1750.h>
|
||||
BH1750 lightMeter(0x23);
|
||||
BH1750 lightMeter(0x23); //0x23 if addr connected to ground (=pin open), 0x5c if addr pulled high
|
||||
bool bh1750init_ok=false;
|
||||
sensordata dataBH1750;
|
||||
float value_lightBH1750=0;
|
||||
|
@ -84,6 +84,7 @@ struct sensordata
|
|||
#ifdef SENSOR_PIR
|
||||
// PIR Sensors HC-SR501 (modified to put out shortest pulse time short pins 5 and 6 of ic)
|
||||
//pir sensor needs 5v through an inductor for filtering. output level is 3.3v
|
||||
//hc-sr501 should also be a few cm away from the esp. interference can cause false triggering
|
||||
sensordata dataPIR;
|
||||
bool value_PIR=false;
|
||||
#endif
|
||||
|
@ -175,6 +176,7 @@ struct sensordata
|
|||
//#include "Adafruit_TCS34725.h"
|
||||
#include "tcs34725_agc.h" //class code from example https://github.com/adafruit/Adafruit_TCS34725/blob/master/examples/tcs34725autorange/tcs34725autorange.ino
|
||||
//Connect SCL to D1, SDA to D2, GND and 3v3
|
||||
//Maximum measurable light is around 20k Lux. (direct sunlight is easily above 20k Lux)
|
||||
//Adafruit_TCS34725 tcs = Adafruit_TCS34725(TCS34725_INTEGRATIONTIME_700MS, TCS34725_GAIN_1X); //initializer from standart class
|
||||
tcs34725 tcs; //wrapper class with agc
|
||||
bool tcs34725init_ok=false;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
#ifdef SENSOR_TCS34725
|
||||
|
||||
//#include <Wire.h>
|
||||
//#include "Adafruit_TCS34725.h"
|
||||
#include "tcs34725_agc.h"
|
||||
|
@ -83,3 +85,5 @@ void tcs34725::getData(void) {
|
|||
lux = (TCS34725_R_Coef * float(r_comp) + TCS34725_G_Coef * float(g_comp) + TCS34725_B_Coef * float(b_comp)) / cpl;
|
||||
ct = TCS34725_CT_Coef * float(b_comp) / float(r_comp) + TCS34725_CT_Offset;
|
||||
}
|
||||
|
||||
#endif
|
|
@ -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