Moisture Sensor

Moderator: leecollings

Post Reply
treb0r
Posts: 10
Joined: Friday 19 June 2015 13:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Moisture Sensor

Post 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
User avatar
gizmocuz
Posts: 2552
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Moisture Sensor

Post by gizmocuz »

that is because this is not implemented in the event system, someone has to add support for percentage checking
Quality outlives Quantity!
treb0r
Posts: 10
Joined: Friday 19 June 2015 13:47
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Moisture Sensor

Post 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?
User avatar
thecosmicgate
Posts: 188
Joined: Monday 06 April 2015 14:37
Target OS: Linux
Domoticz version: newest
Location: The Netherlands / Hoeven
Contact:

Re: Moisture Sensor

Post 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
It's nice to be important, but it's more important to be nice
Scooter ;)
User avatar
gizmocuz
Posts: 2552
Joined: Thursday 11 July 2013 18:59
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Top of the world
Contact:

Re: Moisture Sensor

Post 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
Quality outlives Quantity!
User avatar
thecosmicgate
Posts: 188
Joined: Monday 06 April 2015 14:37
Target OS: Linux
Domoticz version: newest
Location: The Netherlands / Hoeven
Contact:

Re: Moisture Sensor

Post 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
It's nice to be important, but it's more important to be nice
Scooter ;)
sundberg84
Posts: 52
Joined: Sunday 17 May 2015 11:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Sweden
Contact:

Re: Moisture Sensor

Post 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.
Controller: Domoticz (Raspberry PI)
Gateways: MySensors (Ethernet W5100), RFLink
User avatar
thecosmicgate
Posts: 188
Joined: Monday 06 April 2015 14:37
Target OS: Linux
Domoticz version: newest
Location: The Netherlands / Hoeven
Contact:

Re: Moisture Sensor

Post 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
It's nice to be important, but it's more important to be nice
Scooter ;)
User avatar
thecosmicgate
Posts: 188
Joined: Monday 06 April 2015 14:37
Target OS: Linux
Domoticz version: newest
Location: The Netherlands / Hoeven
Contact:

Re: Moisture Sensor

Post 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 ?
It's nice to be important, but it's more important to be nice
Scooter ;)
Abbadon
Posts: 40
Joined: Thursday 01 October 2015 8:25
Target OS: Raspberry Pi / ODroid
Domoticz version: beta
Location: Poland, Wrocław
Contact:

Re: Moisture Sensor

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest