Devesh36/bench-eight

Eight-channel 0–10 V measurement and control console: dual ADS1115 ADCs, buffered inputs, Pico controller, microSD, RTC, RS-485, four protected low-voltage outputs and a separate OLED/encoder panel in a tscircuit assembly.

Version
0.1.3
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone Devesh36/bench-eight  # download the package files into ./bench-eight
tsci add Devesh36/bench-eight    # add it to your project as @tsci/Devesh36.bench-eight

In a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.

system-overview.circuit.tsx

PCBPCB preview for system-overview.circuit.tsx
SchematicSchematic preview for system-overview.circuit.tsx
import { systemblock } from "tscircuit";

// Logical review diagrams only: these arrows do not add electrical connections.
// Main-board references are enabled when embedded in index.circuit.tsx, and
// omitted for the standalone diagram so it can render without either PCB.
export function SystemOverview({
	linkToMain = false,
}: {
	linkToMain?: boolean;
}) {
	const main = (...names: string[]) =>
		linkToMain ? { pcbComponentNames: names } : {};
	return (
		<>
			<systemblock.page
				name="overview"
				displayName="Bench Eight | Data and control"
				description="Eight-channel 0–10 V bench logger with four low-voltage load outputs. Arrows show interfaces; see the Power page for supply paths. Firmware is not included."
				direction="right"
			>
				<systemblock.group name="inputs" displayName="Eight analog inputs">
					<systemblock.component
						name="terminals"
						displayName="J_IN1–8 | 0–10 V inputs"
						description="Common ground; power the console before applying input signals."
						{...main(...Array.from({ length: 8 }, (_, i) => `J_IN${i + 1}`))}
					/>
					<systemblock.component
						name="conditioning"
						displayName="100k / 33k + RC + clamps"
						description="Each input: attenuator, 100 nF filter and BAT54S rail clamp. 10 V becomes 2.481 V; cutoff approximately 64 Hz."
						{...main(...Array.from({ length: 8 }, (_, i) => `D_CLAMP${i + 1}`))}
					/>
					<systemblock.component
						name="buffers"
						displayName="U_BUF1–2 | MCP6004 buffers"
						description="Eight unity-gain buffers."
						{...main("U_BUF1", "U_BUF2")}
					/>
					<systemblock.component
						name="adcs"
						displayName="U_ADC1–2 | ADS1115"
						description="I2C addresses 0x48 / 0x49. Four multiplexed channels per ADC; not simultaneous sampling."
						{...main("U_ADC1", "U_ADC2")}
					/>
				</systemblock.group>
				<systemblock.component
					name="pico"
					displayName="U_PICO | Raspberry Pi Pico"
					description="RP2040 controller. Program through the Pico's own USB port; board USB-C supplies power only."
					{...main("U_PICO")}
				/>
				<systemblock.group
					name="storage-comms"
					displayName="Logging and communications"
				>
					<systemblock.component
						name="sd"
						displayName="J_SD | microSD"
						description="Shared SPI0, separate chip select GP22; card detect GP3."
						{...main("J_SD")}
					/>
					<systemblock.component
						name="rtc"
						displayName="U_RTC | DS3231 clock"
						description="I2C 0x68; alarm interrupt GP14; separate 3 V backup battery."
						{...main("U_RTC")}
					/>
					<systemblock.component
						name="rs485"
						displayName="U_RS485 | MAX3485E"
						description="UART0 half-duplex. GP2 controls DE and /RE together. 330 ohm idle bias; optional 120 ohm end termination."
						{...main("U_RS485", "JP_TERM")}
					/>
					<systemblock.component
						name="bus"
						displayName="J_RS485 + J_RS_GND"
						description="A, B and common ground to another bench instrument. Not isolated."
						{...main("J_RS485", "J_RS_GND")}
					/>
				</systemblock.group>
				<systemblock.group
					name="panel"
					displayName="Control PCB / 12-wire harness"
				>
					<systemblock.component
						name="display"
						displayName="J_OLED | 2.42-inch OLED"
						description="Waveshare SSD1309 module. SPI clock/MOSI shared with microSD; separate CS, DC and reset. 5 V module supply, 3.3 V logic."
					/>
					<systemblock.component
						name="encoder"
						displayName="ENC1 | Rotary + push"
						description="A/B/push inputs with 10k pull-ups and 10 nF filters on the control PCB."
					/>
					<systemblock.component
						name="status"
						displayName="LED_STATUS + LED_UI"
						description="One main-board LED and one control-panel LED, each with its own 1k resistor."
						{...main("LED_STATUS")}
					/>
				</systemblock.group>
				<systemblock.group name="outputs" displayName="Four DC load channels">
					<systemblock.component
						name="current"
						displayName="U_CURRENT | INA219"
						description="I2C 0x40; Kelvin sense across the shared 0.1 ohm shunt. Measures total load current, not each channel."
						{...main("U_CURRENT", "R_SHUNT")}
					/>
					<systemblock.component
						name="drivers"
						displayName="Q1–4 | AO3400A switches"
						description="Low-side drivers with gate pulldowns and SS54 flyback diodes."
						{...main("Q1", "Q2", "Q3", "Q4")}
					/>
					<systemblock.component
						name="loads"
						displayName="J_OUT1–4 | External loads"
						description="Each load connects between LOAD_V and its switched return. Separate 5–12 V supply; prototype target 100 mA/channel, 400 mA total."
						{...main("J_OUT1", "J_OUT2", "J_OUT3", "J_OUT4")}
					/>
				</systemblock.group>
				<systemblock.connection
					from="terminals"
					to="conditioning"
					label="8 analog signals"
				/>
				<systemblock.connection
					from="conditioning"
					to="buffers"
					label="FILT1–8"
				/>
				<systemblock.connection from="buffers" to="adcs" label="BUF1–8" />
				<systemblock.connection
					from="adcs"
					to="pico"
					label="I2C | GP4 / GP5"
					direction="both"
				/>
				<systemblock.connection
					from="pico"
					to="sd"
					label="SPI0 + CS GP22 + detect GP3"
					direction="both"
				/>
				<systemblock.connection
					from="pico"
					to="rtc"
					label="I2C + alarm GP14"
					direction="both"
				/>
				<systemblock.connection
					from="pico"
					to="rs485"
					label="UART GP0/1 + direction GP2"
					direction="both"
				/>
				<systemblock.connection
					from="rs485"
					to="bus"
					label="A / B"
					direction="both"
				/>
				<systemblock.connection
					from="pico"
					to="display"
					label="SPI0 + CS17 / DC20 / RST21"
				/>
				<systemblock.connection
					from="encoder"
					to="pico"
					label="GPIO10 / 11 / 12"
				/>
				<systemblock.connection from="pico" to="status" label="GPIO13" />
				<systemblock.connection
					from="pico"
					to="current"
					label="I2C | GP4 / GP5"
					direction="both"
				/>
				<systemblock.connection from="pico" to="drivers" label="GPIO6–9" />
				<systemblock.connection
					from="drivers"
					to="loads"
					label="Four switched returns"
				/>
			</systemblock.page>

			<systemblock.page
				name="power"
				displayName="Bench Eight | Power paths"
				description="USB powers the console; a separate 5–12 V source powers the loads. All grounds are shared. Pico 3V3 and the AP2112 output are separate rails. No mains connections or battery charging."
				direction="right"
			>
				<systemblock.group name="usb-power" displayName="Console supply">
					<systemblock.component
						name="usb"
						displayName="J_USB | USB-C 5 V input"
						description="Power only. Separate 5.1k resistors on CC1 and CC2; no USB-PD negotiation."
						{...main("J_USB", "R_CC1", "R_CC2")}
					/>
					<systemblock.component
						name="protection"
						displayName="F_USB + D_USB + SW_POWER"
						description="500 mA resettable fuse, SMF5.0A transient suppression and on/off switch."
						{...main("F_USB", "D_USB", "SW_POWER")}
					/>
					<systemblock.component
						name="ldo"
						displayName="U_LDO | AP2112K-3.3"
						description="External 3.3 V regulator for peripherals, with local decoupling."
						{...main("U_LDO")}
					/>
					<systemblock.component
						name="pico-diode"
						displayName="D_PICO | Schottky diode"
						description="V5 feeds Pico VSYS through B5819W; Pico USB must not backfeed V5."
						{...main("D_PICO")}
					/>
				</systemblock.group>
				<systemblock.component
					name="pico-power"
					displayName="U_PICO | VSYS / own regulator"
					description="PICO3V3 is separate from V3V3. Keep the console powered while programming with Pico USB to avoid driving unpowered peripherals."
					{...main("U_PICO")}
				/>
				<systemblock.component
					name="peripheral-power"
					displayName="ADC / buffers / SD / RTC / RS-485"
					description="V3V3 also powers INA219 and the panel encoder pull-ups. Power LED indicates this rail."
					{...main(
						"U_ADC1",
						"U_ADC2",
						"U_BUF1",
						"U_BUF2",
						"J_SD",
						"U_RTC",
						"U_RS485",
						"U_CURRENT",
						"LED_POWER",
					)}
				/>
				<systemblock.component
					name="oled-power"
					displayName="OLED module | 5 V supply"
					description="V5 via J_UI pin 1, J_MAIN pin 1 and J_OLED pin 1. GPIOs remain 3.3 V."
					{...main("J_UI")}
				/>
				<systemblock.group name="backup" displayName="Clock retention">
					<systemblock.component
						name="battery"
						displayName="J_BAT | External 3 V primary cell"
						description="RTC backup only; never charged by this board."
						{...main("J_BAT")}
					/>
					<systemblock.component
						name="rtc-backup"
						displayName="U_RTC | DS3231 VBAT"
						description="Normal VCC comes from V3V3; VBAT maintains time when console power is off."
						{...main("U_RTC")}
					/>
				</systemblock.group>
				<systemblock.group
					name="load-power"
					displayName="Independent load supply"
				>
					<systemblock.component
						name="external"
						displayName="J_LOAD_POWER | 5–12 V DC"
						description="Regulated external source; common ground with the console."
						{...main("J_LOAD_POWER")}
					/>
					<systemblock.component
						name="load-protection"
						displayName="F_LOAD + D_REVERSE"
						description="500 mA resettable fuse and SS54 series reverse-polarity diode."
						{...main("F_LOAD", "D_REVERSE")}
					/>
					<systemblock.component
						name="shunt"
						displayName="R_SHUNT | 0.1 ohm"
						description="INA219 senses directly at both pads. 40 mV nominal drop at the 400 mA total design target."
						{...main("R_SHUNT", "U_CURRENT")}
					/>
					<systemblock.component
						name="load-pairs"
						displayName="J_OUT1–4 | Loads + low-side switches"
						description="LOAD_V to each load, then Q1–4 to common GND. SS54 diodes return flyback current to LOAD_V. USB does not supply the loads."
						{...main(
							"J_OUT1",
							"J_OUT2",
							"J_OUT3",
							"J_OUT4",
							"Q1",
							"Q2",
							"Q3",
							"Q4",
						)}
					/>
				</systemblock.group>
				<systemblock.connection
					from="usb"
					to="protection"
					label="USB5V"
					kind="power"
				/>
				<systemblock.connection
					from="protection"
					to="ldo"
					label="V5 | switched 5 V"
					kind="power"
				/>
				<systemblock.connection
					from="protection"
					to="pico-diode"
					label="V5"
					kind="power"
				/>
				<systemblock.connection
					from="pico-diode"
					to="pico-power"
					label="PICO_VSYS"
					kind="power"
				/>
				<systemblock.connection
					from="ldo"
					to="peripheral-power"
					label="V3V3 | 3.3 V"
					kind="power"
				/>
				<systemblock.connection
					from="protection"
					to="oled-power"
					label="V5 via 12-wire harness"
					kind="power"
				/>
				<systemblock.connection
					from="battery"
					to="rtc-backup"
					label="VBAT | 3 V backup"
					kind="power"
				/>
				<systemblock.connection
					from="external"
					to="load-protection"
					label="EXT_RAW"
					kind="power"
				/>
				<systemblock.connection
					from="load-protection"
					to="shunt"
					label="EXT_PROTECTED"
					kind="power"
				/>
				<systemblock.connection
					from="shunt"
					to="load-pairs"
					label="LOAD_V"
					kind="power"
				/>
			</systemblock.page>
		</>
	);
}

// A single group root keeps both native system pages together in the publishing CLI.
export default function SystemOverviewDocument() {
	return (
		<group>
			<SystemOverview />
		</group>
	);
}