This week's assignment was to build an input device. Because my research focuses on irrigation, I thought it could be useful to understand how a soil moisture sensor works and build one. My idea was to send an electric current through the soil, and the resistance and capacitance would change depending on the amount of water in the soil. Soil with higher moisture content should have lower resistance, since water is less resistant than soil.
I started with the transmit-receive step response circuit board provided on the class website here. Milling and stuffing the board went off without a hitch. I'm getting used to this!
For my soil probes, I bought some galvanized steel nails. The nails would probably be conductive enough, but since the rest of my current is traveling along copper, I decided it might be best to stick with the same material and covered the nail with copper (maybe this was irrelevant and unnecessary?). I took some scrap sticky copper meant for the vinyl cutter and wrapped it around my nails.
I connected my nail probes to the PB3 and PB4 pins of my attiny45 microcontroller through the first and fourth pins of the 2x2 connector.
I programmed my board using the transmit-receive code provided on the class website here and the FabISP I built a few weeks ago. I tried using the Cygwin terminal and the make set of commands, but I kept getting errors. I switched to Arduino and my program uploaded without a problem.
To measure the soil moisture I placed my nail probes into a cup of soil and ran the program using one of the IDC's Ubuntu computers (for some reason I couldn't get Python to work on my Windows laptop).
And it worked!
I added some water to the soil and saw the measurement drop:
Well, ok, the measurements displayed here are probably pretty inaccurate. As you can see in the video below, the measurement could not stabilize.
Because the measurement was not stabilizing, I could not calibrate my soil moisture sensor. I had been hoping to match the reading with the amount of water I had put in (water-to-soil ratio by volume), but this was not possible. For my next sensor, I need to figure out how to get a more stable reading.