Misting System for Greenhouse using Solenoid Valve

I am trying to create the code for a misting system for my greenhouse. The misting system will operate using a humidity sensor which will turn the valve on or off depending on the humidity level. There is also a potential temperature sensor that could be used. I am very new at using Arduino so I am curious if anybody has done a similar project and if you have, how did you approach the code? Would you have any examples? If you have not done something like this, I would appreciate any guidance you could provide me with how I could start or what I could do (and anything to keep in mind)?

would appreciate any guidance you could provide me with how I could start or what I could do

When we anticipate mechanizing a manual process, we need a 1) machine and 2) peripherals and 3) code. In this case 1== Arduino and 2== ? And 3 must wait for all 2's to be identified.

To start somewhere, let's pick as product that can be controlled by an Arduino: http://www.homedepot.com/p/Orbit-3-8-in-160-psi-Booster-Pump-92100/202271382#.UqpgyYco7bU

The above could be used as a 1-zone master mister. When your sensor(s) indicate things are too dry, the program branches to a routine to take s digital output and change the output state (default state would be whatever is needed to keep an AC relay board "open" - that is inactive. The change in state will cause an optics slack upper to bias a FET to power a replay to close the AC contacts which will start the pump.

The pump "on" condition can be "timed" or can be dynamic based on real time sensor input. Timed is easiest. At the end of nn seconds, the output port is switched to disengage the relay. The mist is now off.

A mandatory delay (wait period) may be required for the humidity to stabilize. After this period, the sensor(s) are read and the process starts over.

Caveats: - Control loops can be a very complex subject. Familiarize yourself with the concepts. - you may require zone misting and this will require electronic control of valves for water flow or electronic misting heads. It will also make the project very complicated because you MUST now write all voice as a state-machine; no more simple delays, etc.

Just food for thought. Anything can be changed. Draw it on paper then research the pumps and nozzles and sensors. The software comes later but post back BEFORE you buy so members can advise of any known concerns.


mrburnette: When we anticipate mechanizing a manual process, we need a 1) machine and 2) peripherals and 3) code

4) To get advice from somewhere else.

See ya later then!

mrburnette gave a detailed response to your question, your sniping was not called for.

Adafruit has a nice selection of humidity/temperature sensors (try http://www.adafruit.com/products/393) with plenty of documentation (tutorials) on how to use them.

The PID library is designed for this sort of problem. Specifically you'd be following the "RelayOutput" example. You'd be gluing the code from the Adafruit examples to get the humidity reading from the sensor to set the "Input" variable. Your "Setpoint" is the desired humidity level.

Nick Gammon, another user (DGlen) responded to that post, not vse, the original poster. And thank you mrburnett and chagrin for your responses. I will look into them. In the mean time, I am open to receiving any example code from someone who has done this type of sprinkler/misting system with a solenoid valve before.

Oh I see. Sorry. :)


Or how about does anyone have any experience writing code where with a press of a button, the solenoid valve will turn on/off. This way, there is no humidity/temperature accounted for.

I think we’ve all written code that turns something on or off when you press a button. How about taking a stab at that and posting your code?

Where do you think are the differences between switching an LED on (which is a standard example that can be found everywhere) and switching a pump or a valve on?