Irrigation computer with MySensor. Noob needs some help.



  • I'm doing my first real Mysenors project. Off course i already build a working gateway, and did a couple of example nodes like the relay and DHT11 sensor to test. But that is about as far as it goes. I have never written any code (just 1 phyton script 2 weeks ago). So this will be the first time i will really be writing code for the arduino. I need some directions to start with. I hope you can help.

    Some time ago before i started with automating my house, i bought a irrigation computer of aliexpress:
    0_1460060822128_sproeicomputer.JPG

    I want to hook this up to my house automation. Specificly a Raspberry Pi with Domoticz. In a later stage i will also build a sensor that checks how dry the ground is. I will create a function that will check is the ground is too dry in my vegetable garden, and if the forecast says it wil not rain for another 12 hours or so, it will be watered.

    I opened up the computer and it turns out to be very simple to hack. It has 2 sets of the following: A motor with gears turning a valve around. When the valve is closed a mechanical switch is open, and output voltage is logical 1 (VCC). When the valve is turned open, the switch shorts to ground, and the output is a logical 0 (GND)

    The arduino output i need is simple
    Standby state: Logical 1 input for arduino
    Opening valve: Logical 1 output from arduino to a FET to spin the motor.
    Valve opened: Input changes to 0. Output to fet must change to 0 directly so the motor stops.
    Closing valve: Logical 1 output from arduino to a FET to spin the motor.
    Valve closed (stand by state): Input changes to 1. Output to fet must change to 0 directly so the motor stops.

    Instead of sending on or off commands, i want to send a "Turn on for XXX minutes commands". The reason for this is that the water will always turn off. Even if the controler crashes or the transmission fails.

    Additionally i want the status of the valves to be available in the controller. Also this system will run on 2 AA batteries, so the code needs to be efficient. I'm planing on using a 3V Pro Mini

    I already build a demo setup on a breadboard using a Nano V3 some LED's and some switches.

    No i just needs some advice on where to start. Is there a sketch that is a good base for this? Also, can you guys recommend "a function from the library" that can sent a "go on for X seconds" command and is compatible with Domoticz?

    Your help is very appreciated!

    0_1460060338169_IMG_20160407_221316869 (1).jpg



  • Nobody? Its very hard for me to know where to start. I want a good combination between the controller (domiticz) and the sensors available in mysensors


  • Contest Winner

    @SuperKris It's hard to say the best starting point. Mostly because your ideas have to be implemented in Domoticz (with LUA script).

    Sensors and actuators should remain simple. So saying that a sensor most be on for an amount of time, would be something you'd handle in Domoticz. Thus:

    1. Have an actuator that will turn on/off the irrigation with mySensors.
    2. Create the logic in Domoticz.

    The MySensor part is pretty easy. The relay and binary switch examples are good starting points.

    I'd personally seperate the MySensor circuit from the irrigation controller with a relay of opto coupler. But I'm more a software guy than a hardware guy. Other people might be able to help you with that.



  • Thanks for the reply! At this point i have no experience with LUA, but from my earlier experiments with domoticz and mysensors, i do not see what i need the LUA script for.

    I want som make de controler (domitcz) as stupid as possible. Domotics must decide when the irrigation must be activated, but it must not turn it of unless i give a manual command is given.

    I want the system the external device (Arduino/mysensors) to control when the irrigation should stop. I do not want this logic in Domoticz. If domotics or the RPi crashes or the transmission fails, the irrigation system will never receive a off command, and will keep running.

    Therefore i want Domitcs to tell the system to activate for a X amount of minutes. Alternatively it could be just 3 different "on signals" for a duration of 5, 10 and 30 minutes.

    Currently i'm already experimenting with the relay and binary switch example as basis, but i still have no idea what i'm doing. I was hoping there already was a standard (domitcs compatible) senor type that could sent a value from domotics to the mysensor device.

    I dont think a opto coupler is needed as everything will run on 2 AA batteries. No that that arduino is going to damage the fet controling the motors. Maybe i'll use a diode to make sure the uC of the irrigation device will not be damaged, but i dont even think that is really needed.



  • @SuperKris

    Have you read through the project thread on the irrigation controller? It is a long thread but there was some discussion on sending 'sprinkler on' times from Domoticz.


Log in to reply
 

Suggested Topics

1
Online

11.2k
Users

11.1k
Topics

112.5k
Posts