Arduino example to control a relay based on moisture values. The basis for a smart garden irrigation system.
- Connect VCC to 3.3v
- Connect ground to ground
- Connect data pin to pin D4/GPIO2
- Connect VCC to 3.3v
- Connect ground to ground
- Connect data pin to AO analog pin.
Wire your pump to the relay. The pump will start pumping water as soon as the soil moisture sensor detects too less water.