first of all thank you very much for this awesome project / community.
I recently got more and more interested in building sensors. My next project would be to add some capacitive soil moisture sensors to some plants around the house.
I know there are already a few sensors of this kind out there like these:
The second one however, despite it is exactly what I was looking for, does not provide any design files.
But as I wanted to learn more about electronics in general and also wanted to build my first smd pcb, I build my own capacitive soil moisture sensor based on an ATMEGA328P, NRF24L01+ and a 3V coin cell. The schematic is based on the chirp sensor and I oriented myself with regards to component selection at this project.
The good news is: It works!
But I already noticed some flaws (e.g. I forgot to add a FTDI connector besides the AVR ISP ) and I could need some help from you:
The voltage range that comes out of the sensor circuit is very limited. In air the analog pin reads about 570 while reading around 498 submerged in a glas of water.
I read this post and made my own calculations (I measured my probe to have between 20pF and 460pF). Based on these the voltage swing should be around 2.4V from minimum to maximum capacity. Now the real world is probably not exactly like the calculations but this difference seems a little bit large to me. Anything that I am missing here?
As additional information: I generate a 1 MHz square wave using the internal clock of the atmega by enabling fast pwm using the following bits:
TCCR2A = (1 << COM2B1) // Clear OC2B on compare match
| (1 << WGM21) // pwm mode 7
| (1 << WGM20); // pwm mode 7
TCCR2B = (1 << WGM22) // pwm mode 7
| (1 << CS20); // no prescaling
OCR2A = 7;
OCR2B = 3;
In the setup function I set pin 3 (connected to OC2B) as output and pin 14 (A0) as input (this is where the sensor output goes in).
Any help on this would be greatly appreciated.
As soon as I finish the sensor (when I am no more bothered by the remaining flaws ) I will make it accessible for everyone.
Thank you in advance for any advice or guidance.