Wi-fi Soil Moisture Sensor with ESPHome

2 min read 4 months ago
Published on Apr 21, 2024 This response is partially generated with the help of AI. It may contain inaccuracies.

Table of Contents

How to Make a Wi-Fi Soil Moisture Sensor with ESPHome

Materials Needed:

  • ESP8266 or ESP32 microcontroller
  • Capacitive soil moisture sensor
  • Battery
  • 3D printed enclosure
  • Silicone
  • Two-part epoxy
  • Hot glue gun
  • Home Assistant

Step 1: Design and 3D Print Enclosure

  1. Design a suitable enclosure using Fusion 3D software.
  2. 3D print the enclosure ensuring it fits all components securely.

Step 2: Calibrate Soil Moisture Sensor

  1. Connect the soil moisture sensor to the microcontroller.
  2. Calibrate the sensor by mapping the correct voltages between zero and 100.
  3. Test the sensor to ensure accurate readings.

Step 3: Assemble the Components

  1. Wire the battery with a voltage divider to measure battery voltage.
  2. Connect the sensor pins to the microcontroller.
  3. Secure all components inside the enclosure.

Step 4: Waterproofing

  1. Apply silicone around the top of the enclosure to create a gasket.
  2. Smooth out the silicone with a guitar pick for a better seal.
  3. Use two-part epoxy to secure the sensor into the bottom of the enclosure for waterproofing.

Step 5: Final Assembly

  1. Seal the enclosure tightly.
  2. Use hot glue to secure the internals in place.
  3. Ensure all components are securely in place before testing.

Step 6: Programming with ESPHome

  1. Set up Home Assistant with ESPHome integration.
  2. Configure the soil moisture sensor with the correct settings:
    • Device class: moisture
    • Unit of measurement: percentage
    • Attenuation: 11
    • Linear mapping: 0% at 1.45 volts, 100% at 2.821 volts
  3. Use the calibrate linear function to map the values accurately.

Step 7: Additional Settings

  1. Set up a sleep schedule for the sensor to conserve battery life.
  2. Monitor the battery voltage output for maintenance.
  3. Ensure the sensor updates regularly to keep track of soil moisture levels.

Step 8: Testing and Monitoring

  1. Install the sensor in the pot or plant that requires monitoring.
  2. Check the readings in Home Assistant to ensure the sensor is working correctly.
  3. Make adjustments as needed to improve accuracy.

By following these steps, you can create a Wi-Fi soil moisture sensor using ESPHome and monitor your plants' hydration levels effectively.