Oliv'

As I like to have plants at home but always forgot to water them, I bought a cheap resistive soil moisture sensor. Actually, it is just two strips of copper wired as a voltage divider with a 10k resistor, the IC is used as a comparator to have a “digital” output, with a threshold set by the trimpot.

Soil moisture sensor

Soil moisture sensor

The sensor can draw up to 35 mA, so I wired the power line to an output of the microcontroller. Be careful that on the ATMega328, it is 40 mA max by pin with a sum of 200 mA for all pins. It might be good to use a FET transistor if too much power is drawn.

Adding it to my home automation system is quite straightforward:

  • Add a new sensor type in config.h
  • Add some code to set the I/O in setup() function
  • Add some code to read the sensor in loop() function
  • Send it over the air :)

My citrus is complaining if it needs some water! For the record, I found that I need to water the plant if the value is more than 200 out of 255. This value must be changed regarding soil composition and its salt saturation.

Even if it works, I already see some improvements:

  • I read an analog value, so there is no need for the comparator: try a 100% DIY way with some copper + resistor
  • Standalone watering system: use the comparator + RC or a 555 timer to open a solenoid valve under a bottle of water
  • For vegetables in the garden, link it to the water pump of my water well

Copper strips might get some oxidation over time, which will change its resistance, it might be better to use capacitance sensor instead.

comments powered by Disqus