# Wiring

## Power distribution

```text
5 V power supply
  +5 V ── breadboard + rail ──┬── Wemos 5V
                              └── HW-517 VIN+ / POWER+

  GND  ── breadboard - rail ──┬── Wemos GND
                              ├── HW-517 VIN- / POWER-
                              ├── HW-517 signal GND (if separate)
                              └── soil sensor GND

Wemos 3V3 ─────────────────────── soil sensor VCC
Wemos A0  ─────────────────────── soil sensor AOUT
Wemos D5 / GPIO14 ─────────────── HW-517 SIG / PWM
HW-517 OUT+ / VOUT+ ───────────── pump +
HW-517 OUT- / VOUT- ───────────── pump -
```

Place a 1N4007 across the pump terminals. The striped cathode connects to pump
positive; the non-striped anode connects to pump negative.

## Pre-power checklist

- Confirm the actual HW-517 terminal labels; board variants exist.
- Confirm there is no short between +5 V and GND.
- Confirm every ground is common.
- Confirm the soil sensor VCC is on 3.3 V, not 5 V.
- Confirm the diode stripe is on pump +.
- For the first logic test, disconnect the pump and observe the module LED or
  measure the output.
- Do not connect USB and external 5 V simultaneously until the Wemos board's
  power path has been verified.

## First powered test

1. Power only the Wemos and sensor, with the pump disconnected.
2. Confirm the device boots and `Soil Moisture Raw` changes when the sensor
   environment changes.
3. Press `Water for 1 second` and verify the HW-517 output is active for about
   one second only.
4. Remove power during a pulse, reconnect it and verify the output starts OFF.
5. Only then connect the pump for a short supervised wet test.

