aj0070/scope-frontend
A 4-layer dual-channel oscilloscope analog front end with BNC inputs, relay-selectable AC/DC coupling and attenuation, FET buffers, programmable VGAs, differential ADC drivers, dual 8-bit ADCs with 25 MHz clock, power conversion/LDOs, and control/data headers.
- Version
- 1.0.0
- License
- unset
- Stars
- 0
Use with the tscircuit CLI
tsci is the tscircuit CLI. Install it with npm install -g tscircuit.
tsci clone aj0070/scope-frontend # download the package files into ./scope-frontend
tsci add aj0070/scope-frontend # add it to your project as @tsci/aj0070.scope-frontendIn 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.
src/channel.tsx
import React from "react"
import { AD8065ARZ_REEL7 } from "../imports/AD8065ARZ_REEL7"
import { G6K_2F_Y_TR_DC5 } from "../imports/G6K_2F_Y_TR_DC5"
import { KH_BNC50_3511 } from "../imports/KH_BNC50_3511"
import { LMH6518SQ_NOPB } from "../imports/LMH6518SQ_NOPB"
export const AD8065_PINS = {
pin1: "NC3",
pin2: "IN_NEG",
pin3: "IN_POS",
pin4: "V_NEG",
pin5: "NC1",
pin6: "OUT",
pin7: "V_POS",
pin8: "NC2",
} as const
export const AD8065_ATTRS = {
IN_POS: { mustBeConnected: true },
IN_NEG: { mustBeConnected: true },
OUT: { providesPower: true },
V_POS: { requiresPower: true },
V_NEG: { requiresPower: true },
} as const
export const RELAY_PINS = {
pin1: "COIL_A",
pin2: "NC1",
pin3: "COM1",
pin4: "NO1",
pin5: "NO2",
pin6: "COM2",
pin7: "NC2",
pin8: "COIL_B",
} as const
export interface ChannelOpts {
ch: "A" | "B"
y: number
sheet: string
j: string
kc: string
ka: string
u: string
vga: string
r: number
c: number
ulnPin: string
}
/**
* One scope channel. Signal order left to right:
* BNC, 1M termination, AC/DC coupling relay, 10:1 attenuator relay,
* FET buffer, VGA.
*/
export function channelParts(o: ChannelOpts) {
const { ch, y, sheet, j, kc, ka, u, vga, r, c } = o
const n = (s: string) => `net.CH${ch}_${s}`
const sch = (x: number, yy: number) => ({ schSheetName: sheet, schX: x, schY: yy })
const pcb = (x: number, yy: number) => ({ pcbX: x, pcbY: yy })
const inNet = `net.CH${ch}_IN`
const cplNet = `net.CH${ch}_CPL`
const attNet = `net.CH${ch}_ATT`
const tapNet = `net.CH${ch}_TAP`
const bufNet = `net.CH${ch}_BUF`
return (
<>
<KH_BNC50_3511
name={j}
allowOffBoard
pcbRotation={270}
{...pcb(-34, y)}
{...sch(-13, 3)}
/>
<trace from={`${j}.pin1`} to={inNet} />
<trace from={`${j}.pin2`} to="net.GND" />
<trace from={`${j}.pin3`} to="net.GND" />
<trace from={`${j}.pin4`} to="net.GND" />
{/* 1M input termination */}
<resistor
name={`R${r}`}
resistance="1M"
footprint="0402"
pcbRotation={180}
{...pcb(-24.5, y > 0 ? 5.5 : -5.5)}
{...sch(-8.5, 5.5)}
schRotation={y > 0 ? 270 : 90}
/>
<trace from={`R${r}.pin1`} to={inNet} />
<trace from={`R${r}.pin2`} to="net.GND" />
{/* AC coupling capacitor, selected by the coupling relay */}
<capacitor
name={`C${c}`}
capacitance="100nF"
footprint="0402"
{...pcb(-24.5, y > 0 ? 18.5 : -18.5)}
{...sch(-4.5, 5)}
schOrientation="vertical"
/>
<trace from={`C${c}.pin1`} to={inNet} />
{/* AC/DC coupling relay: NC = DC, NO = AC */}
<G6K_2F_Y_TR_DC5
name={kc}
noConnect={["pin5", "pin6", "pin7"]}
{...pcb(-22.5, y)}
{...sch(-6, 3)}
/>
<trace from={`${kc}.pin1`} to="net.P5V" />
<trace from={`${kc}.pin8`} to={`net.K${kc}_DRV`} />
<trace from={`${kc}.pin2`} to={inNet} />
<trace from={`${kc}.pin4`} to={`C${c}.pin2`} />
<trace from={`${kc}.pin3`} to={n("CPL")} />
{/* 10:1 attenuator divider, 9M + 1M */}
<resistor
name={`R${r + 1}`}
resistance="9M"
footprint="0402"
{...pcb(-18, y > 0 ? 5.5 : -5.5)}
{...sch(-6.1, 0)}
/>
<resistor
name={`R${r + 2}`}
resistance="1M"
footprint="0402"
pcbRotation={y > 0 ? 180 : 0}
{...pcb(y > 0 ? -18 : -10, y > 0 ? 18.5 : -18.5)}
{...sch(-3.5, -3)}
schRotation={270}
/>
<trace from={`R${r + 1}.pin1`} to={n("CPL")} />
<trace from={`R${r + 1}.pin2`} to={n("TAP")} />
<trace from={`R${r + 2}.pin1`} to={n("TAP")} />
<trace from={`R${r + 2}.pin2`} to="net.GND" />
{/* attenuator relay: NC = 10:1 tap, NO = 1:1 */}
<G6K_2F_Y_TR_DC5
name={ka}
noConnect={["pin5", "pin6", "pin7"]}
{...pcb(-11.5, y)}
{...sch(-0.5, 3)}
/>
<trace from={`${ka}.pin1`} to="net.P5V" />
<trace from={`${ka}.pin8`} to={`net.K${ka}_DRV`} />
<trace from={`${ka}.pin2`} to={n("TAP")} />
<trace from={`${ka}.pin4`} to={n("CPL")} />
<trace from={`${ka}.pin3`} to={n("BUF")} />
{/* FET input buffer, unity gain */}
<AD8065ARZ_REEL7
name={u}
{...pcb(-3, y)}
{...sch(3, 3)}
/>
<trace from={`${u}.pin3`} to={n("BUF")} />
<trace from={`${u}.pin7`} to="net.P5VA" />
<trace from={`${u}.pin4`} to="net.N5VA" />
<resistor
name={`R${r + 3}`}
resistance="0"
footprint="0402"
{...pcb(-4.5, y > 0 ? 6.6 : -6.6)}
{...sch(4.5, 6)}
schRotation={y > 0 ? 270 : 90}
/>
<trace from={`R${r + 3}.pin1`} to={`${u}.pin6`} />
<trace from={`R${r + 3}.pin2`} to={`${u}.pin2`} />
<resistor
name={`R${r + 4}`}
resistance="50"
footprint="0402"
{...pcb(1.0, y)}
{...sch(5.5, 3)}
/>
<trace from={`${u}.pin6`} to={`R${r + 4}.pin1`} />
<trace from={`R${r + 4}.pin2`} to={n("DIF")} />
<capacitor
name={`C${c + 1}`}
capacitance="100nF"
footprint="0402"
pcbRotation={180}
{...pcb(-8.5, y > 0 ? 5.5 : -5.5)}
{...sch(2, 6)}
schRotation={270}
/>
<capacitor
name={`C${c + 2}`}
capacitance="100nF"
footprint="0402"
{...pcb(-10.5, y > 0 ? 5.5 : -5.5)}
{...sch(1.5, 0)}
schRotation={270}
/>
<trace from={`C${c + 1}.pin1`} to="net.P5VA" />
<trace from={`C${c + 1}.pin2`} to="net.GND" />
<trace from={`C${c + 2}.pin1`} to="net.N5VA" />
<trace from={`C${c + 2}.pin2`} to="net.GND" />
{/* programmable VGA, differential in and out */}
<LMH6518SQ_NOPB
name={vga}
noConnect={["OUTAUX_POS", "OUTAUX_NEG"]}
{...pcb(7, y)}
{...sch(9, 3)}
/>
<trace from={`${vga}.IN_POS`} to={`C${c + 3}.pin2`} />
<trace from={`${vga}.IN_NEG`} to={`C${c + 4}.pin2`} />
<capacitor
name={`C${c + 3}`}
capacitance="100nF"
footprint="0402"
{...pcb(4.5, y > 0 ? 15.5 : -15.5)}
{...sch(7.5, 0)}
schOrientation="vertical"
/>
<capacitor
name={`C${c + 4}`}
capacitance="100nF"
footprint="0402"
{...pcb(6.5, y > 0 ? 15.5 : -15.5)}
{...sch(7.5, 1.5)}
/>
<trace from={`C${c + 3}.pin1`} to={n("DIFP")} />
<trace from={`C${c + 4}.pin1`} to={n("DIFN")} />
<trace from={`${vga}.VCC1`} to="net.P5VA" />
<trace from={`${vga}.VCC2`} to="net.P5VA" />
<trace from={`${vga}.VDD`} to="net.P5VA" />
<trace from={`${vga}.GND1`} to="net.GND" />
<trace from={`${vga}.GND2`} to="net.GND" />
<trace from={`${vga}.OUT_POS`} to={`net.VGA_${ch}_OUTP`} />
<trace from={`${vga}.OUT_NEG`} to={`net.VGA_${ch}_OUTN`} />
<trace from={`${vga}.N_CS`} to={`net.VGA_${ch}_CS`} />
<trace from={`${vga}.SDIO`} to="net.VGA_SDIO" />
<trace from={`${vga}.SCLK`} to="net.VGA_SCLK" />
<trace from={`${vga}.VCM`} to={`net.VCM_${ch}`} />
<trace from={`${vga}.VCM_AUX`} to={`net.VCM_AUX_${ch}`} />
<capacitor
name={`C${c + 5}`}
capacitance="100nF"
footprint="0402"
{...pcb(6.5, y > 0 ? 17.5 : -17.5)}
{...sch(8, 6)}
schRotation={270}
/>
<capacitor
name={`C${c + 6}`}
capacitance="100nF"
footprint="0402"
{...pcb(8.5, y > 0 ? 17.5 : -17.5)}
{...sch(9.5, 6)}
schRotation={270}
/>
<trace from={`C${c + 5}.pin1`} to={`net.VCM_${ch}`} />
<trace from={`C${c + 5}.pin2`} to="net.GND" />
<trace from={`C${c + 6}.pin1`} to={`net.VCM_AUX_${ch}`} />
<trace from={`C${c + 6}.pin2`} to="net.GND" />
</>
)
}