BlocNotes

Notepad of a tinker, maker, hacker or whatever you call it :)

NoteRF - Add a new sensor - Moisture sensor

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

Humidity sensor

The sensor can draw up to 35 mA, so I wired the power line to an output of the microcontroller. Be carrefull 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 :)

Now, my citrus is complaining if it need 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 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 the time, which will change its resistance, it might be better to use capacitance sensor instead.