# Pulse unit electronics

Everything in `out/` is generated from `board.py`, which holds the netlist and the board layout.
`python3 board.py` checks the layout; `python3 make_outputs.py` and `python3 make_schematics.py`
regenerate the files (plain Python 3, no packages needed; `rsvg-convert` only for the PNG/PDF copies).

| File | What it is |
|---|---|
| `out/schematic_power.*` | Mains, transformer, key switch, ballast, mode switch, relay, interlock chain |
| `out/schematic_control.*` | The control board: timers, comparators, SCR switch |
| `out/BOM.csv` | Board parts and chassis parts |
| `out/stripboard_top.*`, `out/stripboard_bottom.*`, `out/build_table.md` | Stripboard build: parts, links, bus wires, cuts, hole by hole |
| `out/gerber/` | PCB version: same layout, 127 x 95 mm, 2 layers. `out/pcb_preview.*` shows it |
| `out/netlist.txt` | Net-by-net pin list |

## How it works

![control](out/schematic_control.png)

Pressing FIRE starts the sequence below. There is no microcontroller and no firmware.

| Time | What happens | Part |
|---|---|---|
| 0 | FIRE pulls node X low; a 1 ms pulse triggers the lock-out timer. BOUT goes high for 24 s. Further presses are ignored. | U1, R3, C3 |
| 0 | W goes high (W = BOUT while the window capacitor is below VCC/3). Q2 energises relay K1 **through the interlock chain**; the pulse timer is released from reset. | U2b, R6, C6, Q2 |
| 0.11 s | The relay has settled. Comparator U2c trips and triggers the pulse timer. If the interlock is open there is no edge here, so no trigger. | R11, C11, U2c |
| 0.11 s to 0.11 s + T | AOUT is high for T = 20, 80 or 800 ms. Both opto LEDs light; each SCR is gated at its own zero crossings. | U3, U4, U5, SCR1, SCR2 |
| 1.6 s | Window ends: relay opens (no current is flowing), pulse timer forced back into reset. | U2b |
| 24 s | Lock-out ends. WAIT goes out. | U1 |

Protective features in the logic: power-on reset (U2a) holds U1 for 0.4 s; the pulse timer can only
run inside the relay window; the opto LEDs are in series; the relay coil current passes through the
thermal switch and the cap microswitch, so nothing in the logic can override them.

Calculated timings: lock-out 1.1 x 220k x 100 uF = 24 s. Window 330k x 10 uF x ln(10.3 / 6.4) = about
1.6 s. Pre-delay 100k x 1 uF x ln 3 = 0.11 s. Pulse 1.1 x R x 1 uF with R = 750k, 750k||82k,
750k||18k7 = 825, 81, 20 ms. Electrolytic tolerances move the first two by 20 %; that is harmless.
Use a 5 % film capacitor for C14 and 1 % resistors for R14-R16.

For 60 Hz mains, 20 and 80 ms are not whole cycles. Fit R16 = 15k4 and R15 = 84k5 for 17 and 83 ms.

## The control board

![stripboard](out/stripboard_top.png)

One layout serves both builds. On stripboard the copper strips are the bottom layer and the wire
links are the top layer; the PCB reproduces that, trimmed to the copper actually used and wider where the output current flows.

What the checker (`board.py`) proves on every run:
- every pin is on the net the schematic says, with no shorts and no open nets;
- no part body, link or pin lies under another part, under an IC, or against a terminal block;
- no link passes over a used hole;
- each bus wire lies on one uncut strip of its own net, between two pins of that net, with only lifted or unused strips either side;
- nothing but the two opto-couplers crosses the isolation moat.

PCB clearances reported by `make_outputs.py`: 6.0 mm between the 12 V side and the isolated side,
2.5 mm between AC_A and SW_OUT (the two nets that see the full output voltage).

If the cell shorts, about 4.6 A (12 A at most) flows through AC_A and SW_OUT for up to 1.6 s.
On stripboard two bare bus wires carry it (note 7); on the PCB the copper from J2 to the SCRs is 2.5 mm wide on both layers, and `python3 board.py` prints the calculated temperature rise.

Stripboard notes:
1. Cut **all 36 strips at columns 38 and 39** first. That moat is the safety barrier. Then make the other 45 cuts in `out/build_table.md`.
2. On the isolated side (columns 40-50) lift off strips 28 and 30 with a hot iron, and strips 26 and 32 beyond their cut at column 41, so no stray copper sits between the strips carrying AC_A, SW_OUT and the gates. Lacquer that area when finished.
3. Fit links first, then resistors and diodes, then sockets, capacitors, and the SCRs last.
4. Splay the SCR legs to 5.08 mm pitch. SCR1 has its metal tab toward the terminal block, SCR2 is turned round with its tab toward the opto-couplers. The tabs are live and at different potentials: no heatsinks, and they must not touch.
5. Use a bipolar NE555 for U1 and U3 (not a CMOS 555).
6. Use a nylon M3 x 8 screw and nylon washer (no spacer; the standoffs are printed) at the mounting hole nearest SCR1.
7. Fit the two bus wires with the SCRs, on the copper side. Each is 20 mm of link wire with the insulation stripped off. Lay one along the middle of strip 29, from the J2 SW_OUT pin at column 50 to the SCR2 anode at column 43, and the other along strip 31, from the J2 AC_A pin to the SCR2 cathode. Solder each wire into every joint it passes and to the strip in between.

## Chassis wiring

Mains side (adult only, 0.75 mm2 or heavier, sleeved joints):
- Inlet L and N through its switch and fuse to the transformer primaries and to PSU1.
- **230 V mains:** primaries in series (end of one to start of the other). **115 V mains:** primaries in parallel (starts together, ends together). Follow the transformer maker's colour code. Label the case with the voltage it is wired for.
- Inlet earth to the aluminium plate, the toroid bolt and washer, and the metal bodies of the key switch and toggle switch.

Isolated side (1.0 mm2, rated 300 V or more). Call the secondaries a1-b1 and a2-b2, "a" being the start of each winding:
- a1 to fuse F2, F2 to ballast RB, RB to board terminal **AC_A**.
- b2 is the **AC_B** rail.
- Fit the 12 V module's carrier with its mains terminals at the inlet end of the pocket. Run the transformer's primary wires from the inlet along the rear wall above the pocket, tied to the wall, so that only 12 V wiring uses the gap between the transformer and the pocket.
- The key switch sits above the 12 V side of the control board and carries the isolated 110 V: tie its wiring so it stays at least 6 mm from the board and from all 12 V wiring.
- Key switch pole 1 common to a2: position "55 V" to a1, position "110 V" to b1.
- Key switch pole 2 common to b1: position "55 V" to b2, position "110 V" to a2.
- **Phase check before going further:** in the 110 V position the meter must read about 120 V between a1 and b2. If it reads near zero, swap the two wires of one secondary. In the 55 V position it must read about 60 V and the transformer must stay silent and cool.
- Board terminal **SW_OUT** to: snubber SN1 (other end to AC_A), keep-alive RK (other end to AC_B), lamp LP1 (other end to AC_B), mode switch, and bridge BR1 "~".
- AC_B also to bridge BR1 other "~" and to the mode switch.
- Mode switch SW2 (DPDT): pole A common to relay contact K1a then the red BOX socket; pole B common to K1b then the black WIRE socket. AC position: A from SW_OUT, B from AC_B. DC position: A from BR1 "+", B from BR1 "-".
- Do not leave out RK. It keeps the SCRs latched at low discharge currents and stops the relay closing from false-triggering them.

12 V side (0.35 mm2, 22 AWG), board terminal block J1 from the top:

| Terminal | Goes to |
|---|---|
| POWER | green LED anode |
| SEL20, SEL80 | two ways of the pulse selector |
| VCC | selector common; thermal switch TS1, then the interlock jack tip |
| GND1 | PSU1 negative |
| FIRE, GND2 | FIRE button |
| NC | nothing |
| VIN | PSU1 positive |
| GND3 | all LED cathodes |
| KD | relay coil negative (and buzzer negative) |
| WAIT | amber LED anode |
| C | interlock jack sleeve; relay coil positive (and buzzer positive) |
| PULSE | red LED anode |
| CAP | green LED anode |

In the beaker cap: red socket to the anode stud on the carrier, black socket to the brass wire-clamp
barrel, the microswitch (common and normally-open tags) across the two contacts of the 3.5 mm jack.

The complete parts list, with every fastener, terminal, wire and label and verified part numbers, is in `../BOM/`. Read `../BOM/discrepancies.md` before ordering: several bought-in parts (key switch, 12 V module carrier, indicator lamp) still need a decision.

Then go to the commissioning tests in `../SAFETY.md`.
