Soil Moisture Sensor

This battery powered MySensors node offers the following functionalities:

  • Soil moisture measurement

The node is built with the Mini-BT-pcb-328p board v.2.0 which has multiple power options and supports both radio modules: RFM69 (868 Mhz) and NRF24 (THT and SMD), but keep in mind that the instructions and the 3d printable case that you will find here are for a build based on a RFM69 radio module and a CR2032 battery.

4 LEDs are present:

  • Radio Error → RED
  • Radio Transmission → YELLOW
  • Radio Reception → GREEN
  • External power / low battery → YELLOW

By default this LEDs are enabled, but if you don't wont too much annoying light in your home, you can easily change this behaviour in the firmware. The LED are always visible, especially if you use a white filament to print the case, because 2 windows in which the thickness of the wall is reduced are present and consequently the transparency is more elevated.

Visit the dedicated topic in the forum if you want to share your experience with this node.

Mini-BT-Pcb-328P

The soil moisture sensor is based on the d-diot Mini-BT-pcb-328p board.

Both versions of the board are suitable for this node, but the version v.2.0 is more adequate because, thanks to Jumper J5, it allows to measure the battery voltage in an easier way.

The schematic and the entire Kicad project are available for download in the dedicated d-diot github repository. You can easily get 10 boards with about 5€ using an online PCB manufacturer like JLCPCB or PCB way. Click the button below to download the complete set (zip) of gerber files necessary for the manufacturing of the board.

Download Gerber Mini-BT-Pcb-328P v.1.0

Download Gerber Mini-BT-Pcb-328P v.2.0

ATMega328P-AU Microcontroller (MCU)

The brain of the node is the well known microcontroller ATMega328P-AU, which is the same MCU used in the Aruino UNO, Arduino Nano and Arduino Pro mini, so the sketches and the libraries of the Arduino platform are fully compatible. The MCU is available in generic e-commerce platforms for 1 - 2 euros.

Radio module

For the radio module the board support multiple choices. You can use an RFM69HW (868 Mhz) radio module or an NRF24L01+ radio module (SMD or THT), but keep in mind that the 3d printable case and this instructions are for a RFM69 radio module.

With the RFM69HW radio module, you need also an external antenna that can be a helical antenna like the one in the picture below, but also a piece of solid wire with the length of 8.6 cm should work fine.

Capacitive soil moisture sensor v.2.0

This component is responsible for the measure of the water content in the soil of your plant. The sensor can be found for 1-2 € in generic e-commerce platform (for example, see here).

Generally this sensor is shipped with its own 3 wire cable as visible in the first picture above. To connect the sensor to the pcb is sufficient to slide out from the plastic case the female metallic part of the 3 dupont terminals and reinsert them in single holders (see below).

Battery holder

The Mini-BT-Pcb-328P board is designed to work with both, CR2032 and AAA batteries, but this door and window node is designed to hold a CR2032 battery.

For the CR2032 battery, any holder with a footprint like the Keystone 1058 is suitable. For example, I have used this.

For the AAA batteries, SMD contacts like the Keystone 55 are suitable.

Electronic components

The list of all the electronic components is reported below.

References Value Description Footprint Quantity
C12 47uF Electrolytic capacitor 47 uF 5 x 5.4 mm CP_Elec_5x5.4 1
C1 100uF Electrolytic capacitor 100 uF 6.3 x 5.4 mm CP_Elec_6.3×5.4 1
C7- C8- C9- C10- C11 0.1uF Capacitor 0.1 uF – SMD package 0805 C_0805_2012Metric 5
C3 10uF Capacitor 10 uF – SMD package 0805 C_0805_2012Metric 1
C2 100uF-Tantalum Tantalum capacitor 100 uF 6.3 x 5.4 mm code TAJD107K016RNJ TAJD107K016RNJV 1
R1 20K Resistor 20 Kohm – SMD package 0805 R_0805_2012Metric 2
R3- R5- R9 10K Resistor 10 Kohm – SMD package 0805 R_0805_2012Metric 3
R6- R7- R8- R10 330 Resistor 330 Ohm – SMD package 0805 R_0805_2012Metric 4
D3- D5 Y-LED LED – Yellow – SMD package 0805 LED_0805_2012Metric 2
D2 R-LED LED – Red – SMD package 0805 LED_0805_2012Metric 1
D4 G-LED LED – Green – SMD package 0805 LED_0805_2012Metric 1
U1 ME2188C33 3.3V Boost converter ME2188C33 SOT-23-5 1
U7 RFM69HW Radio Module - RFM69HW RFM69HW_SMD_Handsoldering 1
U4 ATmega328P-AU Microcontroller - ATmega328P-AU TQFP-32_7x7mm_P0.8mm 1
L1 22uH Inductor 22uH - SMD L_6.3×6.3_H3 1
SW2 Reset Tactile push button – SMD 3x6x2.5 mm SW_1437566-3 1
BT1 CR2032 CR2032 battery holder - SMD Keystone 1058 BatteryHolder_Keystone_1058_1x2032 1
Q1 FDN338P P-Mosfet – Code FDN338P – SMD package SSOT-3 SSOT-3 1
J5 ANT Helical antenna for the RFM69HW radio module PinHeader_1x01_P2.54mm_Vertical 1
JP1 Boost 1 x 03 Male Pin header - SMD - Veritcal pitch 2.54 mm PinHeader_1x03_P2.54mm_Vertical_SMD_Pin1Left 1
J3 Booster CE 2 x 3 Male Pin header - SMD - Veritcal pitch 2.54 mm PinHeader_2x03_P2.54mm_Vertical_SMD 1
J1 Analog IN 1 x 02 Male Pin header - SMD - Veritcal pitch 2.54 mm PinHeader_1x02_P2.54mm_Vertical_SMD_Pin1Left 1
P1 MYSX_2.6 2 x 11 Male Pin header - SMD - Veritcal pitch 2.54 mm PinHeader_2x11_P2.54mm_Vertical_SMD 1

The following components are optional.

References Value Description Footprint
U2 ATSHA204A ATSHA204A IC chip SOT-23_Handsoldering
C4 0.1uF Capacitor 0.1 uF – SMD package 0805 C_0805_2012Metric
R2 10K Resistor 10 Kohm – SMD package 0805 R_0805_2012Metric

The ATSHA204A IC, the capacitor C4 and the resistor R2 are necessary only if you need the hardware signing functionality of the MySensors library. Please note that the security and signing features can be enabled also without dedicated hardware using software signing.

3d printable case

The 3d model files and the print instructions of the case are available in thingiverse.

If you don't have access to a 3d printer, you can consider an online 3d printing service.

Spare parts

To complete the build you need the following parts:

  • 3 x M2.5 self tapping screw
M2.5 self tapping screw
  • 2 x Jumper caps 2.54 mm
Jumper caps 2.54 mm

A cost estimation of the entire node (battery excluded) is around 7€

Well, this is the most time consuming part of the building, but once you have started the print job, you don't have too much to do except watching your 3d printer at work, so you can proceed with the other steps.

The model files are here.

Solder the components

Some components are THT, while some other are SMD, but generally with a 0805 package that is not so difficult to handle. The tools required for soldering the components of this board are the same of the d-diot board. See this to know what tools you need.

Use the interactive BOM tool to see where to place each component

The soldering process is divided in two parts for precaution; in fact if your programmer and FTDI adapter used for flashing the bootloader and the firmware does not have a voltage selector or if you don't select the 3.3V by mistake, you could damage the radio module that in most cases will not survive to a Vcc voltage above 3.3V.

The MCU works fine at 5V, so the flash of the bootloader and the firmware upload steps have been anticipated prior to the soldering of sensitive components.

Soldering - part 1

Solder the following components on the board:

  • ATmega328P MCU (U4)
  • MYSX Connector (P1)
  • Capacitors C7, C8, C9, C10 and C11
  • Resistor R5
  • Reset push button (SW2)

Burn the 1 Mhz MySensorsBootloader

With all the components of step above in place, you can proceed with the flashing of the “ATMega328p with MYSBootloader 1.3.0” which is necessary to the proper functionality of the node.

Connect the MISO, MOSI, SCK, RST, VCC, GND PIN of your programmer (USBasp) to the corresponding pin of the MYSX connector (PI) of the board and proceed according to this guide.

Upload the firmware

Connect the pin of your FTDI programmer to the MYSX connector (PI) of the board according to this scheme:

  • FTDI DTR → MYSX DTR
  • FTDI RX → MYSX TX0
  • FTDI TX → MYSX RX0
  • FTDI VCC → MYSX VCC
  • FTDI CTS → Unconnected or bridge with GND
  • FTDI GND → MYSX GND

Proceed according to this guide.

Soldering - part 2

Solder all the remaining components. The assembled board should look like this.

Jumper configuration

See the schematic if you want to know more about this jumpers.

  • JP1: bridge the Vcc and 3.3V pin to power the board at 3.3V, as required by the soil moisture sensor. Board is off when this jumper is open
  • J3 : bridge the On and CE pin to enable the 3.3V boost converter
  • JP2: open
  • JP3: open
  • JP4: open
  • JP5 (board v.2.0 only): bridge the two pad with solder

Assembly

  • Place the capacitive soil moisture sensor inside the rear part of the case
  • Secure the holder with two M2.5 self tapping screws.
  • Connect the Analog out (yellow wire) of the capacitive soil moisture sensor to the A6 pin (SOIL_MOISTURE_PIN in the firmware) of the J1 connector of the board
  • Connect the Ground (black wire) of the capacitive soil moisture sensor to the GND pin of the MYSX (P1) connector of the board
  • Connect the Vcc (red wire) of the capacitive soil moisture sensor to the D5 pin (POWER_PIN in the firmware) of the MYSX (P1) connector of the board
  • Place the board inside the case and secure it with a M2.5 self tapping screw
  • Insert the battery and close with the front part of the case

The source code of the firmware is available here. Follow this guide to know how to upload the firmware to your node.

The configuration parameters are in the following files:

The comments above each parameter should be self-explanatory, but if you need more assistance visit the dedicated topic in the forum.

  • sensors_and_actuators/mysensors/soil_moisture_sensor.txt
  • Last modified: 2020/04/12 15:57
  • by franzunix