Quo Vadis ? Stories from a home laboratory

13Feb/130

Balcony irrigation

A couple of years ago, I have installed the automated irrigation system in our apartment. After running this setup for an year, I have discovered some problems during the everyday operation:

  • due to the small capacity of the water tank, it was required to refill the tank frequently,
  • amount of water delivered to the plants was determined by time (averaged measured value I got with calibration) and was not accurate,
  • it was not possible to irrigate plants independently,
  • couple of times the whole water tank was used for single watering thanks to basic physics in action and lack of the valves.

In a meanwhile I have decided to automate the watering of the balcony plants as well, but also to fix the problems noticed in the first implementation.

First thing to solve was limitation of the water tank capacity. For this I have decided to use 65l SAMLA tank from Ikea. This tank could fit nicely on the balcony and contained enough water for 2 months operations.

Next, the new installation of flower beds and piping. For the flower beds I choose SOCKER since it provided easy installation on my balcony. For the pipes and sprinkles I sticked to the proven equipment from GARDENA.

Tripple sprinkle

Tripple sprinkle

Sprinkles

Sprinkles

Flower boxed with piping and sprinkles

Flower boxed with piping and sprinkles

Second thing to be done was the control unit. The two main improvements here were to find the way to measure the amount of the water to be used for the irrigation and to find the way to mechanically interrupt the flow.

In order to measure the flow of the water, after some googling, I have figured out that the easiest way for this would be to use the flow meter from a coffee machine. What I found was an old flow meter for Saeco espresso machine (you can find a lot of these on Amazon or eBay).

Saeco coffee machine flow meter

Saeco coffee machine flow meter

This flow meter is based on Hall sensor, and generates short electrical impulses that can indirectly be linked to the value of the flow of the fluid passing through the meter. The formula and calibration factor that was used later in the main control unit logic had been determined in a prior calibration experiment. Here is the code snippet from the main sketch that handles flow measurement:

...

#define FLOW_METER_UPDATE_RATE 250
#define FLOW_METER_CALIBRATION_FACTOR 0.36 // ml/pulse

...

// Flow Meter
bool flowMeterActive = false;
byte flowMeterInterrupt = 1;
byte flowMeterPin = 3;
volatile unsigned long flowMeterPulseCount;
unsigned long flowMeterPulses;
unsigned long flowMeterOldTime;
unsigned long flowMeterStartTime;
float flowMeterRate = 0.0;
float flowMeterQuantity = 0.0;

void flowMeterPulseCounter()
{
	flowMeterPulseCount++;
}

void flowMeterOn()
{
	flowMeterPulses = 0;
  	flowMeterPulseCount = 0;
	flowMeterOldTime = 0;
	flowMeterStartTime = millis();
	flowMeterRate = 0.0;
	flowMeterQuantity = 0.0;
	flowMeterActive = true;		
	attachInterrupt(flowMeterInterrupt, flowMeterPulseCounter, FALLING);
	#if TERMINAL
		serial << F("Flow Meter On") << endl;					  
	#endif
}

void flowMeterOff()
{
	detachInterrupt(flowMeterInterrupt);
	flowMeterProcess();
	flowMeterActive = false;
	flowMeterQuantity = 0.0;
	flowMeterRate = 0.0;
	flowMeterStartTime = 0;
	flowMeterOldTime = 0;
	flowMeterPulseCount = 0;
	flowMeterPulses = 0;
	#if TERMINAL
		serial << F("Flow Meter Off") << endl;					  
	#endif
}

...

void flowMeterProcess()
{
	if (flowMeterActive)
	{
		if((millis() - flowMeterOldTime) > FLOW_METER_UPDATE_RATE)
		{
			unsigned long lPulseCount = flowMeterPulseCount;
			flowMeterPulseCount -= lPulseCount;						
			flowMeterPulses += lPulseCount;
			
			
			flowMeterRate = (1.0 * FLOW_METER_UPDATE_RATE / (millis() - flowMeterOldTime)) * lPulseCount * FLOW_METER_CALIBRATION_FACTOR; // in L/min
			flowMeterOldTime = millis();
			
			flowMeterQuantity = flowMeterPulses * FLOW_METER_CALIBRATION_FACTOR;
			
			//serial << "   ... [" << (millis()-flowMeterStartTime) << "] Flow = " << flowMeterRate << " ml/s :: "<< (3.6*flowMeterRate) <<" L/h :: Pulses = "<< lPulseCount << "   -   Quantity = " << flowMeterQuantity << " ml :: Pulses = "<< flowMeterPulses << endl;
		}
		
	}
}

...

void loop() 
{
...
	flowMeterProcess();
...
}

In order to prevent uncontrolled flow of the water; the problem I experienced with previous design; the solution required some mechanical way of blocking the flow of the water that can be controlled electronically. The solution was solenoid valve.

Top view on solenoid valves and piping

Top view on solenoid valves and piping

Bottom view on solenoid valves, piping, flow meter and water pump

Bottom view on solenoid valves, piping, flow meter and water pump

I found some 220V solenoid valves and decided to control them using relays. Additional relay was used to control the state of the water pump.

After having all the "peripherals" figured out, I could concentrate on the control unit. The control unit was going to be based on JeeNode and on the other nodes in my home automation system Homy that I described in one of my previous posts Monitoring temperature and humidity.

Control unit - relays, power regulator and switches

Control unit - relays, power regulator and switches

Control unit - switches and integration board

Control unit - switches and integration board

Here is the short video of the testing of the control unit:

As one can see from the pictures, there were 2 different watering "channels" supported by this design; and in addition, an extension channel has been opened for more flowers to come.

The controlling of the system included extension of the central system software with enabling scheduling events of irrigation and extension of the mobile application to support control and real-time monitoring of the irrigation status.

And here are the videos of the system in action, first one is irrigation of pelargonia, and the second one the irrigation of tulips:

...

The system described here is already running for a couple of years. It even "survived" moving to the new apartment.

© 2013 - 2016, quo.vadis.stojkovic.ch. All rights reserved.

1,120 total views, 3 views today

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

No trackbacks yet.