Soil Humidity Display
Hardware- 3 Devlogs
- 7 Total hours
Beginner PCB project to learn more about PCB design and capacitive sensors. This PCB project detects soil humidity using capacitive sensors and displays analytics on an OLED screen.
Beginner PCB project to learn more about PCB design and capacitive sensors. This PCB project detects soil humidity using capacitive sensors and displays analytics on an OLED screen.
After soldering the components on last time, I found several issues with the design. First, it appears that I wired the 555 timer wrong - I ordered an NE555 timer which takes 5V logic instead of one that was compatible with 3.3V logic. Even after soldering a wire to fix that, something else with the design was wrong, which led to the component constantly outputting a HIGH signal.
Instead of spending time trying to fix it, I decided to just scratch out all the traces connecting it and removing the component altogether. Rather than retrieving a frequency from the touch capacitance sensor via hardware, I opted for a pure software route instead. I soldered a wire directly from the capacitance sensor’s copper pad to pin 1, and then using software, I would repeatedly drive the pin HIGH, and then measure the amount of time it takes for the pin to reach LOW (measuring the amount of time it takes for the copper pad to discharge).
This allows me to approximate the capacitance of the copper pad via the formula t = R * C. The capacitance will increase when my finger approaches the pad, and so by counting the cycles it takes for the capacitor to discharge, our program can tell when the capacitive sensor was touched.
The soil moisture capacitive sensor is basically the same concept in action. When the sensor is placed in dry soil, the capacitance will be low (as soil is dielectric), and timing for discharge will be low as well. When the soil is watered, capacitance will increase (as water is a strong dielectric), which will thus increase the time it takes for the soil capacitive probes to discharge.
The only problem was that it turned out I had wired the RC circuit for the soil capacitive probes incorrectly as well, which I thus spent time fixing.
After testing the code and ensuring it worked, I went back and redesigned the PCBs to fix the mistakes I found in these physical prototypes. I’ll be shipping this project soon!
The PCBs and components arrived, so I spent today soldering everything together. This was the first time I’ve soldered in a couple years, so apologies if it looks rusty. I realized belatedly as I was soldering that I made one mistake: I forgot to order the I2C OLED display. I’ll be attaching it as it arrives in the coming days.
Additionally, I’ve kept the legs of most of the components intact for now, in case I want to reuse them for other projects in the future.
Finished setting up the schematic + PCB of my capacitive soil moisture sensor display. It features a capacitive sensor for detecting soil moisture, and also a capacitive touch sensor for interacting with the OLED display. The PCB features a two copper probe-fingers; one which connects to the MCU and forms a RC circuit, and the other which connects to ground.
The idea is that when the PCB is embedded in the dielectric soil, and the humidity level increases, the capacitance of the copper probes will naturally increase as well with the presence of water. Through the equation Time = Resistance * Capacitance, we can detect the change in how long the capacitor (the copper probes) take to charge/discharge, and thus approximate the humidity level, with some calibration of course.
The touch capacitance sensor (shown on f.cu) works similarly. When a finger approaches the copper pad, the capacitance of the circuit changes, and that is something we can measure. Only difference is that, for added robustness, I added a 555 timer to convert the capacitance into a frequency that the MCU can read.
Since the PCB is already finished, the next step for me is to finish the code and order the PCB to test it out. As this is one of my very first PCBs ever, fingers crossed it’ll work 🤞