Arduino Uno Smart Plant Watering Kit – Code & Driver
After searching the web for the basic Arduino Uno Smart Plant Watering kit tutorials and code, I have came across several examples and tutorials, but none seemed to be working so well with the kit I have purchased. The instructions provided on the vendor’s website’s product page were fairly simple, but could not find the code to work included in the tutorial (yes, I am also still a newbie with Arduino IDE).
After searching some more, I have found this article on the Instructables website which uses most of the same components. I have used the code provided and modified it slightly to work with the assigned pins which I have used for my project, increased the delay between sensor readings, added some comments and amended the serial console output. You can use this code as is with the Automatic Smart Plant Watering Kit.
For reference, this kit includes the following components:
- 1 × Arduino UNO with USB cable (Arduino compatible – not original Arduino board)
- 1 × Soil detection sensor with conversion module
- 1 × 5vDC submersible water pump with transparent water pipe
- 1 × 5V relay module
- 1 × 400-hole breadboard
- 1 × No. 5 battery box (with switch)
- 10 × Dupont line male to male 20cm
- 10 × DuPont female to female 20cm
- 10 × Dupont line male to female 20cm
Something to note: If your UNO drivers aren’t installed automatically when using this kit, I will save you some time searching for the correct drivers by downloading them here.
//Original Code: https://www.instructables.com/Arduino-Plant-Watering-System/ //Amended by Armandus Basson //For Arduino UNO int waterPump = 11; //Relay Pin = 11 void setup() { Serial.begin(9600); pinMode(waterPump, OUTPUT); } void loop() { int humidityRaw = analogRead(A0); int humidityReal = map(humidityRaw, 1023, 0 ,0, 100); //Convert raw sensor data to percentage //Print converted moisture sensor data (percentage) to the serial console Serial.print("Soil Moisture = "); Serial.print(humidityReal); Serial.println("%"); delay(4000); //Delay before next sensor reading. Current set as 4 seconds if (humidityReal > 30) //Set threshold when relay must open for pump to feed water { digitalWrite(waterPump, HIGH); delay(5000); //Pump need to run for 5 seconds before the next sensor reading }else{ digitalWrite(waterPump, LOW); } }
Hope you have fun playing around with this kit, and feel free to share your projects with us.
Leave a Reply