int water; //random variable void setup() { pinMode(3,OUTPUT); //output pin for relay board, this will sent signal to the relay pinMode(6,INPUT); //input pin coming from soil sensor } void loop() { water = digitalRead(6); // reading the coming signal from the soil sensor if(water == HIGH) // if water level is full then cut the relay { digitalWrite(3,LOW); // low is to cut the relay } else { digitalWrite(3,HIGH); //high to continue proving signal and water supply } delay(400); }
Sir ...I connected all and the motor is running...but when I put sensor in the mud or water motor also running it doesn't on or off ...what can I do for this problem plz solve this 🙏
@@khadizayesminnodi8786 I had this problem until I fixed the code void setup() { pinMode(3, OUTPUT); // output pin for relay board, this will send signal to the relay pinMode(6, INPUT); // input pin coming from soil sensor } void loop() { int water = digitalRead(6); // reading the signal coming from the soil sensor if (water == HIGH) { // if water level is low (i.e., soil is dry) then turn on the relay digitalWrite(3, HIGH); // high is to turn on the relay } else { // if water level is high (i.e., soil is wet) then turn off the relay digitalWrite(3, LOW); // low is to turn off the relay } delay(400); } Enter this code, most likely the problem will be solved
Put a toilet cistern on wall when it needs filling it will do it as the float lowers & a 12vdc solenoid when the dirt become dry it switches on solenoid & allows water to flow from cistern down through solenoid make a ring with small 5-6mm poly garden hose & tee to connect to solenoid output drill some 1mm holes in underside of the poly tube ring (holes face down to soil) when soil becomes damp enough it switches water solenoid off until soil becomes dry again
Sometimes the powersupply from the relay is not sufficient enough to power the motor pump. In that case, modify the following connection: 1) NO pin of relay-->one end of the motor pump 2) COM pin of relay--> -ve external power supply 3) Other end of motor pump --->+ve power supply. Rest all the video is perfect!
good one! but I made some changes in the code and in the system. I replaced the pins and recoded them for the Arduino Nano microcontroller. I found that when the sensor was giving a low signal the relay (motor) went off. That makes no logical and practical point, when soil is already wet why would we want more water to be pumped into the soil? It should be another way around, which means when the soil is found dry by the sensor it should pump the water from the tank to the surface of the soil. For that, I simply changed the code from HIGH to LOW. if(water == LOW) // Line number 9 Also, I directly connected the DC motor water pump to the pin instead of a relay. Using a relay would be overkill if I want to use it for just a small plant. Relay can be useful If I want to trigger a high voltage bigger AC motor with the same system. To maybe water a whole garden, a park, or a field of crops. But very useful watching you in this video encouraged me to finish a project I was working on for more than 6 years from now. Thanks a lot. I made a video too, not a tutorial but of the functioning project. Though I have to think about giving power to the microcontroller, currently I used my battery bank. I'll try to make a permanent and durable setup.
I'm delighted to see the enthusiasm around the code modifications I made! To help everyone understand the changes, I've created a detailed video explaining the process. You can find the link to the code in the video description. Happy making, and thank you for your interest! For the full tutorial, check out my RU-vid video: Click here ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-Ct0QxOE1f1A.html @@shivanidubey1716
Thanks broo. But I have one simple question can you explain me please. Question is solar powered smart Irrigation using IoT project title, which project is possible?? Please reply me 🥺
To modify your Arduino code to have a burst of 3 seconds followed by no output for 90 seconds, you can use the `millis()` function to track time. Here's an updated version of your code: ```cpp int water; // Random variable unsigned long previousMillis = 0; const long burstDuration = 3000; // 3 seconds const long pauseDuration = 90000; // 90 seconds void setup() { pinMode(3, OUTPUT); // Output pin for relay board pinMode(6, INPUT); // Input pin coming from soil sensor } void loop() { water = digitalRead(6); // Read the incoming signal from the soil sensor unsigned long currentMillis = millis(); if (currentMillis - previousMillis < burstDuration) { // Burst duration: 3 seconds if (water == HIGH) { digitalWrite(3, LOW); // Cut the relay } else { digitalWrite(3, HIGH); // Continue providing signal and water supply } } else { // Pause duration: 90 seconds digitalWrite(3, HIGH); // Ensure the relay is off during the pause if (currentMillis - previousMillis >= burstDuration + pauseDuration) { // Reset the timer when the pause duration is over previousMillis = currentMillis; } } delay(400); // Optional delay for stability } ``` This code will provide a burst of output for 3 seconds, followed by no output for 90 seconds, and then the cycle will repeat. The `millis()` function is used to keep track of time, and it compares the current time with the previous time to control the relay output accordingly.
Could please explain what is the 5V supply that you connected to the relay and the water pump? I don't understand. This is my first project like this. Thank you!!!
Sir can you please tell me is the green wire connected to the + of the battery or to the - of the battery and did you Connect the - ve of the pump with the relay N/O pin? Great video sir thank you very much
See the positive negative doesn't matter in the pump which is used in the video.. U just have to connect one wire of the pump directly to the battery and the other wire u have to connect it to the battery but through the relay module... The connection will be same as we do for connecting a switch to any simple circuit...
Hello friend, thank you for the video. Can we submerge the sensor quite deep in the soil and wrap the sensor and the cable connection with electrical tape? Thank you for the kind response.
Hello, I have a queation aobut Soil Moisture Sensor, why my Soil Moisture Sensor touch the water but water pump won't stop? I also print the value of the moisture. the value is keep in value=0, is my moisture is broken?
sorry sir, can u help me, my relay just red LED is on, but the green one is no. and relay for pump is not working (even the sensor is wet or not wet). my coding exactly same just like the this youtube.
Aap plz circuit pura bataya kare 2 chizen aapne kati hai relay coil se battery connect ki ya kuch aur dusri aapne program ko Arduino se connect kese kiya plz reply !!! Aapne programme compile to kiya but hamne kiya to no board found bata raha hai
based on the comment, it seems he connected it into another powerbank. but he also said we can use a 9v battery instead. ill try it out in a few hours and see if it works. if i remember myself commenting here then ill try to update you too 😅
Will it work when connected to a laptop or need a power supply? When I rotate the potentiometer both lights on the water sensor board start glowing and the green light on the relay is turned off is that ok?
If u r asking about how to upload the code then u have to use arduino ide which is a computer software but if you want to upload the code using your phone then you can watch this video - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-FU7PHi79Q2Q.htmlsi=ZvTLGn5uPpdM95UZ or if you want to download and install the arduino ide then you can watch this video - ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-oL23ZVML-Yw.htmlsi=Zd-4QHSRdR_eJ8QC
For pump you can use 9 volt battery but for Arduino it depends from which socket you are giving power to the Arduino If you are using the power jack then you can give maximum upto 12 volt but if you giving power through the USB cable then you can use power Bank or charger adapter.
@@TechieLaganGoodmorning sir, may I just ask how you have connected the 9 volt battery? Thank you so much and please reply fast sir, my project is due next week.Thank you again
Ig u r asking about the power supply to the pump. So it is directly connected to the 9 volt battery through the relay module . Here the relay is acting as a switch.
Yes , definitely it could be modified. In that case u have to use multiple soil moisture sensors, relay modules and pumps. But no need to use multiple arduinos, one Arduino will be enough. And also u have to do some changes with the code.
I hope this message finds you well. FLow sensing is costly and trickey , I am are writing to provide you with information on the calibration and prediction of flow rate and the time required to dispense water under varying pressure conditions. This knowledge is essential for efficient water management and distribution in various applications. Flow rate is a crucial parameter, and it is influenced by several factors, including the water source, pipeline type, and pressure control mechanisms in place. For consistency and reliability in maintaining pressure, there are options such as utilizing pumps, auto-filling overhead tanks, or employing devices like the Pressure Controllers. To calculate the flow rate and the time needed to dispense 1000 liters of water with a pressure of 3 bar, we've collected the following data: At 2 bar pressure, the tap dispenses 20 liters of water in 1 minute. At 4 bar pressure, the tap dispenses 40 liters of water in 1 minute. Let's begin by determining the flow rates at both 2 bar and 4 bar pressure: Flow Rate at 2 bar pressure: Flow rate = Volume / Time Flow rate = 20 liters / 1 minute Flow rate = 20 liters/minute Flow Rate at 4 bar pressure: Flow rate = 40 liters / 1 minute Flow rate = 40 liters/minute Now, we need to find the flow rate at 3 bar pressure. Given the flow rates at 2 bar and 4 bar, we can assume that the relationship between flow rate and pressure is linear. To estimate the flow rate at 3 bar pressure, we can use linear interpolation. First, we calculate the flow rate increase per bar of pressure: Flow rate increase per bar = (Flow rate at 4 bar - Flow rate at 2 bar) / (4 bar - 2 bar) Flow rate increase per bar = (40 liters/minute - 20 liters/minute) / (4 bar - 2 bar) Flow rate increase per bar = 20 liters/minute / 2 bar Flow rate increase per bar = 10 liters/minute/bar Now, we can find the flow rate at 3 bar: Flow rate at 3 bar = Flow rate at 2 bar + (Flow rate increase per bar * (3 bar - 2 bar)) Flow rate at 3 bar = 20 liters/minute + (10 liters/minute/bar * (3 bar - 2 bar)) Flow rate at 3 bar = 20 liters/minute + (10 liters/minute) Flow rate at 3 bar = 30 liters/minute With a flow rate of 30 liters/minute at 3 bar pressure, we can calculate the time required to dispense 1000 liters of water: Time = Volume / Flow rate Time = 1000 liters / 30 liters/minute Time = 33.33 minutes In conclusion, it would take approximately 33.33 minutes to dispense 1000 liters of water at a pressure of 3 bar. This information is valuable for planning and optimizing water distribution processes in your specific application.
This pump has to be submerged in the water right? I tried to transfer water from one cup to another cup while the pump is outside the cup. It doesn't work.
@@jumbo999614 You dont need submersible pump for that small work, just let the water bucket be little bit elevated and and provide outlet from the lower side to have water flow to pump through gravity, again make sure the flower pot is higher level than water supply to avoid free flow when pump is not running. That should work well for you.
Hi Lagan bro, I am completely new to these circuity and all.. U said that we have to connect the relay to 5v power supply, as I am not able to find it.. Can I use 9v alkaline battery which i can connect with battery clip connector..??