README.md
# Bench Eight
An eight-channel measurement and control console for a workbench. Connect low-voltage sensor outputs or a small test setup, log readings to microSD, and switch four small DC loads. An OLED and push-rotary encoder provide the local interface. RS-485 allows a future firmware implementation to connect another bench instrument.
This is a hardware prototype. Firmware is not included: the assembly's **NO DATA** screen is a static illustration, not simulated measurements. It is not an oscilloscope or a mains-connected instrument.
## System overview
Open the **System** view on the main board or assembly to review these native tscircuit diagrams. The standalone `system-overview.circuit.tsx` contains both pages. Choose **Data and control** for interfaces or **Power paths** for supplies. Block names identify the actual circuit references; main-board blocks also carry PCB component associations.
### Data and control
The Pico reads eight buffered analog inputs, logs to microSD, communicates over RS-485, and drives the OLED, status LEDs and four output channels. The control PCB connects through the straight-through 12-wire J_UI / J_MAIN harness. SPI0 is shared by the display and microSD with separate chip selects; I²C is shared by both ADCs, the RTC and current monitor. See `PIN-MAP.md` for every harness pin and GPIO.

[Open the scalable data/control diagram](https://registry-api.tscircuit.com/package_files/download?package_name_with_version=Devesh36%2Fbench-eight%400.1.3&file_path=assets%2Fsystem-overview.svg)
### Power paths
USB-C powers the console. A separate 5–12 V DC source powers the external loads through the protection components and shared current-sense shunt. Grounds are common. The Pico's own 3.3 V rail is separate from the peripheral regulator; the RTC backup battery is not charged.

[Open the scalable power diagram](https://registry-api.tscircuit.com/package_files/download?package_name_with_version=Devesh36%2Fbench-eight%400.1.3&file_path=assets%2Fsystem-power.svg)
These diagrams describe the existing hardware; their arrows do not add electrical nets. Regenerate the standalone diagrams and README images with `bun run build:system`. The full build includes them automatically.
## What is included
- `index.circuit.tsx`: 160 × 120 mm, four-layer main PCB, with two bottom-side bulk capacitors.
- `ui.circuit.tsx`: 108 × 48 mm, two-layer display/encoder carrier PCB.
- `system-overview.circuit.tsx`: native system block pages for signal interfaces and power paths, also embedded in the main PCB and assembly.
- `channel.tsx`: the repeated input attenuator, filter and clamp circuit.
- `assembly.circuit.tsx`: enclosure, control panel, display envelope, knob, clips, standoffs, fastener envelopes and illustrative harnesses.
- `exploded.circuit.tsx`: lifted panel/lid view for inspection.
- `imports/`: local tscircuit component source and supplier CAD assets. Four large CAD assets use their original tscircuit model-CDN URLs because they exceed the registry upload limit; network access is needed to fetch those 3D models. There are no unresolved component imports.
- `assets/control-panel.glb`: generated from the actual routed control PCB; regenerated before the assembly build.
- `BOM.csv`, `PIN-MAP.md`: purchasing list and connector/firmware pin map.
- `dist/`: generated Circuit JSON, PCB and schematic SVGs, PCB/3D previews and local GLB exports.
All electrical design, footprints, routing and assembly geometry use the tscircuit ecosystem. No external EDA tool is used.
## Run
```sh
bun install
bun run typecheck
bun run build
bun run check
bun run dev
```
The build stops on circuit generation errors. It generates both system diagram pages and their README images, then builds the panel, copies its tscircuit-generated GLB into `assets/`, then builds the main board, assembled view and exploded view. Select `index.circuit.tsx` or `ui.circuit.tsx` to inspect the editable boards. The panel model inside the assembly is a CAD reference to the routed panel, not a second editable electrical instance.
## Electrical design
**Inputs:** J_IN1–J_IN8 accept 0–10 V relative to their GND terminals. Each has a 100 kΩ / 33 kΩ attenuator, a 100 nF filter and a BAT54S rail clamp, followed by a unity-gain MCP6004 buffer. The divider ratio is 33/133, so 10 V becomes about 2.481 V. Its approximately 64 Hz RC corner makes this a slow-signal logger. The input resistance is approximately 133 kΩ. Two ADS1115s each multiplex four inputs: these are not eight simultaneous-sampling channels. Configure the ±4.096 V ADC range and apply divider calibration in firmware. Do not apply input signals while the console is off; rail clamps can otherwise back-power the logic supply.
**Measurement limits:** The input dividers currently use independent 1% resistors. Their ratio alone can cause approximately −1.50% to +1.51% gain error (about 151 mV at a 10 V input). The MCP6004 offset specification of ±4.5 mV adds approximately ±18.1 mV referred to the input under its specified test conditions. Clamp leakage, ADC error, temperature, source impedance and PCB ground drops add further error. At the ±4.096 V ADC setting, one ADC count corresponds to approximately 0.504 mV at the connector; this is resolution, not guaranteed accuracy. Calibrate each channel against a trusted voltage reference. The single-supply buffer cannot guarantee an exact zero-volt output, so characterize the near-zero region separately. No overall accuracy specification is claimed before bench measurements.
**Power:** USB-C is a 5 V power input only; the independent 5.1 kΩ CC resistors identify a sink. A 500 mA resettable fuse, TVS and slide switch feed the board. Use a regulated 5 V USB-C adapter capable of at least 500 mA. An AP2112K supplies the external 3.3 V devices. The Pico receives VSYS through a Schottky diode and uses its own regulator; its 3V3 output is not tied to the AP2112 output. Power traces request 0.5 mm nominal width and ground requests 0.4 mm, with neck-down at fine-pitch pads. The four layers are available to the router; there are no dedicated solid ground/power planes in this revision.
**Outputs:** J_LOAD_POWER takes a separate, regulated 5–12 V DC load supply. It shares ground with the inputs and MCU. A 500 mA resettable fuse, series reverse-polarity diode and 0.1 Ω shunt feed LOAD_V. An INA219 monitors the total load current. Its two sense connections branch directly from the two R_SHUNT pads; keep load current out of those sense branches when changing the routing. Firmware must configure the shunt range and current-calibration register for the actual 0.1 Ω shunt; allow headroom above the nominal 40 mV drop at 400 mA. Each output has an AO3400A low-side switch, a 100 Ω gate resistor, a 100 kΩ gate pulldown and an SS54 flyback diode. Connect a load between the two pins of its J_OUT connector. Design target: 100 mA per channel, 400 mA total. These are conservative prototype limits, not tested ratings. The fuse is not an electronic current limiter. This is not a motor power stage.
**Logging and clock:** TF-01A microSD socket on SPI, with pull-ups and local bulk/decoupling capacitors. DS3231 RTC on I²C; connect a non-rechargeable 3 V battery pack to J_BAT for time retention. There is no battery charging circuit. The clock's unused pins 5–12 are grounded as instructed by its datasheet.
**RS-485:** MAX3485EIMM/TR with shared DE and active-low RE control, 330 Ω idle bias resistors, and a removable 120 Ω termination jumper. With two 120 Ω end terminations, the nominal idle differential is 275 mV. A two-node calculation using a 3.0 V rail, 1% resistor tolerances and two 96 kΩ receiver loads gives approximately 245 mV, above the receiver’s 200 mV high threshold. Fit the jumper only at a bus end, and use only one bias network on the bus. Additional nodes and cable resistance require a fresh bus-loading calculation. The adjacent J_RS_GND provides signal ground. This interface is not isolated and has no separate external surge-protection network; use it for short bench connections.
## Assembly
The main PCB sits over a ventilated PETG base. Four standoffs support the control PCB at Z = 22 mm. The 61.5 × 39.5 mm Waveshare 2.42-inch SSD1309 OLED module sits behind a bezel; retain its factory SPI configuration. The main-to-panel harness has twelve straight-through connections. A separate seven-wire adapter connects the panel header to the OLED's MX1.25 connector. Follow the signal names, not wire colours.
The main PCB, carrier PCB and their actual components are included in the assembly. The purchased display, fasteners and cables are dimensional envelopes; the cable paths are illustrative. Verify connector mating, screw lengths, display clips and print clearances with physical samples before fabrication. The encoder knob must be fitted to the actual shaft; its model is a fit-check prototype. USB-C, microSD, power switch, input terminals and load/RS-485 terminals have access openings. The Pico's own USB port and reset button are accessible with the lid removed for programming. Disconnect field inputs and loads for programming, and keep the console powered normally while the Pico programming USB is connected. Pico USB alone does not power the peripheral rail; driving peripheral signals in that condition can back-power unpowered devices. This revision does not provide automatic isolation between those power domains.
## Part sources
The ICs, USB connector, terminal blocks, encoder and microSD socket were checked through `tsci search` and imported using their JLCPCB C-numbers. Actual local imports are retained. The Pico socket uses the existing tscircuit `dip40_w17.78mm_id1mm` footprint; its model is a dimensional envelope. Samtec TSW headers use tscircuit's 2.54 mm `pinrow` footprint. Some imported generic chip declarations were corrected to connector/transistor types without changing their pad geometry.
- [TI ADS1115](https://www.ti.com/lit/ds/symlink/ads1115.pdf)
- [Microchip MCP6004](https://www.microchip.com/en-us/product/MCP6004)
- [Analog Devices DS3231](https://www.analog.com/media/en/technical-documentation/data-sheets/ds3231.pdf)
- [TI INA219](https://www.ti.com/lit/ds/symlink/ina219.pdf)
- [Diodes AP2112](https://www.diodes.com/datasheet/download/AP2112.pdf)
- [Waveshare OLED wiring and dimensions](https://www.waveshare.com/wiki/2.42inch_OLED_Module)
- [Raspberry Pi Pico datasheet](https://datasheets.raspberrypi.com/pico/pico-datasheet.pdf)
- [UMW MAX3485E datasheet](https://www.umw-ic.com/static/pdf/c60536a98710a0a982330846c713a3d0.pdf)
- [Yageo 330 Ω bias resistor](https://yageogroup.com/component-documentation/download/specsheet/RC0603FR-07330RL)
- [Samtec TSW drawing](https://suddendocs.samtec.com/prints/tsw-1xx-xx-xx-x-xx-xxx-mkt.pdf)
## Validation scope
Run the commands above to see current results. Netlist, pin specification, PCB placement and short-circuit checks are separate from schematic styling suggestions. Large schematic sheet sizes are intentional for readability. Tool checks do not verify analog accuracy, EMI, thermal limits, output fault handling, USB compliance or mechanical fit. Those require engineering review and physical testing. No firmware or production qualification is claimed. In particular, microSD write-current peaks, LDO temperature, USB inrush, analog ground noise and power-sequencing behaviour have not been measured. The TVS is transient suppression, not protection against a sustained incorrect supply voltage.
Local verification on 17 November 2026: TypeScript and all four circuit builds pass. Main PCB: 118 components, 299 routed traces, 188 vias; control PCB: 14 components, 35 traces, 19 vias. Netlist, placement and shorts checks pass. The combined check command returns a nonzero result because the main PCB has one routing-style warning. Large-sheet styling notices and two encoder metadata warnings also remain visible.