This is a capacitive soil moisture sensor which runs with a standalone ATmega328P and utilizes the MySensors framework. It can however be adapted to any other framework that uses 2.4 GHz radio communication with a NRF24L01 if you upload your own code.
A short summary of the features is:
Note: Take care when inserting the batteries as there is no reverse polarity protection on this board. Also check the pin assignment of the FTDI and AVR ISP headers as these might be non standard to save some space.
If you want to work on the repository you just have to run:
git clone --recurse-submodules https://github.com/RonMcKay/capacitive-soil-moisture-sensor
The PCB design is done in KiCad 5. You are pretty much good to go if you open the project with KiCad.
For programming and burning the bootloader I use Visual Studio Code together with PlatformIO and MiniCore (which is already included in the platform io plugin for vs code).
You can generate production/documentation files and run ERC/DRC tests by running make
in the root directory. All production files are then placed under the hardware directory. The Makefile utilizes docker containers so you should have docker installed. Note that the folders .config/kicad
and .cache/kicad
should already exist in your home directory.
I am happy to discuss and accept improvements on the project. Please make all your pull-requests on dev
. It is also a good idea to discuss your planned changes in the github discussion section to avoid unnecessary work.
In recent years the DIY PCB industry segment has been growing and thus there are numerous options to quite easily order your boards online for low prices. Just download the Gerber-files from the release page or clone the repository and generate them yourself by running make
.
For the assembly of your boards there are currently no SMT assembly files supplied with the release, although there are pick and place files for JLPCB generated by make
they are not yet optimized or tested, so use them at your own risk. For manual assembly you can find the BOM attached to the release as well as a nice interactive HTML BOM which eases component placement. You only need to take care that the two battery holders which are closest to the radio module do not touch each other as this would cause a short. To be really safe you can bend them away from each other.
There is currently a 3D-printable case for the sensor with a screw on lid. In the future there might be other alternatives which require less printing time. There is also a plan to port the case design to an openSCAD file but that is WIP.
The minimum (air) and maximum (water) sensor values need to be calibrated. For this, get a glass of water and flash the sensor with #define CALIBRATION_MODE
. While reading out the log messages of the sensor, note down the sensor values for air and submerged in water. Change AIR_SENSOR_VALUE
and WATER_SENSOR_VALUE
accordingly and reflash the sensor after commenting out #define CALIBRATION_MODE
. Your soil moisture sensor is now ready for operation.
Here is a list of possible future improvements that might be worth looking into:
Any contributions are highly welcome and I am happy to discuss remarks in the github discussion section.
This project is licensed under the CERN-OHL-P v2
P.S.: The sensor on the photos is only a prototype where I accidentally soldered some wrong value capacitor and forgot a capacitor for the FTDI connector. These are however already fixed in the pcb design.
Comment | Designator | Footprint | LCSC |
---|---|---|---|
Keystone 597 | https://www.tme.eu/de/details/keys597/batterien-behalter-und... | ||
Keystone 591 | https://www.tme.eu/de/details/keys591/batterien-behalter-und... | ||
100nF | C1 | Capacitor_SMD:C_0805_2012Metric_Pad1.15x1.40mm_HandSolder | C49678 |
1uF | C2,C4 | Capacitor_SMD:C_0805_2012Metric_Pad1.15x1.40mm_HandSolder | C28323 |
220uF | C3 | Capacitor_SMD:CP_Elec_6.3x7.7 | C127327 |
D_Schottky | D1 | Diode_SMD:D_SOD-323_HandSoldering | C154819 |
AVR ISP | J1 | Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical | |
FTDI | J2 | Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical | |
10K | R1,R3,R4 | Resistor_SMD:R_0805_2012Metric_Pad1.15x1.40mm_HandSolder | C17414 |
510K | R2 | Resistor_SMD:R_0805_2012Metric_Pad1.15x1.40mm_HandSolder | C17733 |
SW_Push | SW1 | C720477 | |
ATmega328P-AU | U1 | Package_QFP:TQFP-32_7x7mm_P0.8mm | C14877 |
NRF24L01_Breakout | U2 | mysensors_radios:NRF24L01-SMD | |
ATSHA204A | U3 | Package_TO_SOT_SMD:SOT-23_Handsoldering | C34377 |
Resonator | Y1 | C907975 |
Name | Size | # Downloads |
---|---|---|
COPYRIGHT.TXT | 511 B | 148 |
Mount.stl | 1.52 MB | 166 |
cern_ohl_p_v2.pdf | 72.28 kB | 200 |
Shell.stl | 883.29 kB | 140 |
cern_ohl_p_v2_howto.pdf | 70.34 kB | 287 |
schematic.pdf | 60.73 kB | 481 |
CHANGES.TXT | 166 B | 130 |
soil-moisture-sensor-B_Cu.gbr | 141.68 kB | 171 |
soil-moisture-sensor-B_Mask.gbr | 34.73 kB | 135 |
soil-moisture-sensor-B_Paste.gbr | 12.03 kB | 112 |
soil-moisture-sensor-B_SilkS.gbr | 19.55 kB | 117 |
soil-moisture-sensor-Edge_Cuts.gbr | 1009 B | 124 |
soil-moisture-sensor-F_Cu.gbr | 60.89 kB | 140 |
soil-moisture-sensor-F_Mask.gbr | 1.7 kB | 146 |
soil-moisture-sensor-F_Paste.gbr | 747 B | 117 |
soil-moisture-sensor-F_SilkS.gbr | 19.12 kB | 125 |
soil-moisture-sensor-job.gbrjob | 2.22 kB | 166 |
soil-moisture-sensor.drl | 1.34 kB | 169 |
Name | Size | # Downloads |
---|---|---|
main.cpp | 5.16 kB | 351 |
Revision | Created | Layers | Dimensions |
---|---|---|---|
rev1 | 2 years ago | 2 | 186 × 23 |