I have previously created a DIY soil moisture sensor, but wiring it required couple resistors. I was recently reading a post by JCW on using a light sensor and figured I could simplify my setup using the same basic idea – using an Analog input with the internal pull-up enabled:
That pretty much simplifies the setup to just hooking the two wires to GND and Analog 8 on the Funky:
//Soil moisture measurement void setup(){ pinMode(A8,INPUT); digitalWrite(A8,HIGH); // Internal pull-up, MUST be set! Serial.begin(57600); } void loop(){ Serial.println(analogRead(A8)); delay(500); }
This spits out a reading between 1023 and 0, 1023 being absolutely dry. When I dip the sensor into a glass of water, I get values around 200, so basically you can judge weather your plants need watering or not by that number. Using the low power example sketch, you can transmit this reading to a RFM2Pi board that will pass it on to emoncms for storage and notifications.