Skip to the content
PCBKitNew board
2 layers164.8 × 29.2 mmCap soil sensor, the printed circuit board in 3D

Battery powered ESP8266 Capacitive Soil Moisture Sensor

Size
164.8 × 29.2 mm
Copper layers
2
Thickness
1.6 mm
Parts
18
Nets
16
Pads
84
Tracks, vias
115, 13
Pours
4
Routed
Yes
KiCad
KiCad 4
Created
24 Apr 2017
Updated
3 Feb 2022

Overview

Cap soil sensor is an open-source printed circuit board by theopensourcerer, from the theopensourcerer/esp8266-cap-soil-sensor repository on GitHub. It is a 2-layer board of 164.8 × 29.2 mm with 18 parts on 16 nets, routed with 115 tracks and 13 vias.

It is built around the ESP-12F and 74LS14PC. Its parts include 5 resistors, 3 ICs, 3 connectors, 3 switches and 2 capacitors. It belongs with the sensors and measurement boards and the ESP8266 boards of this library.

Main components

2

README

README.md

ESP8266 Capacitive Soil Moisture Sensor

Image of PCB

Table of Contents

Summary

This is a personal project to build a Capacitive Soil Moisture Sensor for my hobby of growing chillies.

The project consists of three parts: the hardware (PCB and Sensor(s) etc.(, the case to hold the sensor, and the software.

I wanted to design and build my own sensors with built in WiFi so they could operate "standalone" in my tunnel. I wanted them to run from a decent capacity battery such as an 18650 Li-ion and to be able to report back information at timely intervals to my home server and database. Ultimately I want to use this information to be able to automate the watering of my plants.

The Internet is a wonderful thing. I have spent many dark and long evenings through the 2016/17 winter, learning, reading and searching for information on Capacitive moisture sensors. There are numerous resources (and individual people behind each of them) I would like to thank for taking the time to design, document and discuss the various mechanisms for capacitive moisture measurement. Hopefully my own small contributions may help others in the future.

Why use capacitive sensors?

  • The cheap and traditional moisture sensor uses a resistive technique. That is, to put it simply, the probe usually consists of two electrically conductive "prongs" which are inserted into the soil with a known gap between them. As the moisture increases, the electrical resistance decreases. This technique works but is not ideal mostly due to electrolysis [1]. Essentially the probes deteriorate rapidly due to this phenomenom and hence the measurements also change and the probes need to be replaced quite frequently

  • The resitive appraoch requires significantly more power (electric current) to operate than the capacitive technique, so battery life would be constrained

  • The fundamental principle of the capacitive sensor is that you measure the time it takes for your capacitor (the probe) to charge. This charging period changes proportionately to the moisture level of the soil. It means there is no direct electrical contact between the soil and the probe (it is insulated) therefore should last a great deal longer

  • It is harder to do; hence far more interesting to design and produce ;-)

Below is my list, in no particular order, of the online resources I found to be most helpful during my research (there were and are others; Google is your friend):

http://pcb.daince.net/doku.php?id=sensor_soil_2 http://zerocharactersleft.blogspot.co.uk/2011/11/pcb-as-capacitive-soil-moisture-sensor.html

https://www.dfrobot.com/wiki/index.php/Capacitive_Soil_Moisture_Sensor_SKU:SEN0193 (Bought one of these to test. It works) https://github.com/Miceuz/i2c-moisture-sensor and https://wemakethings.net/chirp/ (Bought one of these - this works too)

http://www.instructables.com/id/Comparison-of-Capacitive-Soil-Probes/ and then https://github.com/acolomitchi/cap-soil-moisture-v2 (I have used this probe design. Thanks acolomitchi)

Then I came across these few resources (thank you Google Translate)

Which led me here:

Which then led me to:

and

I have also been following along with this project:

These resources above gave me confidence that a custom design was possible so I set to work basing the Schematic and PCB on the work of the people above. The use of a Schmitt Trigger Inverter to "square" up the oscillations of the sensor probe means it can be read by pretty much any GPIO as long as the MCU is fast enough. The ESP8266 has some limitations in this regard so I considered using a half-wave rectifier to convert this to a simple analogue voltage but the work of Zentris and Lars(lh84) convinced me that the ESP8266 was capable of reading the frequency directly if it can be kept below about 150Khz.

This is all still very much a work in progress. I have built a prototype board and have had it running on my desk but the results leave me rather confused :-(

Hardware

The Schematic and PCB are designed in KiCAD. A version of this board has been fabricated but it is not the final version. Probably the most interesting part is the layout of the probe footprint itself. This came from acolomitchi as mentioned above. (I have modified the layout somewhat so it is more suited to an integrated PCB - I also made it a little longer as my target was for quite large pots).

Case

The case is designed in OpenSCAD and is suitable for printing on a 3D Printer. The basic idea is that the PCB slides into the case. The PCB has about 1.5mm of empty space down each side of the board which should be enough to slot in place. The probe end of the PCB fits through the slot in the bottom of the case. There should be enough height to support the power connector (not tested) and the other half of the case holds an 18650 battery in a plastic holder. The "lid" screws on and has protrusions which should prevent the probe PCB and the battery from moving about too much. I plan to use something like silicon bathrooom sealant around the probe slot to prevent any moisture ingressing into the case. Please feel free to use and improve - within the terms of the license of course.

Code

The software for the ESP8266 is in this directory. It should be fairly simple C code. The config.h file contains user-defined parameters. The ESP8266 code works like this: On power up the ESP attempts to connect to the WiFi network. If successful it then attempts to read the frequency of the capacitive sensor probe. If the Sensor probe is read successfully the data is formatted as a JSON object and sent to the MQTT broker. The ESP8266 also sends information about its supply voltage and the time it took to run this code loop. Finally the code puts the ESP into "Deep Sleep" for a preconfigured period.

Licenses

[1] https://en.wikipedia.org/wiki/Electrolysis

Parts

18
QtyValueFootprintReferences
410kResistors_SMD:R_1206_HandSolderingR1, R3, R4, R5
1100Resistors_SMD:R_1206_HandSolderingR2
110uFCapacitors_SMD:C_1206_HandSolderingC1
11uFCapacitors_SMD:C_1206_HandSolderingC2
174LS14Housings_SOIC:SOIC-14_3.9x8.7mm_Pitch1.27mmU1
1CScap-sensor:cap_sensor_probeCS1
1ESP-12FESP8266:ESP-12EU2
1FLASHswitches:SKQGAFE010_SwitchSW2
1INSPECTIONPin_Headers:Pin_Header_Straight_1x01_Pitch2.54mmP5
1MCP1700TTO_SOT_Packages_SMD:SOT-23_HandsolderingU3
1POT-BOURNS-3364Wmanuf:BOURNS-3364-WRV1
1PWRConnectors_JST:JST_XH_B02B-XH-A_02x2.50mm_StraightP4
1RESETswitches:SKQGAFE010_SwitchSW1
1SERIALPin_Headers:Pin_Header_Straight_1x05_Pitch2.54mmP3
1Switch_SPDT_x2switches:SW_SPDT_PCM12SW3

Questions

How big is the Cap soil sensor PCB?

It measures 164.8 × 29.2 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Cap soil sensor use?

18 parts, built around the ESP-12F and 74LS14PC. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Cap soil sensor KiCad files?

From the theopensourcerer/esp8266-cap-soil-sensor repository on GitHub, at the commit this page was made from: the board is pcb/cap-soil-sensor.kicad_pcb. PCBKit opens the board in the browser, with nothing to install.

Can I use the Cap soil sensor design in my own project?

Its repository states no licence, so its author keeps all rights: ask theopensourcerer before reusing the design.

Similar boards

  • 2 layers231.1 × 106.7 mmSnark barker, the printed circuit board in 3D

    Snark barker

    schlae/snark-barker

    A 100% compatible replica of the famed SB 1.0 sound card

    199 parts687
  • 2 layers304.8 × 165.1 mmComix-35, the printed circuit board in 3D

    Comix-35

    schlae/comix-35

    The COMIX-35 is an improved clone of the COMX-35 1802 home computer

    173 parts138
  • 4 layers184.9 × 243.8 mmProject NuXT, the printed circuit board in 3D

    Project NuXT

    monotech/NuXT

    MicroATX Turbo XT Motherboard, with VGA, Floppy, CF, Serial

    223 parts121GPL-3.0
  • 4 layers62.5 × 83.8 mmKerberos2, the printed circuit board in 3D

    Kerberos2

    FrankBuss/kerberos

    C64/C128 MIDI flash interface

    169 parts81
  • 2 layers170.2 × 100 mmZ80-SBC, the printed circuit board in 3D

    Z80-SBC

    skiselev/zeta_sbc

    Zeta SBC is an Zilog Z80 based single board computer. It is inspired by Ampro Little Board Z80 and N8VEM project. Zeta SBC is software compatible with RomWBW Firmware

    75 parts53GPL-3.0
  • 2 layers33.7 × 56.5 mmLumafix, the printed circuit board in 3D

    Lumafix

    tebl/C64-Lumafix

    An easier to solder version of the Lumafix board, components spaced out a bit more to make things easier on the beginner (mostly meaning me).

    12 parts39
  • 2 layers162.2 × 134.6 mmSg1000, the printed circuit board in 3D

    Sg1000

    barbeque/sg1000

    A homebrew Sega SG-1000, with an eye towards SC-3000 compatibility

    89 parts33
  • 4 layers170 × 181 mm3ric, the printed circuit board in 3D

    3ric

    ebadger/3ric

    3ric homebrew computer repository

    150 parts32