Automatic Misting System
This guide covers a temperature activated misting system that connects to a standard garden hose. This project was done in conjunction with an automated, upcycled chicken coop so the design makes room for other features to be included. However, the design is versatile enough to be applied anywhere with a garden hose!
Gather Materials
The misting system is divided into the activation circuit and the physical hose system.
For the circuit you will need:
The the hose system you will need:
- 12V DC Solenoid valve (rated for water use and for pressure up to 75 psi)
- 2 garden hoses
- Garden hose water faucet
- Adaptors to connect garden hoses (typically 3/4") to solenoid
- PVC pipe with end cap on one end and 3/4" hose thread adaptor on other end
- Misters (inexpensive misting nozzles available on Amazon and elsewhere)
- Thread lock tape
Tools
- Drill and drill bits
- PVC sealant/adhesive
- Wrench
The Circuit
The circuit is divided into 2 sub-circuits. One circuit detects the current air temperature while the other circuit activates the misters. Both circuits connect to an Arduino which will needs its own power source, though an additional, higher voltage battery is recommended.
Temperature Circuit
The temperature circuit consists of the DS18b20 temperature sensor and a 10k resistor.
1.Connect the ground cable (black wire) on the temperature sensor to the Arduino's ground node.
2. Span the resistor between the data cable (yellow wire) and the power cable (red wire).
3. Connect the red wire to the Arduino's 5V output.
4. Connect the yellow wire to any of the digital pins, but take note of which pin the yellow wire goes into (you will need this later for the code.
Activation Circuit
The activation circuit consists of a 1k resistor, a TIP120 Darlington transistor, a 1N4001 diode, and a solenoid valve.
1. Start by connecting the first pin on the transistor to on open digital pin on the Arduino with the 1k resistor in between. As before, the particular digital pin does not matter but note which pin you connect. Then connect the third pin of the transistor to the common ground (the same node used for the previous circuit's ground).
2. Connect the middle pin on the transistor to the anode side of the diode (the side without a band).
3. Connect a positive voltage power source to the cathode side of the diode. While this power source could be the same Arduino output voltage used with the temperature sensor, we recommend using a higher voltage for most solenoids; a 9V or 12V battery would work well as long as the extra battery is grounded to the circuit's common ground.
4. Finally, the solenoid can be connected to the circuit with one node at the cathode of the diode and the other at the anode of the diode. The direction of the solenoid in the circuit does not matter.
The Code
Download Code from GitHub
https://github.com/bmgatten/ChickenCoop
<p>#include <br>#include #define ONE_WIRE_BUS 5 //Change this number to the correct pin OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire);</p><p>float Celcius=0; float Fahrenheit=0; int solenoidPin = 8; //Change this number to the correct pin</p><p>void setup() { Serial.begin(9600);</p><p> sensors.begin(); //Initializes the temperature sensor pinMode(solenoidPin, OUTPUT); //Sets the solenoid as an output }</p><p>void loop() { // Acquires temperature data sensors.requestTemperatures(); Celcius=sensors.getTempCByIndex(0); Fahrenheit=sensors.toFahrenheit(Celcius);</p><p> // Prints the temperatures that the sensor reads Serial.print(" C "); Serial.print(Celcius); Serial.print(" F "); Serial.println(Fahrenheit);</p><p> // Uses temperature data to determine whether or not to turn on solenoid if (Fahrenheit > 70) { // Set desired critical temperature digitalWrite(solenoidPin,HIGH); } else { digitalWrite(solenoidPin,LOW); }</p><p> delay(500); // Wait half a second }</p>
Implementing Code
We have provided an image (and file) of the code we used for this circuit. You are welcome to use and modify the code as you desire. Note that this template uses two libraries: DallasTemperature and OneWire.
There are three places in the code where you need to insert your own values. The first occurs on the line:
#define ONE_WIRE_BUS 5
Currently this sets the temperature sensor's data pin to pin 5 on the Arduino, change this value to whichever pin you connected with your temperature sensor.
The next location is the line:
int solenoidPin = 8;
Currently this sets the actuation of the solenoid to pin 8. Change this value to whichever pin you used to connect the Arduino to the transistor.
Finally, locate the conditional in the void loop that reads:
if (Fahrenheit > 70) {
Currently this will activate the misters when the temperature is above 70 degrees Fahrenheit. A more realistic value might be somewhere around 90 or 100 degrees Fahrenheit, but this value will depend on your preference or application.
You may also note a delay at the last line of code that waits half a second before running the loop again. If you are combining this code with another script on the same Arduino, you might want to change or even remove this delay depending on how the other script interacts with the Arduino.
When all the desired changes are made, upload the script to the Arduino.
Solenoid Adaptors and Hoses
- Identify threading on your solenoid valve (Ours was 1/4" pipe thread)
- Find adaptors so that hoses can thread into both ends (typically 3/4")
- Use thread seal tape on threads to reduce risk of leaks
- Connect adaptors
Mister Array
- Acquire PVC pipe, end cap, threaded adaptor, and misters
- Determine rough mister thread size by either option below:
- Measure inner and outer diameter of mister threads and comparing to drill bits
- Drill test holes into scrap plastic and attempt to thread mister in
- Mark desired hole locations (we recommend starting with 2 misters and adding more if water pressure is sufficient)
- Drill holes clean up the edges of holes
- Begin to thread in the misters by hand, being careful to thread in straight
- Tighten misters with wrench to cut threads. Make sure to tighten until rubber O-rings squish to form seal
- Screw hose into PVC adaptor
- Check flow direction of solenoid. This should be indicated by an arrow on the body of the solenoid
- Screw mister hose into adaptor on downstream side of solenoid
- Connect water supply hose to upstream direction of solenoid so water will flow in correct direction
Put It Together
You are almost done! All that you need to do now is put it all together.
- Connect the solenoid on the misting array to the circuit. The directions of the wires do not matter as long as the wires are on the nodes separated by the diode. Feel free to use longer wires if you wish to set your misting array further from your circuit.
- Place your temperature sensor in a "good" place to measure air temperature. "Good" places would be shaded so that the sensor is out of direct sunlight. In the case of our project, we placed the temperature sensor beneath the eave of a chicken coop so that it was nearby the controller, and shaded from direct sunlight.
- If you haven't already, upload the code to your Arduino.
- Turn on your facet.
- Power the circuit. Plug the circuit into the power sources. Remember, there will be two sources of power: a 5V source to power the Arduino and temperature sensor; and a 12V source to power the solenoid.
- Secure electronics to prevent damage from pecking. We accomplished this by adding a wooden hinged box around our battery, and adding other wooden covers over other electronic components.
Congratulations! You now have a customized, automatic misting system of your own. You can feel free to test it by placing the temperature sensor in boiling water. Once the temperature sensor heats up, you should see your misters start running!