fine tune moisture readings

This commit is contained in:
Marcus 2024-04-07 02:10:45 +02:00
parent 33d313c68e
commit af0f7715bf

View file

@ -167,6 +167,13 @@ float getHumidity() {
} }
int getSoilmoisture(bool moistureSensor) { int getSoilmoisture(bool moistureSensor) {
/*
* moistureSensor
* ==============
* 0/false : analog capacitive moisture sensor
* 1/true : chirp I2C moisture sensor
*/
// value to return // value to return
int soilmoisture; int soilmoisture;
// value for wet // value for wet
@ -176,7 +183,7 @@ int getSoilmoisture(bool moistureSensor) {
if(moistureSensor == false ) { if(moistureSensor == false ) {
// read analog value from analog moisture sensor // read analog value from analog moisture sensor
wet = 185; wet = 180;
dry= 590; dry= 590;
digitalWrite(PINsoilmoisture, HIGH); digitalWrite(PINsoilmoisture, HIGH);
@ -188,8 +195,9 @@ int getSoilmoisture(bool moistureSensor) {
digitalWrite(PINsoilmoisture, LOW); digitalWrite(PINsoilmoisture, LOW);
} else { } else {
// read soil moisture from chrip I2C // read soil moisture from chrip I2C
wet = 580; wet = 560;
dry= 250; dry= 250;
// get raw value from I2C chirp sensor // get raw value from I2C chirp sensor
soilmoisture = readI2CRegister16bit(0x20, 0); soilmoisture = readI2CRegister16bit(0x20, 0);
} }
@ -288,7 +296,8 @@ void loop() {
Serial.println(getWaterlevel()); Serial.println(getWaterlevel());
display.print("ASM: "); display.print("ASM: ");
display.println(getSoilmoisture(0)); display.print(getSoilmoisture(0));
display.println(", ");
Serial.print("ASM: "); Serial.print("ASM: ");
Serial.println(getSoilmoisture(0)); Serial.println(getSoilmoisture(0));
@ -297,7 +306,7 @@ void loop() {
display.display(); display.display();
Serial.println("Test"); Serial.println("Test");
//delay(1000); delay(1000);
} }