Basic essence of this project was to let me know when I need to water my plants and to ensure I don’t over water them. I’ll put the code up in a bit. This early version is a very ugly prototype with lots of wires running around for sake of quick development (so please don’t judge).

Made with Femtoduino. Connections are uber simple. Moisture sensor is available on eBay for really cheap. All you do is run your normal VCC and GND lines. Add analog read input on microcontroller A0 to sensor and you’re off and away. Entire project cost about $35 and took about 2 hours to completely assemble. LEDs are running through D5 and D9. You can skip the LEDs if you want and just use serial monitor as feedback but then it’s not very portable.

Next version would be to add WIFI and have each plant in my home tweet me when it needs water. I’m waiting for my Spark Cores to arrive (which have been delayed due to manufacturing issue) so I’ll have to be patient.

Quick disclaimer on the code below: it is messy. I was looking to make it graphical like a dashboard which is why there’s value repetition. The sensor gives you a reading like 983 (for example) and rather than deal with massive ranges, I was going to have it display as just 9. Anyways, I’ll fix it later, I just didn’t want any confusion.

/* # Example code for the moisture sensor # Connect the sensor to the A0(Analog 0) pin on the Arduino board # the sensor value description # 0 ~300 wet soil # 300~800 humid soil # 800~1000 dry water # D5 Red LED for water # D9 Green LED for no water */ int nowaterPin = 9; //initializes green LED int waterPin = 5; //initializes red LED int analogPin = A0; //initializes sensor analog input void setup(){ pinMode(waterPin, OUTPUT); pinMode(nowaterPin, OUTPUT); Serial.begin(57600); //make sure your serial monitor is set to this baud rate. } void loop(){ digitalWrite(waterPin, LOW); digitalWrite(nowaterPin, LOW); int analogValue1 = analogRead(analogPin); int analogValue = analogValue1; // putting this here for future value manipulation Serial.print("Water Priority: "); Serial.println(analogValue); //if sensor reading is greater than 700, time to water, turn on redPin as water needed if (analogValue > 700){ digitalWrite(waterPin, HIGH); digitalWrite(nowaterPin, LOW); Serial.println("Water Immediately"); Serial.println(""); } //if sensor reading is less than 700, it is moist enough, turn on greenPin as ok else { digitalWrite(nowaterPin,HIGH); digitalWrite(waterPin, LOW); Serial.println("No Water Needed"); Serial.println(""); } //1000 milliseconds is 1 second, modify as needed. 60000 ms is 1 minute delay(1000); }