Soil moisture sensor

Enquiring about soil moisture sensor suitable for Pico preferably with quiik connector.

I see CE09438 but not sure if this is suitable with Pico due to voltage or adapter requirements.
Information on each product should include more information like adapter types and compatible products Pico, Pi, … as appears some systems can be adapted across multiple systems.

Hi Steffan,

I had a look at the soil sensor you linked, the description mentions an operating voltage of 5V, so you’d need a voltage divider before going into a Pico ADC pin.

Alternatively, Sparkfun make a Qwiic-capable soil moisture sensor that works between 3.3V and 5V, so that’s fine for a Pico, but it only has an Arduino library, so you’d need to port it over to MicroPython or C SDK I2C commands:

https://github.com/sparkfun/Zio-Qwiic-Soil-Moisture-Sensor/archive/master.zip

Hi @Steffan224686 I’ve built a soil moisture reader with RPi Pico and the DFRobot Moisture Sensor successfully - Soil Moisture Sensor (Arduino Compatible) Immersion Gold | DFRobot SEN0114 | Core Electronics Australia

With that moisture sensor I didn’t need to use a voltage divider which was handy, but I don’t think it has a quiik connector sorry.

Here’s a sample of my python code if you want to use it. Note my device outputs to a 7 segment display module, but I’ve removed most of that code for brevity.

from machine import Pin, ADC
import utime

sensor_moisture = ADC(26)

conversion_factor = 1023 / 65535

# ~150 in fingers
# ~615 in mouth
# ~700 in water

sensorVal = 0.0
strStatus = ""
while True:
    reading = sensor_moisture.read_u16()
    converted = reading * conversion_factor
    
    sensorVal = converted
    
    if converted < 320:
        strStatus = "BAD"
    else:
        strStatus = "GOOD"
        
    print(strStatus)
    
    print(str(reading) + " " + str(converted))
    utime.sleep(1)
1 Like

I don’t know how this would apply to the Raspberry Pi Pico, but I had previously done a project with the BBC Micro:bit V1 Board, and could not find a moisture sensor within my budget. I discovered that by connecting 2 alligator clips to the 3V and Pin0 and 2 long steel nails, there is a way to read the moisture data coming from the nails when they are touching the soil.

Maybe this is helpful for you, and a way to save some money, however I do not know how to achieve this with a Raspberry Pi Pico, but I will edit this post if I find something useful.

1 Like

Thanks Jacob for the code.
It explained the connections required and I have worked out that I cannot use adapters of the sensor (3 wires) to a quiik connection (4 wires)as the sensor requires connection to either ADC(26), ADC(27) or ADC(28) - one of three analogue digital converters (ADC) on the Pico.
The Quiik connectors connect to SCL9 and SDA8 instead.
Using your code I connected wires from

  • Sensor (Black) to Pico GND
  • Sensor (Red) to Pico 3V3
  • Sensor (Blue) to Pico GP26 (ADC26), GP27 (ADC(27), or GP28 ADC(28)
    altering the above code accordingly (sensor_moisture = ADC(26), …)
    In the diagram attached I tested out on ADC(27)

The other alternative I am looking at is adding in
Analog to Digital Converter - MCP3002 - to wire in the sensor to the Quiik connector on my SSD1306 display.

Code is good and gave the indicative values listed.
Thanks

1 Like

SparkFun Qwiic Soil Moisture Sensor has Qwiic connector but could not find any library or documentation to connect it to pico.