Wiring guide

The electronics are built in a fixed order: the perfboard first, on the bench, then the pump, the battery and the power parts inside the deck, the relay, and finally the board, the sensors and the servos. Each step shows the parts it adds in colour over a ghosted deck. Every wire has an ID (J for board jumpers, W for wires) that matches the cut list at the end. Each step is also a 3D scene (STEP/guide/g1_board_top.step … g7_servos.step) that can be rotated and zoomed in the viewer: run scripts/view.sh wiring to start it and print the links; each render below opens its scene when clicked.

Before starting

Names — the glossary shows every module and electrical term named below.

Colour code — every image and the cut list use the same colours.

Colour Net
red battery +7.4 V (after the BMS and the switch)
orange +5 V from the buck
yellow +3.3 V from the ESP32
black GND
green flame sensor signal (AO)
blue relay control (IN)
white, purple servo signals on the board (J3, J4), BMS balance wire (W3)

Board coordinates — the labels printed on the copper side name every hole: columns 1 to 18 along the short edge, rows A to X along the long edge. A hole is written as row and column, e.g. Q5. With the component side up and the ESP32’s USB end toward you, column 1 is on the left and row X is nearest to you. The ESP32 headers sit in columns 6 and 16, rows X to J; the IMU stands in column 18, rows S to L.

Power path — the diagram shows how energy flows, and the dashed path how the ESP32 switches the pump; the steps below build it from the battery outward.

flowchart LR
  BAT["2 × 18650<br/>(2S, 6.0–8.4 V)"] --> BMS["BMS 2S<br/>B−/P− in the negative"]
  BMS -->|P+| SW["Rocker switch"]
  SW -->|"+7.4 V"| BUCK["XL4015<br/>set to 5.0 V"]
  SW -->|"+7.4 V"| COM["Relay COM"]
  COM -->|"NO, while IN is at GND"| PUMP["Pump R385<br/>+ 1N4007"]
  BUCK -->|"+5 V"| BOARD["Perfboard rails"]
  BOARD --> ESP["ESP32 VIN"]
  BOARD --> SERVOS["Pan and tilt servos"]
  BOARD --> RELAY["Relay VCC"]
  ESP -->|"3V3"| SENS["6 flame sensors"]
  ESP -.->|"D26 high"| DRV["2N2222A<br/>relay driver"]
  DRV -.->|"pulls to GND"| RIN["Relay IN"]
  RIN -.->|"closes COM–NO"| COM

Soldering habits — tin each wire end before it goes into a hole, keep wires flat against the board, and slide heat-shrink over every wire-to-tab or wire-to-wire joint before soldering it. After each step, check the new connections with the multimeter’s continuity mode before moving on.

Perfboard

The board is built completely on the bench, with no part of the deck involved.

Headers

Perfboard, top side: headers and jumpers

The hole map below is the exact reference for every hole on the component side.

Hole map, component side
  1. Cut the female header strip into two 15-pin pieces. Plug both into the ESP32 so they stay parallel, set the ESP32 with its headers into columns 6 and 16 (rows X–J, USB end at row X), and solder the 30 pins from below. Pull the ESP32 out again.
  2. Cut two 3-pin pieces from the male header strip. Solder one into D1–D3 (pan servo) and one into B1–B3 (tilt servo), long pins up.
  3. Solder the IMU’s right-angle header to the IMU, short legs through the module from its back and pushed until the module rests against the plastic spacer. Stand the IMU on the board with the header’s long legs in S18 (VCC) to L18 (INT), the module facing the board edge, and solder the 8 legs from below. Keep it square to the board: it is the turret’s level reference.

Rails and bridges

The bottom side carries three bare-wire rails, the IMU’s two supply wires and short solder bridges. The map is drawn as seen with the board flipped over, USB end away from you, so its labels read like the ones printed on the copper side.

Hole map, solder side (board flipped)

Solder side in 3D

  1. Cut each piece to the length in the rail table and pull all the insulation off the 22 AWG pieces to get bare copper (or use a straightened resistor lead). Lay the GND piece along column 1 from row X to row A and solder it to every hole: this is the GND rail.
  2. Do the same along column 2, rows X to A: the 5V rail.
  3. Lay a short piece along column 3, rows P to I: the 3V3 rail.
  4. Lay a piece along row X from column 2 to column 6: it joins the 5V rail to the ESP32’s VIN pin.
  5. Lay a piece along column 18 from row X to row S: the IMU’s 3.3 V feed.
  6. For the IMU’s ground, lay an insulated 30 AWG wire with stripped ends along column 17 from row W to row R; it runs right next to the column 18 piece, so bare wire there could short.
  7. Make the solder bridges between neighbouring holes: columns 5–6 on row W and on every row from S to K; 16–17 on rows X and W; 17–18 on rows X and R; 16–17–18 on rows Q (SCL to D5) and P (SDA to D18); 3–4 on rows D and B. Heat both pads and feed solder until it flows across.

Jumpers

The four jumpers lie flat on the component side. Strip 3 mm at each end, push the ends through their holes and solder them on the bottom.

Jumper Colour From To Path
J1 black W5 (ESP32 GND) W1 (GND rail) straight across row W
J2 yellow X17 (ESP32 3V3) I3 (3V3 rail) up column 17 to row H, across row H, down column 3
J3 white D4 (pan servo signal) Q5 (D25) down column 4
J4 purple B4 (tilt servo signal) S5 (D27) down column 4, next to J3

Board check

With the ESP32 still unplugged, check with the multimeter:

  1. Continuity from the GND rail to the GND sockets of both ESP32 headers (W6, W16).
  2. Continuity from the 5V rail to the VIN socket (X6).
  3. Continuity from the 3V3 rail to the 3V3 socket (X16).
  4. Continuity from each servo header’s SIG pin to its GPIO socket: pan to Q6 (D25), tilt to S6 (D27).
  5. Continuity from the IMU’s pins to the right header: VCC to X16 (3V3), GND to W16, SCL to Q16 (D5), SDA to P16 (D18).
  6. No continuity between GND, 5V and 3V3, nor between neighbouring IMU pins. A beep here means a solder bridge in the wrong place; find it before going on.

Board wires

The wires that leave the board are soldered to the board now and connected to their parts later. Cut each one to the length in the cut list.

  1. W10 (orange, 22 AWG) into G2 and W11 (black, 22 AWG) into G1. Their free ends go to the buck.
  2. For the relay and each sensor, cut a female–female Dupont jumper to length, keeping the plug end. Solder the cut end into the board:
Wire Colour Hole Plugs onto
W12 orange R2 relay VCC
W13 black R1 relay GND
W14 blue R5 relay IN, through the relay driver
W15, W16, W17 green, black, yellow M5, M1, M3 30° sensor AO, GND, VCC
W18, W19, W20 green, black, yellow P5, P1, P3 90° sensor AO, GND, VCC
W21, W22, W23 green, black, yellow N5, N1, N3 150° sensor AO, GND, VCC
W24, W25, W26 green, black, yellow K5, K1, K3 210° sensor AO, GND, VCC
W27, W28, W29 green, black, yellow O5, O1, O3 270° sensor AO, GND, VCC
W30, W31, W32 green, black, yellow L5, L1, L3 330° sensor AO, GND, VCC

Dupont packs come in mixed colours; when the exact colour is missing, mark the wire with a strip of tape in the right colour near the plug.

Relay driver

The relay module switches on when its IN pin is pulled to GND and off only when IN sits at its own 5 V, which a 3.3 V ESP32 pin cannot hold: wired straight to D26, the pin’s protection diode clamps IN near 3.8 V and the relay never releases. A 2N2222A transistor pulls IN to GND while D26 is high, so the pin never meets the module’s 5 V. It is built in the air on W14 and W13, 3 cm from their plugs, and hangs beside the relay’s pins.

The figure shows where each leg and wire piece goes, and how to tell the transistor’s legs apart.

Relay driver on W14 and W13
  1. Find the transistor’s pins. With the flat face toward you and the legs down they are usually E, B, C from left to right; confirm with the multimeter’s diode mode: the red probe on B reads 600–750 to each of the others, slightly more to E, and the black probe on B reads OL to both.
  2. Cut W14 3 cm from its plug. Solder the plug piece to the collector (C), the board piece to one end of the 1 kΩ resistor and the resistor’s other end to the base (B).
  3. Solder the 10 kΩ resistor between the base (B) and the emitter (E). It holds the transistor off while the ESP32 boots and D26 floats; without it the pump can start at power-up.
  4. Cut W13 3 cm from its plug and solder both pieces back together, with a 3 cm piece of black 30 AWG from the emitter in the same joint.
  5. Cover every leg, resistor lead and joint with its own heat-shrink, so no two can touch.
  6. Check with the multimeter: W13’s plug beeps to R1; W14’s plug does not beep to R5; in diode mode, red probe on W14’s plug and black on R1 reads OL.

Deck

The pump lies on the floor of the +Y half with the battery tray above it; relay and buck lie on the floor of the −Y half and the perfboard snaps in above them. Install the parts in this order: the board covers the buck and the BMS, and the tray covers the pump.

Power

Pump, battery tray, BMS, switch and buck

  1. Solder the 1N4007 across the pump’s terminals, its silver band on the + terminal (red mark). A diode mounted the other way shorts the battery the moment the relay closes. Solder W8 (red) to + and W9 (black) to −; their other ends stay free for now.
  2. Lay the pump in its saddles on the +Y half of the floor, barbs toward the −X wall, its −Y side against the guide bar, and strap it with two zip ties through the saddle tunnels.
  3. Solder a thin wire (W3, white) to the metal strap that joins the two cells at the holder’s far end from its leads. Set the holder on the battery tray between the end stops, leads toward +X, and strap it with two zip ties through the notches in the tray’s edges.
  4. Slide the tray’s +Y edge under the two lips on the +Y wall, then press its −Y edge down until both hooks click over it.
  5. Solder W1 (holder +) to BMS B+, W2 (holder −) to B− and W3 to BM, running the three wires down past the tray’s +X end. Solder W4 (black) to P− and W5 (red) to P+.
  6. Slide the BMS into its pocket on the +X wall, pads facing inward, wires up.
  7. Snap the rocker switch into the rectangular cutout in the −Y wall from outside, rocker vertical. Solder W5 to one terminal and W6 (red) plus W7 (red, used in the relay step) together to the other terminal; cover both with heat-shrink.
  8. Solder W6 to the buck’s IN+ pad and W4 to IN−, together with W9 from the pump. Solder the board’s W10 to OUT+ and W11 to OUT− now, while the pads are reachable; the board waits beside the deck until its step.
  9. Lay the buck on its two floor bridges at the +X end of the −Y half, IN pads toward −X, components up, and strap it with two zip ties through the bridges.
  10. Set the buck before anything else is connected to its output. Insert the cells, switch on, measure the voltage on the OUT pads and turn the buck’s potentiometer until it reads 5.0 V. Switch off and take out one cell.

Relay

Relay

  1. Screw W7 (from the switch) into the relay’s COM terminal and W8 (from the pump) into NO.
  2. Lay the relay on its two floor bridges at the −X end of the −Y half, terminals toward the buck, pins toward the −X wall, and strap it with two zip ties through the bridges.

Board in place

Perfboard in the deck

  1. Plug the ESP32 into its headers.
  2. Hold the board component side up, USB end toward the +X wall. Slide its column 1 edge into the two slots on the −Y wall, then press the opposite edge down until both snap hooks click over it. The USB port lines up with the slot in the +X wall; W10 and W11 run from the buck up past the board’s +Y edge.
  3. Plug W12, W13 and W14 onto the relay’s VCC, GND and IN pins, beside the board’s −X edge; the relay driver hangs beside the pins.
  4. From inside the deck, pass the antenna’s RP-SMA bulkhead through the hole in the −X wall, threaded end first, so the pigtail stays inside. From outside, slide on the flat washer and the toothed washer and tighten the nut, holding the connector from inside so the pigtail does not twist. Screw the antenna on, folded up along the wall.
  5. Press the pigtail’s U.FL plug straight down onto the round socket at the antenna end of the ESP32 module until it clicks. Without the antenna, the ESP32-WROOM-32U only reaches WiFi at very short range.

Flame sensors

Flame sensors on their wall ledges

  1. For each sensor, desolder the IR LED, whose leads are too short to bend around the end of the board, and note which lead goes to the hole marked + and which to −. Solder 2 cm of 30 AWG wire to each lead, cover each joint with heat-shrink and solder the wires into the same holes, respecting the polarity.
  2. From inside the deck, push the LED into its collar hole until its tip sits just inside the collar’s mouth, and stand the module on the ledge below it, back against the wall, long side horizontal, potentiometer facing inward.
  3. Fix each LED in its collar and each module to the wall with a drop of hot glue.
  4. Plug the board wires onto each module: green on AO, black on GND, yellow on VCC. The DO pin stays empty.

The six sensors sit at 60° steps, counted counter-clockwise from the +X wall seen from above. On the ±X walls, the sensor in the +Y half is in the top row and the one in the −Y half is in the lower row.

Sensor Wall Row Header end toward Wires
30° +X top −Y W15–W17
90° +Y top −X W18–W20
150° −X top −Y W21–W23
210° −X lower +Y W24–W26
270° −Y top +X W27–W29
330° +X lower +Y W30–W32

Install the lower-row sensors (210°, 330°) before the top-row sensors on the same wall. The 90° sensor’s wires cross above the battery cells to the −X side; lift them aside to change the cells.

Servos

Servo cables

  1. With the cover held above the deck during the hoses step of the mechanical assembly, plug the pan servo cable onto the pan header (row D): brown on column 1, red on column 2, orange on column 3.
  2. Plug the 15 cm extension onto the tilt servo cable, pass it down through the cover’s hole together with the hose and plug it onto the tilt header (row B) with the same colour order.
  3. Above the cover, leave a loose loop of tilt cable and hose that allows a full pan turn and the whole tilt range; tie cable and hose together every few centimetres.

First power-up

The ESP32 connects to USB only out of the board: its USB 5 V reaches VIN and the 5V rail, so on the board it would back-feed the buck’s output and run the relay and the servos from the computer’s port, whether the switch is on or off. On the board, the turret is controlled over WiFi through the routes below; each one answers with the status.

Route Does
/status reports pump, aim, sensor levels, IMU and calibration
/calibrate stores the sensors’ ambient level
/level stores the current orientation as level
/auto?on=0 stops automatic mode (on=1 restarts it)
/aim?pan=0&tilt=0 aims the head, in degrees; only with automatic mode off
/pump?on=1 starts the pump (on=0 stops it)
  1. With the ESP32 out of the board and its antenna plugged in, connect it to the computer and load the firmware (Development has the commands). The serial monitor prints the WiFi address. Unplug the USB cable.
  2. With the ESP32 still out and both cells in, switch on. Measure 5.0 V between the GND and 5V rails and 0 V on the 3V3 rail; the relay’s LED stays off.
  3. Switch off, plug the ESP32 in and switch on again. The ESP32’s power LED lights up, the 3V3 rail reads 3.3 V and the relay’s LED stays off. Open /status at the WiFi address.
  4. With the hose in water, open /auto?on=0, then /pump?on=1 and /pump?on=0: the relay clicks both times and the pump runs between them.
  5. With the sensors connected and no flame in sight, open /calibrate. Until then, and after every restart, the turret does not detect fire.
  6. Set the turret on a level surface and open /level: the IMU stores this orientation as level. Without it, the firmware takes the orientation at power-up as level.
  7. Lift the +Y side (the pump side) a few centimetres and open /status: lean[1] must turn positive. If it turns negative, negate IMU_DECK_Y in firmware/include/config.h, reload the firmware and repeat the level step.

Wire cut list

Lengths come from the routed harness in the model and include stripping allowance. Cut wires 1 cm longer when in doubt; trim on assembly.

Wire Colour Gauge From To Cut length
J1 black 30 AWG ESP32 GND (W5) GND rail (W1) 3.5 cm
J2 yellow 30 AWG ESP32 3V3 (X17) 3V3 rail (I3) 10.0 cm
J3 white 30 AWG pan header SIG (D4) D25 (Q5) 5.5 cm
J4 purple 30 AWG tilt header SIG (B4) D27 (S5) 6.5 cm
W1 red 22 AWG battery holder + BMS B+ 11.0 cm
W2 black 22 AWG battery holder - BMS B- 9.5 cm
W3 white 30 AWG battery holder centre strap BMS BM 22.5 cm
W4 black 22 AWG BMS P- buck IN- 14.0 cm
W5 red 22 AWG BMS P+ switch terminal 1 16.5 cm
W6 red 22 AWG switch terminal 2 buck IN+ 10.0 cm
W7 red 22 AWG switch terminal 2 relay COM 8.0 cm
W8 red 22 AWG relay NO pump + 15.5 cm
W9 black 22 AWG buck IN- pump - 16.0 cm
W10 orange 22 AWG buck OUT+ board 5V (G2) 15.0 cm
W11 black 22 AWG buck OUT- board GND (G1) 17.0 cm
W12 orange Dupont relay VCC board 5V (R2) 14.5 cm
W13 black Dupont relay GND board GND (R1), spliced to the relay driver’s emitter 16.0 cm
W14 blue Dupont relay IN board D26 (R5), through the relay driver 17.5 cm
W15 green Dupont sensor 30° AO board M5 10.5 cm
W16 black Dupont sensor 30° GND board M1 11.0 cm
W17 yellow Dupont sensor 30° VCC board M3 11.0 cm
W18 green Dupont sensor 90° AO board P5 19.0 cm
W19 black Dupont sensor 90° GND board P1 19.0 cm
W20 yellow Dupont sensor 90° VCC board P3 19.0 cm
W21 green Dupont sensor 150° AO board N5 15.0 cm
W22 black Dupont sensor 150° GND board N1 15.5 cm
W23 yellow Dupont sensor 150° VCC board N3 15.5 cm
W24 green Dupont sensor 210° AO board K5 15.5 cm
W25 black Dupont sensor 210° GND board K1 15.5 cm
W26 yellow Dupont sensor 210° VCC board K3 16.0 cm
W27 green Dupont sensor 270° AO board O5 9.0 cm
W28 black Dupont sensor 270° GND board O1 9.5 cm
W29 yellow Dupont sensor 270° VCC board O3 10.0 cm
W30 green Dupont sensor 330° AO board L5 12.0 cm
W31 black Dupont sensor 330° GND board L1 12.0 cm
W32 yellow Dupont sensor 330° VCC board L3 12.5 cm

Rails

The pieces on the board’s solder side (rails and bridges). Bare wire is 22 AWG with all its insulation pulled off, or a straightened resistor lead; the lengths include 5 mm at each end to hold it while soldering, trimmed afterwards. The IMU ground length includes 8 mm of stripping at each end.

Piece Wire From To Cut length
GND rail bare 22 AWG X1 A1 7.0 cm
5V rail bare 22 AWG X2 A2 7.0 cm
3V3 rail bare 22 AWG P3 I3 3.0 cm
VIN to 5V bare 22 AWG X2 X6 2.5 cm
IMU 3V3 bare 22 AWG X18 S18 2.5 cm
IMU GND insulated 30 AWG W17 R17 3.0 cm

Pin assignment

firmware/include/config.h uses the same pins.

ESP32 pin Connected to
D34 30° flame sensor AO
D33 90° flame sensor AO
D35 150° flame sensor AO
VP (GPIO36) 210° flame sensor AO
D32 270° flame sensor AO
VN (GPIO39) 330° flame sensor AO
D25 pan servo signal
D27 tilt servo signal
D26 relay IN, through the 2N2222A driver
VIN 5V rail
3V3 3V3 rail (sensor supply)
GND GND rail