Close
0%
0%

Soil moisture measurement device

Visual control of soil moisture (with Raspberry Pi Pico)

Similar projects worth following
This is not an intricate, but a simple and cheap soil moisture measurement device showing a double-digit value on two 7-Segment-Displays.

A sensor (either resistive ME-110 or capacitive HW-390) evaluates the soil moisture, the Raspberry Pi Pico microcontroller converts the sensor signal into a 16bit digital value.

Excluding the Pico and the sensor, the material costs can be as low as 2€ (I bought a whole bag of 7-Segment-Displays on discount for around 3€, for example). With a custom made PCB, a capacitive sensor and the Pico around 12€.

That means this device is quite easy to modify dependent how much money one wants to spend, e.g. running several sensors simultaneously (Pico has three ADCs) or even changing the method of display entirely (e.g. LCD I2C-Display, OLED).

PCBs provided by the courtesy of pcbway.com.

Either one of these sensor types can be used if you choose to flash the code from my github repository (with sensor output connected to ADC0/GP26, Pin 31):

  • capacitive type sensor HW-390
  • resistive type sensor ME-110

What you see in the photo are the first prototypes with custom made PCB (Version 1.0):

The algorithm is capable to detect the connected sensor type correctly during an initialisation procedure.

You'll find more descriptions and explanations in the code comments.

Further HW/SW improvements might or should include:

  • "hiding" the Pico under the PCB (new design) and getting rid of all the green/white wiring (that just maintains some flexibility with the PCB prototype and is used for fault-injection test, but is otherwise obsolete)
  • reducing the overall geometrical size of the device
  • getting rid of the CD4511BE ICs, the Pico drives the segments directly (the advantage with the ICs is however that you use just 8 Pico ports instead of 14 and the Pico GPIOs are not "stressed" with high current for the segments; with VBUS you can get easily 30mA for one individual segment (brightness), while a GPIO can provide max. 14mA)
  • getting rid of 5 resistors and 1 CD4511BE IC by implementing a multiplexing logic with 2 transistors (however, this measure reduces costs not significantly if you use only two displays)
  • running several sensors simultaneously on one single PCB (with switching every few seconds between the sensor values on the 7-Segment-Display)
  • alternative power supply via e.g. solar cells
  • wireless sensor (might abandon this idea completely in order to keep costs low)
  • downsizing to a cheaper microcontroller

Further ideas appreciated.

BC107.pdf

Transistor for the multiplexing logic (here for SC56-11EWA, red). Many different transistors possible, use what is available.

Adobe Portable Document Format - 259.49 kB - 10/05/2021 at 12:24

Preview
Download

BD243C.pdf

Transistor for the multiplexing logic (here for SC56-11GWA, green). Many different transistors possible, use what is available.

Adobe Portable Document Format - 212.59 kB - 08/25/2021 at 04:16

Preview
Download

SC56-11EWA(Ver.13).pdf

Single Digit Numeric Display with common cathode.

Adobe Portable Document Format - 184.35 kB - 08/11/2021 at 15:03

Preview
Download

Schematic-moisture-measurement.pdf

Schematic circuit diagram. Pin numbers for the 7-Segment-Display depend on the individual module you use (in this schematic used: SC56-11).

Adobe Portable Document Format - 39.80 kB - 08/11/2021 at 14:52

Preview
Download

Iduino-me110-bodenfeuchtesensor.pdf

Data sheet resistive type sensor.

Adobe Portable Document Format - 390.11 kB - 05/16/2021 at 05:56

Preview
Download

View all 7 files

  • 1 × Raspberry Pi Pico
  • 1 × Moisture Sensor Iduino ME110 (resistive)
  • 14 × Resistor 47 Ohm Value should be increased for red 7-Segment-Displays (100 Ohm or even more). Had never problems with 47 Ohm resistors though
  • 2 × CD4511BE Logic ICs / Decoders, Encoders, Multiplexers, Demultiplexers
  • 1 × BC56-11EWA Displays and Inverters / LED Displays

View all 10 components

  • OLED Display

    Florian Wilhelm Dirnberger11/18/2021 at 16:30 0 comments

    Integrated multi-purpose SSD1306 OLED Display (price around 6,50€).

    Generic code example for using that display:

    from machine import Pin, I2C
    from ssd1306 import SSD1306_I2C
    i2c = I2C(0,sda=Pin(0),scl=Pin(1),freq=40000)
    oled=SSD1306_I2C(128,64,i2c)
    oled.fill(0)
    oled.text("text",0,0)
    oled.show()

    Don't forget to install the ssd1306 package if you want to use this display (thonny: Tools->manage packages).

  • Improved math

    Florian Wilhelm Dirnberger11/17/2021 at 05:44 0 comments

    Improved math for the capacitive sensor code: it utilizes now almost the entire 0-99 range on the 7-Segment-Displays.

    Code snippets:

    (...)
    ExpandedSensorValueS = (ADC_A0.read_u16()/3.0)*3.3         
    ExpandedSensorValueS = int(98000-(1.5*ExpandedSensorValueS))
    (...)

    (...)
    if ((ExpandedSensorValueS>=1311) and (ExpandedSensorValueS<=1965)):
          switchA2()
          A0.low()
          B0.high()
          C0.low()
          D0.low()
          utime.sleep(mx_time)
          # MX     
          switchB2()
          A0.low()      
          B0.low()      
          C0.low()      
          D0.low()
    (...)

    Background: Capacitive sensor HW-390 delivers around 3.0V (here: approximately 65535 after ADC conversion and expansion) output voltage when the soil is completely dry, and 1.0V (here: approximately 21.845 after ADC conversion and expansion) when the soil is completely wet (or when you put it in a glass of water). 

    (Source of this schematic: Sensors | Free Full-Text | Characterization of Low-Cost Capacitive Soil Moisture Sensors for IoT Networks (mdpi.com) )

  • Multiplexing

    Florian Wilhelm Dirnberger09/08/2021 at 08:19 0 comments

    Created a modified prototype that supports 7-Segment-Display multiplexing (see gallery photos).

View all 3 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates