De-Fly v1.0

Wiring diagram — controller board terminals, wire for wire

Battery last. Polarity twice. Reversed battery wires can kill the board. Eyes must be NPN (sinking) only — a PNP eye can put 12 V on the signal pad and damage the controller.

1. What you are connecting

Everything outside the box is 12 volt. The board makes its own 3.3 V. You never land a wire on the ESP32 pins.

Solar panel 10 W or larger Charge controller Panel in → battery out Do not use LOAD terminals + 12 V battery 18 Ah or larger deep cycle / lawn Fuse 7.5 A BAT + within 6 in of battery + De-Fly v1.0 controller board inside the enclosure 12V IN + and − PUMP + and − EYE 1 and EYE 2 each: 12V GND SIG 16 AWG red to 12V IN + 16 AWG black battery − to 12V IN − Photo eye 1 NPN · 12 V · EYE 1 brown → 12V blue → GND black → SIG Photo eye 2 NPN · 12 V · EYE 2 brown → 12V blue → GND black → SIG 12 V diaphragm pump from the spot sprayer pump red → PUMP + pump black → PUMP − 16 AWG

2. Board terminals, as they sit on the PCB

Looking down on De-Fly v1.0. Square pad is pin 1 of that connector. ESP32 DevKit: EN pin toward the top of the board, USB toward the bottom.

ESP32 DEVKIT V1 · EN TOP · USB DOWN DE-FLY v1.0 HDR1 HDR2 PUMP=IO26 EYES=IO27 NPN ONLY 12V EYE 1 GND SIG 12V EYE 2 GND SIG + 12V IN + PUMP brown blue black Eye 1 cable brown blue black Eye 2 cable From battery red, after 7.5 A fuse black, battery − To pump pump red pump black Square pad = pin 1 of that group. Strip 5 mm, tin, feed through, solder the top fillet, zip-tie for strain relief. Cable entries on the enclosure face down. Board 12V IN − and PUMP − are both ground.

3. Wire-for-wire

FromWireTo, on the boardNotes
Battery positive 16 AWG red 12V IN + Through the 7.5 A fuse first. Fuse sits within about 6 inches of the battery post.
Battery negative 16 AWG black 12V IN − Straight to the board. Do not fuse the negative.
Pump positive 16 AWG, usually red PUMP + This pad is switched raw 12 V. The pump only sees 12 V when the relay closes.
Pump negative 16 AWG, usually black PUMP − Board ground. Same rail as battery −.
Eye 1 brown sensor cable EYE 1 12V Sensor power. About 11.6 V after the onboard protection diode.
Eye 1 blue sensor cable EYE 1 GND Sensor ground.
Eye 1 black sensor cable EYE 1 SIG NPN signal. Do not put 12 V on this pad.
Eye 2 brown sensor cable EYE 2 12V Same as eye 1.
Eye 2 blue sensor cable EYE 2 GND Same as eye 1.
Eye 2 black sensor cable EYE 2 SIG Tied on the board to eye 1 SIG. Either beam broken = cow present.
Solar panel as marked on the panel Charge controller solar / PV terminals Not to the De-Fly.
Charge controller battery + and − as marked Battery posts The controller box also lands on the battery posts. Never on the charge controller LOAD terminals.

4. Eyes, specifically

Both sensors: 12 V retroreflective, NPN (sinking) output. Baomain E3F-R2NK or equivalent. Listing must say NPN. PNP will not work and can damage the board.

Sensor wireFunctionBoard pad
Brown+12 V power12V (square pad of that eye)
BlueGroundGND
BlackNPN open-collector signalSIG
The two black wires share one input on purpose. NPN outputs only pull down, so they can sit on the same pad. The board pulls that pad up to 3.3 V. Beam clear = HIGH. Beam blocked = LOW. Set each eye to dark-on (output active when the beam is blocked). If the page says BLOCKED when the chute is empty, flip the sensor to dark-on.

Mount one eye just outside each end of the nozzle run, chest high (about 24–30 inches), reflector straight across. Keep them within about 6 feet of each other so a cow between them always breaks at least one beam.

5. Hookup order

  1. Solder or land the two eye cables. Confirm brown / blue / black three times.
  2. Land the pump wires on PUMP + and PUMP −.
  3. Wire solar → charge controller → battery, following the charge controller’s own labels.
  4. Install the fuse holder on the battery positive lead. Put the fuse in only after every other wire is on.
  5. Land 12V IN − on battery negative.
  6. Land 12V IN + on the fused battery positive.
  7. Insert the fuse. Green power LED on. Join Wi‑Fi DeFly, open 192.168.4.1.
First test is water only. On the page, block an eye with your hand. Beam should flip CLEAR → BLOCKED. Press Test spray. The pump should run and quit on its own.

6. Do not

WrongWhy
PNP photo eyesThey source 12 V onto SIG. The board is built for NPN only.
Brown and black swapped on an eyePuts 12 V on SIG. Same damage as a PNP eye.
Controller on the charge-controller LOAD terminalsMany cheap controllers disconnect LOAD at night or under a low-voltage cutoff. Land on the battery.
Battery reversedCan kill the board. Red to 12V IN +, black to 12V IN −.
12 V to any numbered ESP32 pinYou should never be on those pins. Use the labeled pads only.
No fuseA pump stall or a short will cook the wiring. 7.5 A is right for a typical 1 GPM 12 V spot-sprayer pump.