The other day I bought a Soil moisture sensor from a local shop while waiting for the online store to send me the stuff I recently ordered. Buying it from the physical local store was of course nearly ten times as expensive, but it allowed me to get a little one-on-one time with the thing before I get stared for real with the plant-watering project.
As I want to have analog readings from the plant-pots and flowerbeds, I am going to let my AdaFruit Feather M0 Adalogger be responsible for communicating with the sensors. This little beauty has six analog ports which should hopefully be enough for my needs. If not, I can always add more boards (or shields with analog ports).
Using my breadboard, I simply connected the analog pin of the Soil moisture sensor's analog-pin to analog port A1 (port 15) on the board. I then connected the ground-pin of the Soil moisture sensor to the ground-port on the board and finally connected the VCC-pin of the Soil moisture sensor to the 3.3V-port on the board.
The sensor is supposed to return a value between 0 and 1024, where the higest value is telling us that no power can be transmitted between the
In the Arduino IDE, I added a small sketch to allow me to read the values of the sensors at given intervals and print these to the serial port. (You can grab the sketch from here).
The value read from the sensor is supposed to be an integer between 0 and 1024.
I made a small sketch that just reads the value from the sensor so that I can validate that I receive 1024 when having the sensor in the air, and 0 when dipping it into water.
Running the sketch while having the sensor in the air gives me the following reading:
Pin 15 = 1018Please note that "15" is the actual pin number that I reference as "A1" in my Sketch. For more pin information for this board, visit this page.
Pin 15 = 1018
Pin 15 = 1018
Pin 15 = 1018
Pin 15 = 1018
Pin 15 = 1018
Pin 15 = 1018
Pin 15 = 1018
So, for my sensor, 1018 is extreme dry.
Submerging the sensor into water gives me the following reading:
Pin 15 = 115Which tells me that for my sensor, 113 is extreme wet.
Pin 15 = 115
Pin 15 = 114
Pin 15 = 113
Pin 15 = 114
Pin 15 = 114
Pin 15 = 114
Pin 15 = 114
So, I updated my Sketch to take this into account by changing the max value to be 1018-113 and to remove 113 from the sampled value when calculating the percentage.
Okay, so with this hopefully correctly done, it was high time for a real-world test. So I inserted the sensor into the soil of a newly watered tomato-plant of about 50 cm of height in a 15 liters flowerpot. It gave me the following reading:
Pin 15 = 93.37 %After a while it stabilized and reported a reading like
Pin 15 = 93.70 %
Pin 15 = 93.81 %
Pin 15 = 93.70 %
Pin 15 = 93.92 %
Pin 15 = 93.25 %
Pin 15 = 93.36 %
Pin 15 = 95.25 %So, I think this will be fine for me in my plant-watering project. I was a little annoyed that I could not calibrate the analog reading on the moisture sensors board (it only seem to affect the digital LOW/HIGH setting), but other than that it worked fine. The sensors are a bit on the expensive side, especially as I've read multiple reports warning about that they deteriorate quickly... But building my own sensors seems like such a time sink so I think I will happily pay for them.
Pin 15 = 95.25 %
Pin 15 = 95.25 %
Pin 15 = 95.25 %
Pin 15 = 95.25 %
Pin 15 = 95.25 %
Pin 15 = 95.25 %



Inga kommentarer:
Skicka en kommentar