I want to measure the soil moisture with a capacitive (=non corrosive) sensor and transport the data via the CC2530 Zigbee module. This is how I did it.
Capacitive soil moisture sensor
This is readily available:
The device gives a DC signal of 0-3 V depending on the moisture content.
First challenge is to make it water tight so it can be used in moist soil
.
I followed this idea: https://www.domoticz.com/forum/viewtopic.php?f=51&t=24116

Schematic
Please note:
- that you can only use the CC2530 pins P00 ⦠P07 for analog voltage reading,
- a diode is needed to avoid āinterferenceā from CC2530.
Flashing CC2530 with PTVO
The CC2530 module is flashed with the great PTVO configurable firmware (https://ptvo.info/zigbee-switch-configurable-firmware-v2-210/). Flashing is done with the CC debugger and the free software from TI (https://www.ti.com/tool/FLASH-PROGRAMMER ) not V2. You only need to define one pin:

Convert voltage to moisture
Connect the moisture sensor/diode/CC2530 and turn on the power. Make sure HA allows new devices to join. Use the MQTT explorer (http://mqtt-explorer.com/ ) and connect to HA and look for the newly added device. You should see something like:
zigbee2mqtt/0x00124b0009e004d5
{"l1":1.376,"linkquality":39,"state_l1","voltage_l1":1.4}
Calibration is needed. Note the voltage when the sensor is dry (in my case Vdry = 2.463 V), now put the sensor in glas of water and read the voltage again (in my case Vwet= 1.386 V).
Create moisture MQTT sensor in HA
The formula is: ( (Vdry - voltage_l1) / (Vdry-Vwet) ) * 100
In my case: (2.463 - voltage_l1) / 1.077 * 100
- platform: mqtt
name: "Moisture"
state_topic: "zigbee2mqtt/0x00124b0009e004d5"
unit_of_measurement: "%"
value_template: "{{ (((2.463 - (value_json.voltage_l1|float)) / 1.077) * 100 ) | round(0) }}"
availability_topic: "zigbee2mqtt/bridge/state"
payload_available: "online"
payload_not_available: "offline"
json_attributes_topic: "zigbee2mqtt/0x00124b0009e004d5/attributes"
icon: mdi:leaf
Done:
![]()
Now you have endless possibilities to use the moisture value to start pumps, set alarms etc.etc.






