Page 1 of 1

Moisture Sensor

Posted: Monday 13 July 2015 15:58
by treb0r
Hi
I have built Moisture Sensor according this project: http://www.mysensors.org/build/moisture
I used analog pin and changed values into % value which is visible correctly in domoticz. The problem is when I want to use this value in blocky event creator.
In current values I have only 0, 1, 2, or 3 values which probably indicate dry, wet etc. I don't have access to % value during building the rule. Even when I take 0, 1, 2, or 3 values, they don't work and I can't build any events basing on them. Does anybody know why?
treb0r

Re: Moisture Sensor

Posted: Sunday 16 August 2015 18:09
by gizmocuz
that is because this is not implemented in the event system, someone has to add support for percentage checking

Re: Moisture Sensor

Posted: Monday 14 September 2015 14:15
by treb0r
What about light_level? So how should I present my sensors (and with which values) in the node to make them useful in domoticz building the events?
treb0r?

Re: Moisture Sensor

Posted: Saturday 28 November 2015 22:34
by thecosmicgate
I've build this sensor with the (red) water level sensor. But how can I implement this into domo ?
When I add this on the hardware tab it thinks its a switch, and after that I can change this switch. But the moisture (sensor) is not available.
How to do this ?

Sent from my MotoG3 using Tapatalk

Re: Moisture Sensor

Posted: Sunday 29 November 2015 10:00
by gizmocuz
Well it is a switch !

So it seems to be doing what it should do

take a look in your sketch, a switch (tripped) command is send when there is (or is not) soil water

Re: Moisture Sensor

Posted: Sunday 29 November 2015 10:15
by thecosmicgate
OK but I use this one :
http://m.ebay.com/itm/251771096470?rmvS ... noapp=true
So it must tell me the % , so I know if I must fill the water in the aquarium

Sent from my MotoG3 using Tapatalk

Re: Moisture Sensor

Posted: Sunday 29 November 2015 11:38
by sundberg84
If you use the standard sketch from MySensors it is as Gizmocuz said, sending on/1 (moist) or off/0 (dry). You need to recode it in your sketch if you want it in % and then maybe you could present it as a humidity sensor (becuse humidity shows in %).

Or you have to set a minimun of water that is ok in your aquarium, and then send the 0 when that is reached. When a 0 enters in domoticz you can start filling your aquarium with water.

Re: Moisture Sensor

Posted: Sunday 29 November 2015 20:07
by thecosmicgate
sundberg84 wrote:If you use the standard sketch from MySensors it is as Gizmocuz said, sending on/1 (moist) or off/0 (dry). You need to recode it in your sketch if you want it in % and then maybe you could present it as a humidity sensor (becuse humidity shows in %).

Or you have to set a minimun of water that is ok in your aquarium, and then send the 0 when that is reached. When a 0 enters in domoticz you can start filling your aquarium with water.
Okay thanks ! Will try this .
At the moment the switch doesn't do anything

Sent from my MotoG3 using Tapatalk

Re: Moisture Sensor

Posted: Friday 04 December 2015 2:40
by thecosmicgate
It doesn't work the way i want.
When i start googling the normal arduino code :
void setup(){

 

Serial.begin(9600);

 

}

 

void loop(){

 

Serial.print("Water level Sensor Value:");

Serial.println(analogRead(A5));

delay(100);

 

}





But how tot implement this to mysensors ?

Re: Moisture Sensor

Posted: Friday 04 December 2015 16:41
by Abbadon

Code: Select all

#include <SPI.h>
#include <MySensor.h>  

#define DIGITAL_INPUT_SOIL_SENSOR 3   // Digital input did you attach your soil sensor.  
#define INTERRUPT DIGITAL_INPUT_SOIL_SENSOR-2 // Usually the interrupt = pin -2 (on uno/nano anyway)
#define CHILD_ID 0   // Id of the sensor child

MySensor gw;
MyMessage msg(CHILD_ID, V_TRIPPED);
int lastSoilValue = -1;

void setup()  
{ 
  gw.begin();

  // Send the sketch version information to the gateway and Controller
  gw.sendSketchInfo("Soil Moisture Sensor", "1.0");
  // sets the soil sensor digital pin as input
  pinMode(DIGITAL_INPUT_SOIL_SENSOR, INPUT);      
  // Register all sensors to gw (they will be created as child devices)  
  gw.present(CHILD_ID, S_MOTION);
}
 
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;
  }
  // Power down the radio and arduino until digital input changes.
  gw.sleep(INTERRUPT,CHANGE);
}
you have correct code on top of this topic. Change pin number to pin where you plugged device