Soil Sensor Trips wrong way (dry>wet not wet>dry)
-
@crusher70 said:
Hi there,
I have tried setting the "Trigger When" option to 1 and 0 but it still seems to be reversed.
Many thanks.
GlenWhat exactly your sensor returns
0and1? or string value likewet,drysomething like? If it is string should be case sensitive.Also you have configured
Dampeningtype asConsecutivewith2counts, which means this condition should satisfy two times continuously.Recommendation: If you are sending string value from sensor
Trippedvariable is not a suitable one. Better useVAR1...VAR5or suitable variable type.Hi and thank you for your help with this.
I'm using the default MySensor sketch, the read function is as follows:-
the serial output shows that when the sensor is wet (not triggered) a 1 is sent and Dry (triggered) a 0 is sent.
I have changed the Dampening to none for now.void loop() { // Read digital soil value int soilValue = digitalRead(DIGITAL_INPUT_SOIL_SENSOR); // 1 = Not triggered, 0 = In soil with water if (soilValue != lastSoilValue) { Serial.println(soilValue); gw.send(msg.set(soilValue==0?1:0)); // Send the inverse to gw as tripped should be when no water in soil lastSoilValue = soilValue; } -
Hi and thank you for your help with this.
I'm using the default MySensor sketch, the read function is as follows:-
the serial output shows that when the sensor is wet (not triggered) a 1 is sent and Dry (triggered) a 0 is sent.
I have changed the Dampening to none for now.void loop() { // Read digital soil value int soilValue = digitalRead(DIGITAL_INPUT_SOIL_SENSOR); // 1 = Not triggered, 0 = In soil with water if (soilValue != lastSoilValue) { Serial.println(soilValue); gw.send(msg.set(soilValue==0?1:0)); // Send the inverse to gw as tripped should be when no water in soil lastSoilValue = soilValue; }Thank you for the code. Yes, your sensor sends
1and0. You have to configure two alarm definitions.one as you showed here and another one should be like
trigger when == 0 -
Thank you for the code. Yes, your sensor sends
1and0. You have to configure two alarm definitions.one as you showed here and another one should be like
trigger when == 0Thank you jkandasa,
I was looking at it from completely the wrong direction trying to cover everything with just one alarm. I have reconfigured as you suggested and also added a forward payload which turns on a relay to water plants and turns it off when soil is wet.Working perfectly thank you so much for your help with this.
Glen
-
Thank you jkandasa,
I was looking at it from completely the wrong direction trying to cover everything with just one alarm. I have reconfigured as you suggested and also added a forward payload which turns on a relay to water plants and turns it off when soil is wet.Working perfectly thank you so much for your help with this.
Glen
Perfect! you can also configure one safety alarm for your relay. For example controller turned on relay based on
wet,drysignal. Later if we do not receive any data from sensor, relay will be keep on turned ON and water over flow will happened.To avoid this you can configure one additional alarm for relay. Say turn OFF relay if it's continually ON for more than 20 minutes.
Condition:Realy == 1and in Dampening:Active time 20 minutes -
Perfect! you can also configure one safety alarm for your relay. For example controller turned on relay based on
wet,drysignal. Later if we do not receive any data from sensor, relay will be keep on turned ON and water over flow will happened.To avoid this you can configure one additional alarm for relay. Say turn OFF relay if it's continually ON for more than 20 minutes.
Condition:Realy == 1and in Dampening:Active time 20 minutes -
Perfect! you can also configure one safety alarm for your relay. For example controller turned on relay based on
wet,drysignal. Later if we do not receive any data from sensor, relay will be keep on turned ON and water over flow will happened.To avoid this you can configure one additional alarm for relay. Say turn OFF relay if it's continually ON for more than 20 minutes.
Condition:Realy == 1and in Dampening:Active time 20 minutes@jkandasa
Ok one final nob question if you don't mind?I have configured the Alarm as suggested but set the active time for 1 min for testing. The alarm triggers as it should but I cant see where the triggering of this alarm turns off the relay. Sorry if this is a silly question but I can't for the life of me see where to configure it.
Many thanks
Glen -
@jkandasa
Ok one final nob question if you don't mind?I have configured the Alarm as suggested but set the active time for 1 min for testing. The alarm triggers as it should but I cant see where the triggering of this alarm turns off the relay. Sorry if this is a silly question but I can't for the life of me see where to configure it.
Many thanks
GlenHey, no problem at all. you can ask as many questions you want.
Can you post your configuration screenshot?
-
Hey, no problem at all. you can ask as many questions you want.
Can you post your configuration screenshot?
-
Alarm triggers but there is no notification to execute for this alarm. You have to create new notification with
Send payloadrelay =1. and map your new notification with this alarm. -
Alarm triggers but there is no notification to execute for this alarm. You have to create new notification with
Send payloadrelay =1. and map your new notification with this alarm. -
Alarm triggers but there is no notification to execute for this alarm. You have to create new notification with
Send payloadrelay =1. and map your new notification with this alarm.Thanks jkandasa work great. I shall leave you alone to rest up for a while as its 4:30 am over there. I'm sure I'll have more questions at some point in the future, but for now you have been a great help so thank you very much. Take care and have a great day.
Regards
Glen -
Thanks jkandasa work great. I shall leave you alone to rest up for a while as its 4:30 am over there. I'm sure I'll have more questions at some point in the future, but for now you have been a great help so thank you very much. Take care and have a great day.
Regards
Glen@crusher70 well! Thank you!
