# piNail Hardware (Prototype v2)

This file captures confirmed hardware details for the cigar-box prototype.
Unknowns are marked `TBD` instead of guessed.

## Prototype Summary
- Enclosure: cigar box with integrated monitor in lid.
- Input power: IEC C14-style AC inlet ("computer PSU" style).
- Runtime controller: Raspberry Pi.
- Heating channels: 2 coil channels (channel 2 wired but not yet validated in operation).

## High-Level Power Architecture

### AC input path
1. AC inlet -> WiFi power switch.
2. From WiFi switch output -> master mains switch for system.
3. Master switch output branches:
   - Branch A: to main DC switching PSU (powers Pi/control electronics).
   - Branch B: to per-channel heater paths.

### Control electronics power (DC)
- Main DC PSU output provides control-side power for:
  - Raspberry Pi
  - Two thermocouple interface chips
  - Two SSR control sides
- Nominal rail appears to be `5V` (TBD: confirm exact PSU output voltage/current).

### Heater power path (per channel)
- After master switch, AC route per channel is:
  - fuse -> manual front-panel cutoff switch -> SSR load side -> coil connector power line
- The opposite AC pole is routed from WiFi switch output directly to coil connector corresponding pole.
- Ground/earth conductor is routed to coil connector grounds.

## Channel/Signal Topology
- Each channel has:
  - Thermocouple input (via MAX6675-type board)
  - SSR-driven AC heater output
  - Manual front panel power switch in series with heater path
- Raspberry Pi drives each relay channel independently.
- Thermocouple boards are connected to Pi GPIO.

## GPIO Wiring (Clarified)
- Thermocouple channel 1 (as originally noted): `GPIO 5`, `GPIO 8`, `GPIO 7` (BCM numbering).
- Thermocouple channel 2 was written as `11,12,13`; this has been clarified as **physical header pins**.
- Thermocouple channel 2 validated mapping:
  - Physical pins `11,12,13` => BCM `17,18,27`.
  - Read test on BCM `17,18,27` returns valid MAX6675 words with open-thermocouple fault bit set when probe is disconnected (expected).
- Alternate interpretation (BCM `11,12,13`) returned all-zero frames and appears incorrect for channel 2.
- Relay control (channel 2): `GPIO 9` (BCM).
- `TBD`: confirm relay control GPIO for channel 1 in this dual-channel prototype wiring doc.
- Note: these dual-channel assignments differ from the current single-channel `piNail2/config.json` runtime pins.

## Monitor Subsystem
- Separate 12V power supply for the built-in monitor.
- Short HDMI from Pi -> monitor.
- Monitor considered optional for future versions.

## Grounding Notes
- Enclosure is non-metal (cigar box), so chassis bonding is not the main factor here.
- Coil grounds are connected.
- DC PSU ground is connected on the input-side ground scheme.
- `TBD`: provide explicit earth/neutral/hot naming by region and verify continuity paths.

## Protection and Switching (Current Understanding)
- SSRs used for heater switching (`TBD`: exact model/rating).
- Fuses appear to be 1A glass tube, one per channel (`TBD`: verify rating + slow/fast blow type).
- Per-channel front switches are manual toggles.
- WiFi switch has onboard button and can keep networked power state independent of channel switches.

## Operational Behavior (as built)
- You can power down Pi + nail supply via master mains switch while keeping WiFi switch infrastructure behavior available.
- You can cut each coil independently with front-panel switches without shutting down software.
- Channel 2 is wired but not yet fully tested under load.

## Legacy/Prototype Context
- Prototype v1: external Pi setup (pinout/relay/thermocouple cable to Pi), no built-in monitor.
- Prototype v2: integrated Pi + wiring + optional integrated monitor.

## Required TBDs Before Final Electrical Spec
1. Coil connector pinout (both channels, exact pin numbering/function).
2. Main DC PSU make/model and output spec (V/A).
3. SSR model and AC load ratings.
4. Fuse exact spec (amp, voltage, blow type, holder type).
5. Exact line/neutral/earth routing confirmation diagram.
6. Channel 2 validation checklist/results.
