/plant-monitoring

Primary LanguageCApache License 2.0Apache-2.0

ESP-IDF ESP32-C3 plant moisture monitoring

This code monitors 3 ADC sensors on a ESP32-C3 and sends their values to InfluxDB.

What it does

  1. Connect to WiFi (configurations under Kconfig)
  2. Synchronize time with NTP (local NTP server highly recommended!)
  3. Get a URL that contains the station config (MAC to station name mapping) (protip: you can host this on Home Assistant)
  4. Read the ADC sensors
  5. Write the values into InfluxDB 1.8+ (using InfluxDB v2 API) (protip: you can also install this into Home Assistant)

Configuring

If you have Home Assistant, you can create a /www directory under the configuration directory. Files there will be available under your Home Assistant URL with /local/ path. Eg. I created a file called plants.txt under the www/ directory with the following contents:

64:e8:33:00:7a:54 living_room
d4:f9:8d:03:75:00 bed_room

Then the ESP_CONFIG_URL I have set http://homeassistant.localdomain/local/plants.txt.

To get the MAC addresses, flash the firmware according to instructions below and look for this in the serial output:

I (6452) plantmonitoring: WiFi MAC address: d4:f9:8d:03:75:00

Building

Install ESP-IDF 5.0+.

idf.py menuconfig
idf.py build

To flash, press the B button on the ESP32C3 and connect USB-C cable, then run (replace COM5 with the COM port you have connected the ESP32 to):

idf.py -p COM5 flash

Then reconnect the USB cable and monitor the serial:

idf.py -p COM5 monitor