now i have another question i would like to use 2 soilwatch 10, one to stick on the ground and one buried 90 cm underground, so I adapt your example code to read the 2 sensors, the thing is i get this readings:
ADC = 51, Moisture value on the ground = 0
ADC = 634, Moisture value Underground (1.5 m) = 68
ADC = 51, Moisture value on the ground = 0
ADC = 636, Moisture value Underground (1.5 m) = 68
ADC = 50, Moisture value on the ground = 0
ADC = 632, Moisture value Underground (1.5 m) = 68
ADC = 52, Moisture value on the ground = 0
ADC = 635, Moisture value Underground (1.5 m) = 68
ADC = 50, Moisture value on the ground = 0
ADC = 610, Moisture value Underground (1.5 m) = 65
ADC = 52, Moisture value on the ground = 0
ADC = 624, Moisture value Underground (1.5 m) = 67
ADC = 48, Moisture value on the ground = 0
the second sensor always print the same readings, the first one works correctly and the second i believe I have an error on my circuit, one dumb question, can i plug the second sensor to other analog pin instead of A0, i am using A4 currently but no mathers the pin, readings do not change. Maybe i should change the programming ?
this is my code:
const int analogInPinOnTheGround = A0;
int minADCground = 44;
int maxADCground = 907;
const int analogInPinUnderground = A4;
int minADCunderground = 44; //i have to change this for calibration
int maxADCunderground = 907; //i have to change this for calibration
int moistureOnTheGroundValue, mappedOnTheGroundValue;
int moistureUndergroundValue, mappedUndergroundValue;
void setup() {
Serial.begin(115200);
}
void loop() {
// SENSOR A RAS DE SUELO
moistureOnTheGroundValue = analogRead(analogInPinOnTheGround);
Serial.print("ADC = " );
Serial.print(moistureOnTheGroundValue);
Serial.print(", " );
mappedOnTheGroundValue= map(moistureOnTheGroundValue,minADCground,maxADCground, 0, 100);
Serial.print("Moisture value on the ground = " );
Serial.println(mappedOnTheGroundValue);
delay(2000);
//SENSOR ENTERRADO A 1.5 METROS DEL SUELO
moistureUndergroundValue = analogRead(analogInPinUnderground);
Serial.print("ADC = " );
Serial.print(moistureUndergroundValue);
Serial.print(", " );
mappedUndergroundValue= map(moistureUndergroundValue,minADCunderground,maxADCunderground, 0, 100);
Serial.print("Moisture value Underground (1.5 m) = " );
Serial.println(mappedUndergroundValue);
delay(2000);
}
Piotr I understand that you can not have time to answer this, but your help will be appreciated.
Thanks a lot for your help,
Martín