This project creates a HomeKit-compatible accessory with a NodeMCU that measures soil moisture levels and sends the information to Apple's HomeKit app. Since HomeKit does not natively support a soil moisture sensor, the humidity sensor representation is used to display soil moisture levels.
- If you haven't worked with an ESP8266 before, please follow the Installing ESP8266 Board in Arduino IDE guide.
- Install the Arduino HomeKit ESP8266 library in the Arduino IDE.
- Download this repository or copy its contents to your Sketch.
- Update
wifi_info.h
to match with your Wi-Fi credentials. - Upload files to the NodeMCU.
- Add the accessory to HomeKit App using the code
111-11-111
(editmy_accessory.c
if you want to change)
- NodeMCU (ESP8266)
- Soil Moisture Sensor
- USB Power Adapter
- Optionally: Breadboard power supply
I didn't use the original breadboard power supply, and the NodeMCU is powered directly via a USB power adapter. You may add the breadboard power supply to the circuit without any adjustments to the scripts.
The soil moisture sensor outputs data ranging from 0 to 1024, where 0 represents maximum moisture and 1024 represents no moisture. This data is converted to a percentage scale from 0 to 100 to be compatible with HomeKit, where 0% indicates no moisture and 100% indicates maximum moisture.
- Thanks to Mixiaoxiao for providing the HomeKit library that enables the integration of the NodeMCU with Apple HomeKit.
- This project is a fork of the original HomeKit Soil Moisture Sensor project by shubhsheth.
- Refactoring the variable names for clarity and streamlined scripts.
- Detailed README and installation instructions
- Applied without the original breadboard power supply