This is a capacitive soil moisture sensor which runs with a standalone ATmega328P and utilizes the [MySensors][1] framework. It can however be adapted to any other framework that uses 2.4 GHz radio communication with an 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 6. 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.
When working on the project you need the following installed locally and available in the development environment:
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 JLCPCB 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.
Note: The ATSHA204A on the board is an optional component. If you do not want to assemble the board with it, you can leave it away together with the accompanying resistor.
You can find the STL files for a case attached to the release. If you want to tweak the tolerances for your printer or add additional features like printed on version or venting holes you can edit the hardware/case/case.scad
file and generate the STLs by yourself by running make case
in the root directory of the repository. The STL files are then placed under hardware/case
.
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.
I am happy to discuss and accept improvements on the project. Please make all your pull-requests against master
. It is also a good idea to discuss your planned changes in the github discussion section to avoid unnecessary work.
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 | 237 |
Mount.stl | 1.52 MB | 265 |
cern_ohl_p_v2.pdf | 72.28 kB | 295 |
Shell.stl | 883.29 kB | 258 |
cern_ohl_p_v2_howto.pdf | 70.34 kB | 539 |
schematic.pdf | 60.73 kB | 677 |
CHANGES.TXT | 166 B | 235 |
soil-moisture-sensor-B_Cu.gbr | 141.68 kB | 287 |
soil-moisture-sensor-B_Mask.gbr | 34.73 kB | 233 |
soil-moisture-sensor-B_Paste.gbr | 12.03 kB | 217 |
soil-moisture-sensor-B_SilkS.gbr | 19.55 kB | 233 |
soil-moisture-sensor-Edge_Cuts.gbr | 1009 B | 248 |
soil-moisture-sensor-F_Cu.gbr | 60.89 kB | 270 |
soil-moisture-sensor-F_Mask.gbr | 1.7 kB | 253 |
soil-moisture-sensor-F_Paste.gbr | 747 B | 213 |
soil-moisture-sensor-F_SilkS.gbr | 19.12 kB | 242 |
soil-moisture-sensor-job.gbrjob | 2.22 kB | 290 |
soil-moisture-sensor.drl | 1.34 kB | 292 |
Name | Size | # Downloads |
---|---|---|
main.cpp | 5.16 kB | 492 |
Revision | Created | Layers | Dimensions |
---|---|---|---|
rev1 | 4 years ago | 2 | 186 × 23 |