Due to lack of resources and long delivery time, I could not get off the shelf soil moisture sensor aka soil hygrometer
So decided to make one after understanding the principle of working. There are multiple ways through which we can measure the soil moisture level,
like conductivity, capacitance, etc.
Readily available sensor
Most use copper or tin-coated PCB and a comparator circuit to detect the presence of water by measuring the change in the resistance thereby measuring the voltage across the resistor. More the voltage drier it is. Later, the comparator compares the voltage level to a set threshold then decides whether it is dry or wet.
We will use something different, we'll send a PWM signal and then measure the response across an RC filter.
Here is the schematic of my sensor
We will be directly writing to the ports of Arduino to generate the high-frequency PWM signals (>500Khz) and then the simple RC circuit to analyze the soil moisture level.
We will use D7/TCC1/WO[0] pin for this purpose and A0 for measuring the voltage values.
Using turboPWM library we can generate high-frequency PWM up to 1MHz.
Result of watering the soil increases the analog read voltage.



