loading

Have you ever wanted a little plant to brighten up your desk or home, but you're afraid that you'll forget to water it? Fear no longer! Using an Arduino, a scavenged wall-wart, and a peristaltic pump, you can set up your plant to be watered as often as you like, from a jug or any other vessel. To be as accessible to as many people as possible, this tutorial can be done without soldering. That being said, the advantage of soldering is increased robustness and reliability.

Step 1: What you'll need

What you'll need:


(x1) Arduino UNO rev 3 (http://adafru.it/50)
(x1) USB cable (http://adafru.it/62)
(x1) 1N4001 diode (http://adafru.it/755)
(x1) PN2222A transistor (http://adafru.it/756)
(x1) 12v 1000mA DC power supply (http://adafru.it/798)
(x1) peristaltic pump (http://adafru.it/1150)
(x2) alligator clip test leads (http://adafru.it/1008)
(x1) 1k resistor

(x1) jug, glass, vase, or any other vessel that can contain water (not pictured)
(x1) a piece of scotch or electric tape (not pictured)

Tools: wire snippers, soldering iron + solder (not pictured)

<p>good job!</p>
<p>You said:-</p><p>The PN2222A transistor is great for this purpose because it can handle 5v from the Arduino without any resistors.</p><p>This is total and utter rubbish and will result in the Arduino being damaged. The Arduino has a pin limit of 40mA that is the limit of what it should supply, not the limit of what it can supply. It is likely that the base current without a resistor is being limited to about 80mA by the internal impedance of the Arduino pin and that is stopping the transistor from frying. This current is twice the level where damage to the Arduino is being done. You NEED a resistor, 1K should be fine. No doubt you will say it works, but your Arduino will fail a lot sooner that it otherwise would have.</p>
<p>I see that you live up to your name. But thanks for catching my mistake! I've updated the Instructable.</p>
<p>Hi!</p><p>Here, 1K prevented the pump to get enough current. I had to use a 220 resistor to make it work. </p>
<p>I made this - thanks a lot for the inspiration! But with me, the 1k resistor was too much, so it wasn't working. I changed to a 220, and then it worked. I hope this won't fry my arduino...</p>
<p>I made this with a few other instructables, so mine has a soil moisture sensor $3, connected to pin A5 and using an ethernet shield and set up a very simple website to monitor the moisture status of my plant. code below,</p><p>#include &lt;SPI.h&gt;</p><p>#include &lt;Ethernet.h&gt;</p><p>byte mac[] = { 0x00,0x1F,0xF3,0xD7,0x09,0x4C }; //physical mac address</p><p>byte ip[] = { 10, 0, 0, 253 }; // ip in lan (that's what you need to use in your browser. (&quot;192.168.0.178&quot;)</p><p>byte gateway[] = { 10, 0, 0, 1 }; // internet access via router</p><p>byte subnet[] = { 255, 255, 255, 0 }; //subnet mask</p><p>EthernetServer server(80); //server port </p><p>String readString;</p><p>int relay1 = 2; //relay1 on pin 2</p><p>int soil=0;</p><p>int motorPin = A0;</p><p>//00:1f:f3:d7:09:4c</p><p>void setup() {</p><p> // Open serial communications</p><p> Serial.begin(9600);</p><p> pinMode(relay1, OUTPUT);</p><p> // start the Ethernet connection and the server:</p><p> Ethernet.begin(mac, ip, gateway, subnet);</p><p> server.begin();</p><p> Serial.print(&quot;server is at &quot;);</p><p> Serial.println(Ethernet.localIP());</p><p> Serial.begin(9600);</p><p> pinMode(motorPin, OUTPUT);</p><p>}</p><p>void loop() {</p><p> /*========================================Soil sensor / pump mechanism============================================</p><p> using a 12v pump on 9v analog pin pump is triggered when moisture value falls within certain threshhold.and stops </p><p> immediately once it is satisfied.</p><p> */</p><p> // read the input on analog pin 5:</p><p> int sensorValue = analogRead(A5);</p><p> sensorValue = constrain(sensorValue, 485, 1023);</p><p> // print out the value you read:</p><p> if (sensorValue &gt; 900)</p><p> {</p><p> digitalWrite(motorPin,HIGH);</p><p> }</p><p> else digitalWrite(motorPin,LOW);</p><p> //map the value to a percentage</p><p> soil = map(sensorValue, 485, 1023, 100, 0);</p><p> // print out the soil water percentage you calculated:</p><p> //Serial.print(soil);</p><p> Serial.println(&quot;%&quot;);</p><p> delay(1000); // delay in between reads for stability</p><p> // Create a client connection</p><p> EthernetClient client = server.available();</p><p> if (client) {</p><p> while (client.connected()) { </p><p> if (client.available()) {</p><p> char c = client.read();</p><p> //read char by char HTTP request</p><p> if (readString.length() &lt; 100) {</p><p> //store characters to string</p><p> readString += c;</p><p> //Serial.print(c);</p><p> }</p><p> //if HTTP request has ended</p><p> if (c == '\n') { </p><p> Serial.println(readString); //print to serial monitor for debuging</p><p> client.println(&quot;HTTP/1.1 200 OK&quot;); //send new page</p><p> client.println(&quot;Content-Type: text/html&quot;);</p><p> client.println(); </p><p> client.println(&quot;&lt;HTML&gt;&quot;);</p><p> client.println(&quot;&lt;HEAD&gt;&quot;);</p><p> client.println(&quot;&lt;meta name='apple-mobile-web-app-capable' content='yes' /&gt;&quot;);</p><p> client.println(&quot;&lt;meta name='apple-mobile-web-app-status-bar-style' content='black-translucent' /&gt;&quot;);</p><p> client.println(&quot;&lt;link rel='stylesheet' type='text/css' href='http://randomnerdtutorials.com/ethernetcss.css' /&gt;&quot;);</p><p> client.println(&quot;&lt;TITLE&gt;SMART Home Control&lt;/TITLE&gt;&quot;);</p><p> client.println(&quot;&lt;/HEAD&gt;&quot;);</p><p> client.println(&quot;&lt;BODY&gt;&quot;);</p><p> client.println(&quot;&lt;H1&gt;VENUS CONTINGENCY home page&lt;/H1&gt;&quot;);</p><p> client.println(&quot;&lt;hr /&gt;&quot;);</p><p> client.println(&quot;&lt;br /&gt;&quot;); </p><p> client.println(&quot;&lt;H2&gt;home to the Arduino-Based Self-Regulating Venus Flytrap&lt;/H2&gt;&quot;);</p><p> client.println(&quot;&lt;br /&gt;&quot;); </p><p> client.println(&quot;&lt;a href=\&quot;/?potmoisture\&quot;\&quot;&gt;Refresh pot% &lt;/a&gt;&quot;);</p><p> if (readString.indexOf(&quot;?potmoisture&quot;) &gt;0){</p><p> client.println(&quot;&lt;H3&gt;current soil level is &quot;);</p><p> client.println(soil);</p><p> client.println(&quot;%&lt;/H3&gt;&quot;);</p><p> }</p><p> client.println(&quot;&lt;a href=\&quot;/?waterlvl\&quot;\&quot;&gt;Refresh waterlvl% &lt;/a&gt;&lt;br /&gt;&quot;);</p><p> client.println(&quot;&lt;br /&gt;&quot;); </p><p> client.println(&quot;Created by Joshua Kiefer and Jacob Kiefer&quot;);</p><p> client.println(&quot;&lt;/BODY&gt;&quot;);</p><p> client.println(&quot;&lt;/HTML&gt;&quot;);</p><p> delay(1);</p><p> //stopping client</p><p> client.stop();</p><p> //controls the Arduino if you press the buttons</p><p> if (readString.indexOf(&quot;?potmoisture&quot;) &gt;0){</p><p> digitalWrite(relay1, HIGH);</p><p> }</p><p> if (readString.indexOf(&quot;?lamp1off&quot;) &gt;0){</p><p> digitalWrite(relay1, LOW);</p><p> }</p><p> //clearing string for next read</p><p> readString=&quot;&quot;; </p><p> }</p><p> }</p><p> }</p><p>}</p><p>}</p>
I need a program which can start a 5v relay automatically daily in 4 pm of arduino uno
<p>I fried the board (cheep copy anyway), and now I know why as you can see in the specs down below of max current the different pins can handle, and as a couple of people have noted. This motor draws about 300mA. My projects has to fill about half a liter of water and the time of running the motor is therefor about 10 min. </p><p> http://playground.arduino.cc/Main/ArduinoPinCurrentLimitations</p><p>I gonna try to switch a transistor on and of instead so the motor will work on a separate circuit. Will share when I succeed. </p>
<p>Sorry you fried your board! You weren't trying to run the motor directly off the board itself, right? This design already uses a transistor. That being said, people more knowledgeable than myself are saying to use a 1k resistor in series between the board and the base pin of the transistor, so make sure you do that.</p>
No worries it cost me 10 bucks :), it was worth it. Yes I connected it as described so the 12v 300mA if Im understanding it correct had to travel thru the board, ground to collector and + to Vin. I red that post and put the 1k resistor on. But I have seen schematics that are using the arduino as a trigger of the base of a transistor which then control a bigger load and the ground is the only common place so to speak to somewhat isolate the circuit. <br><br>I had a timer on as well, in the wall and a transformer(12v) going to the board, so when I started to fiddle with the timer something sparked and it smelled burned. May have something to do with BackEMF from the timer Im guessing and the overload of the pin. <br><br>I need to control the pump so it pumps about a liter of water three times a day. I gonna try another approach.
<p>Ah, I see what you mean about the Vin pin. But with a genuine Uno, the Vin pin appears to be connected directly to the incoming power supply with nothing in between: <a href="https://www.arduino.cc/en/uploads/Main/arduino-uno-schematic.pdf" rel="nofollow">https://www.arduino.cc/en/uploads/Main/arduino-uno...</a></p><p>But yeah, 3 liters per day is a lot. Best of luck!</p>
<p>Hi</p><p>&quot;The PN2222A transistor is great for this purpose because it can handle 5v from the Arduino without any resistors.&quot;</p><p>Sorry that is wrong, the Veb is 6V, this is the reverse bias breakdown voltage of the 2N2222A not the forward drop which is 0.6 to 0.7Vdc</p><p>Please!!!! Place a 1K resistor between the output of the arduino and the transistor base, to limit base current.</p><p>You are very lucky if you do not have a base resistor to not have caused damage to your arduino and or 2N2222A.</p><p>Tom</p>
<p>Thanks for the info, I've updated the Instructable to reflect the 1k resistor.</p>
<p>hello, first of all i want to thank you for such a helpful information. Sir, i m from computer faculty so i want to innovate this idea with mobile app. Can you help me out for basic idea about what should i do for these.</p>
<p>I would use a Particle Core or Particle Photon. They're essentially wifi-connected Arduinos that you can program and control via the web. Once you understand their API, it should be no problem to integrate it into an app.</p>
<p>alrite, i made it. but what can i do to check water level in the container. am using a submersible pump that should not be used without it being completely submerged. so it helps to have some way to check if the water in the reservoir is getting depleted</p>
<p>You have a great project, I like it when its simple. I have a problem with your code though, I can't get wait time beyond about 30 seconds. I think its limited to 32767 ms, but with the ()'s it should go farther. What version of Arduino are you using.</p>
<p>instead of just delay(waitTime) you can use:</p><p><br>int waitTime = 32000;</p><p>int cycle = 0;</p><p>void loop(){</p><p>...</p><p>while(cycle&lt;1000){ //if you waited waitTime x Cycles you can go on</p><p>delay(waitTime); //wait 32 seconds<br>cycle+=1; //increase cycle by 1</p><p>}<br>cycle=0;</p><p>....</p><p>}</p>
<p>Hmmmm good point, you may have to use a long instead of an int.</p>
<p>I just love it when a GREAT project such as this is posted how all of the &quot;experts&quot; pop up to give advice on how to &quot;do it better&quot;...</p>
<p>I'm very glad you like it! I actually appreciate all the comments on how it could be improved, because it opens my eyes to things I hadn't thought of, and broadens my perspective.</p>
<p>Great project! Nice job.</p><p>I did not want to sacrifice my arduino for it, and made one with these parts :</p><p><a href="http://www.banggood.com/Soil-Hygrometer-Humidity-Detection-Module-Moisture-Sensor-For-Arduino-p-79227.html" rel="nofollow">http://www.banggood.com/Soil-Hygrometer-Humidity-D...</a></p><p><a href="http://www.banggood.com/1-Channel-5V-Relay-Module-Shield-Board-For-Arduino-ARM-PIC-AVR-DSP-ARM-p-914846.html" rel="nofollow">http://www.banggood.com/1-Channel-5V-Relay-Module-...</a></p><p>an aquaruim waterpump and a 5volt powersupply. </p><p>Let it grow !</p>
<p>Great idea, and very cheap! I didn't realize that sensor could operate without an arduino. Did you have any trouble calibrating it so the soil had the right moisture level?</p>
<p>There is a little blue potentiometer on the board, it was very easy to calibrate the relay. <br><br></p>
<p>You should consider writing an instructable for your project! </p>
<p>Very nice and good tutorial! Congrats on it! </p><p>However there is one thing of which I am concerned. I checked the data sheet of the pump and found out that the current of the pump motor is 200-300 mA. Arduino max current output is 30 mA. Will not the motor destroy Arduino? Please explain if I am wrong (I would like to learn! :))</p><p>Thank you and congrats again!</p>
<p>The current limits for the Uno are 40mA from any one I/O pin or 200mA from all I/O pins combined, and 50mA from the 3.3V supply pin. </p><p>The only I/O pin he is using is A0 to drive the transistor which will be very well under 40mA. </p><p>I'm not sure exactly what the current limit for the 5V supply pin is. I think it might be 1.5amps, but it's at least 500mA which is the most that can be drawn over a standard USB port. </p><p>However, he is not using the 5V supply pin to power the pump (which would be bad because dropping 12-5=7volts @ 300mA would require dissipating 2.1 watts of power which would definitely overheat the voltage regulator)- he is using the Vin pin which he is supplying with 12V. That is, the same 12V supply that is powering the Arduino through the 5V regulator is directly connected to one side of the transistor. The pump is connected to the other side and when A0 goes HIGH, the pump will draw current directly from the 12V supply. More explanations: </p><p><a href="http://bildr.org/2011/03/high-power-control-with-arduino-and-tip120/" rel="nofollow">http://bildr.org/2011/03/high-power-control-with-arduino-and-tip120/</a></p>
<p>You would be correct if we were powering the pump directly from the arduino. However, we are only using the arduinio to switch on a transistor. The transistor can handle much higher current and voltage than the arduino.</p>
<p>Dear osmithy. Thank you for your reply. I don't understand then. :) What is powering the pump? From the schematics I see that the pump is powered from the arduino 5V pin and the transistor is controlled by the A0 analog pin. I don't see any other power source. I am confused. Please help.</p>
<p>Nice project. I think though that the container you are using might be empty pretty soon :-)</p>
<p>Thanks! The container runs out in about a week which is not bad.</p>
<p>not too bad :-)</p>
<p>very nice osmithy. you can easily add a sleek plant arm to the pot, so it has light..! please check out my designs, i'm in the process of combining the two technologies...</p><p><a href="http://www.instructables.com/id/USB-powered-LED-plant-light-20/" rel="nofollow">http://www.instructables.com/id/USB-powered-LED-pl...</a></p><p>love &amp; peace...</p>
<p>Really cool! I posted a comment on your project.</p>
<p>I found a cheap plant waterer on indeigogo crowdfunding. https://www.indiegogo.com/projects/daisy-si-smart-plant-waterer</p>
<p>Wow, it looks like they don't even use a pump, just gravity. That allows their device to run off AAA batteries for years instead of needing to be plugged in. Pretty cool!</p>
<p>Great project! I have an arduino that is just collecting dust in my project box. I wonder how difficult it would be to measure the moisture content of that water and so make the unit almost autonomous. Here is a dirt cheap sensor:<br>http://goo.gl/5MXSyO Shipping is free but it can take between 4 to 6 weeks.</p>
<p>Actually that is not really difficult tmorsch. All you need to do is make the sensor part of a voltage divider and let the arduino measure the voltage over that divider:</p><p><a href="http://www.instructables.com/id/Watering-your-plants-with-a-microcontroller" rel="nofollow">http://www.instructables.com/id/Watering-your-plan...</a><br>In fact you dont even need an Arduino: </p><p><a href="http://www.instructables.com/id/Irrigating-your-garden-with-an-opamp-The-circuit/" rel="nofollow">http://www.instructables.com/id/Irrigating-your-ga...</a></p><p>In fact, the sensor that you mention has an Op amp as a comparator, on that little companion board and in fact you dont need an Arduino to make an automatic irrigator with that, only need to attach a relay to the board.<br>However, some of these cheap humidity sensor boards actually give a HIGH signal when the resistance on the moisture sensor is LOW (i.e. when the soil is wet), so a relay would do exactly the opposite of what you want: irrigate when it is wet. In that case you either would have to use the NC contact of the relay (but yr relay would be pulling power when there is no irrigation) or you would need to switch the relay via an inverter (e.g. a PNP transistor).<br>If you dont want to wait 4-6 weeks for ordering, just use two galvanized nails with yr Arduino and grab the program I put in my instructable)<br></p>
<p>Wowwwww that is so cheap! You could absolutely make it autonomous if you used one of those, and it wouldn't be difficult at all. I knew about the one Adafruit sells but it's $50, so I didn't use it.</p>
good idea..but what you are doing is a on and off timer ...this you can do with a 555 ..cost too less...so i expect a microcontroller to do some more complex task...any way thanks for sharing
<p>There are definitely cheaper ways to do the same thing, but 555s are confusing to me. And also it's easier to upload new code than to get new resistors and capacitors. But now I'm curious - what component values would you use to make a 555 that turns on for 10 seconds every hour?</p>
<p>I think the use of the MCU is not an overkill as this would offer the possibility to be upgraded with more featues if you want. And it also offers a good reason to learn about sleep modes and other features of the atmega. </p><p>I think if I would do this kind of projekt in that scale, I would use one of those popular darlington arrays as the ULN2003 as a one chip solution. You can use with higher load and it comes with protection against reverse current spike when stopping the motor. It would minimize the possibility to fry the atmega.</p>
hi smith...i would use 4.7k good quality cap..if i need timer of 1hr or so..but for large timer i prefer cd4060... http://www.electroschematics.com/6189/time-delay-relay/
<p>The other thing you could do that would really use a microcontroller's power is to incorporate a soil moisture sensor. Then you would never have to worry about over- or under-watering.</p>
<p>you could use two 555 , one to activate every hour which will activate the second one for 10 seconds. <a href="http://www.csgnetwork.com/ne555timer1calc.html" rel="nofollow">http://www.csgnetwork.com/ne555timer1calc.html</a> this site might help</p>
<p>Really nice project, and well-presented for those of us who are just starting out with Arduino. I've been looking to do something similar to maintain water levels in egg incubators&hellip;I'll probably connect a humidity sensor.</p>
<p>Thanks so much! I'm glad you found it useful. Humidity sensors are great too. I used one to control an ultrasonic humidifier, and it worked very well. However, I had to hack one of those wireless outlet things because I didn't want to mess around with relays and switching mains voltage. Now that I think about it, that hack may be my next instructable.</p>
<p>hahaha its nice but not that practical project. :) but pls send me some of your works sir.. cuz evrything is interesting! :) very nice.. hehe ty !</p>
Use a solid state relay with the arduino. Mine can switch 3v and up to turn on 12-240v
That sounds awesome. Do you have the model number?

About This Instructable

117,618views

495favorites

License:

More by osmithy:Automatically water your small indoor plant using Arduino + pump 
Add instructable to: