aj0070/thermocouple-logger

A 70×45 mm USB‑C powered ESP32‑C3 data logger with 3.3 V regulation, microSD storage, status/button UI, and four MAX31856 thermocouple measurement channels with filtering and SPI control.

Version
1.0.1
License
unset
Stars
0

Use with the tscircuit CLI

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

tsci clone aj0070/thermocouple-logger  # download the package files into ./thermocouple-logger
tsci add aj0070/thermocouple-logger    # add it to your project as @tsci/aj0070.thermocouple-logger

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.

src/TCChannel.tsx

import { MAX31856MUD_T } from "../imports/MAX31856MUD_T"
import { BLM18PG121SN1D } from "../imports/BLM18PG121SN1D"

const tcPinAttributes = {
  AGND: { requiresGround: true, mustBeConnected: true },
  AVDD: { requiresPower: true, mustBeConnected: true },
  DVDD: { requiresPower: true, mustBeConnected: true },
  DGND: { requiresGround: true, mustBeConnected: true },
  T_POS: { mustBeConnected: true },
  T_NEG: { mustBeConnected: true },
  BIAS: { mustBeConnected: true },
  N_CS: { mustBeConnected: true },
  SCK: { mustBeConnected: true },
  SDO: { mustBeConnected: true },
  SDI: { mustBeConnected: true },
}

export interface TCChannelProps {
  ch: number
  xc: number
  csNet: string
  schX: number
  schY: number
  sheet: string
  section: string
}

export const TCChannel = ({
  ch,
  xc,
  csNet,
  schX,
  schY,
  sheet,
  section,
}: TCChannelProps) => {
  const p = `T${ch}`
  return (
    <>
      <connector
        name={`J${ch}`}
        footprint="jst2_p2mm_ph"
        pinLabels={{ pin1: "T_POS", pin2: "T_NEG" }}
        schPinArrangement={{ topSide: ["T_POS"], bottomSide: ["T_NEG"] }}
        schSheetName={sheet}
        schSectionName={section}
        schX={schX - 4.3}
        schY={schY - 2.6}
        pcbX={xc}
        pcbY={-19.6}
        pcbRotation={180}
      >
        <footprint insertionDirection="from_above" />
      </connector>

      <MAX31856MUD_T
        name={`U${ch}`}
        pinAttributes={tcPinAttributes}
        noConnect={["DNC", "N_DRDY", "N_FAULT"]}
        schPinArrangement={{
          leftSide: {
            pins: ["T_POS", "T_NEG", "BIAS", "AVDD", "AGND"],
            direction: "top-to-bottom",
          },
          rightSide: {
            pins: ["DVDD", "DGND", "N_CS", "SCK", "SDI", "SDO"],
            direction: "top-to-bottom",
          },
        }}
        schSheetName={sheet}
        schSectionName={section}
        schX={schX}
        schY={schY + 0.6}
        pcbX={xc}
        pcbY={-6.2}
        pcbRotation={90}
      />

      <BLM18PG121SN1D
        name={`FB${ch}P`}
        schSheetName={sheet}
        schSectionName={section}
        schX={schX - 2.0}
        schY={schY - 2.2}
        pcbX={xc + 1.5}
        pcbY={-14.3}
        pcbRotation={90}
      />
      <BLM18PG121SN1D
        name={`FB${ch}N`}
        schSheetName={sheet}
        schSectionName={section}
        schX={schX - 0.4}
        schY={schY - 2.2}
        pcbX={xc - 1.5}
        pcbY={-14.3}
        pcbRotation={90}
      />

      <capacitor
        name={`CD${ch}`}
        capacitance="100nF"
        footprint="0402"
        schSheetName={sheet}
        schSectionName={section}
        schX={schX + 0.8}
        schY={schY - 2.2}
        pcbX={xc}
        pcbY={-11.4}
        pcbRotation={90}
      />
      <capacitor
        name={`CP${ch}`}
        capacitance="10nF"
        footprint="0402"
        schSheetName={sheet}
        schSectionName={section}
        schRotation={270}
        schX={schX + 2.0}
        schY={schY - 2.6}
        pcbX={xc - 1.7}
        pcbY={-11.4}
        pcbRotation={90}
      />
      <capacitor
        name={`CN${ch}`}
        capacitance="10nF"
        footprint="0402"
        schSheetName={sheet}
        schSectionName={section}
        schRotation={270}
        schX={schX + 3.2}
        schY={schY - 2.6}
        pcbX={xc + 1.7}
        pcbY={-11.4}
        pcbRotation={90}
      />
      <capacitor
        name={`CB${ch}`}
        capacitance="100nF"
        footprint="0402"
        schSheetName={sheet}
        schSectionName={section}
        schRotation={270}
        schX={schX - 3.0}
        schY={schY - 2.6}
        pcbX={xc - 3.4}
        pcbY={-11.4}
        pcbRotation={90}
      />
      <capacitor
        name={`CA${ch}`}
        capacitance="100nF"
        footprint="0402"
        schSheetName={sheet}
        schSectionName={section}
        schRotation={270}
        schX={schX + 4.4}
        schY={schY - 2.6}
        pcbX={xc + 3.4}
        pcbY={-11.4}
        pcbRotation={90}
      />
      <capacitor
        name={`CDD${ch}`}
        capacitance="100nF"
        footprint="0402"
        schSheetName={sheet}
        schSectionName={section}
        schRotation={270}
        schX={schX + 5.6}
        schY={schY - 2.6}
        pcbX={xc + 2.6}
        pcbY={-1.2}
        pcbRotation={90}
      />

      <trace from={`J${ch}.T_POS`} to={`FB${ch}P.pin1`} />
      <trace from={`J${ch}.T_NEG`} to={`FB${ch}N.pin1`} />
      <trace from={`FB${ch}P.pin2`} to={`net.${p}_P`} />
      <trace from={`FB${ch}N.pin2`} to={`net.${p}_N`} />
      <trace from={`net.${p}_P`} to={`U${ch}.T_POS`} />
      <trace from={`net.${p}_N`} to={`U${ch}.T_NEG`} />

      <trace from={`CD${ch}.pin1`} to={`net.${p}_N`} />
      <trace from={`CD${ch}.pin2`} to={`net.${p}_P`} />
      <trace from={`CP${ch}.pin1`} to={`net.${p}_N`} />
      <trace from={`CP${ch}.pin2`} to="net.GND" />
      <trace from={`CN${ch}.pin1`} to={`net.${p}_P`} />
      <trace from={`CN${ch}.pin2`} to="net.GND" />

      <trace from={`CB${ch}.pin1`} to={`U${ch}.BIAS`} />
      <trace from={`CB${ch}.pin2`} to="net.GND" />
      <trace from={`CA${ch}.pin1`} to="net.V3_3" />
      <trace from={`CA${ch}.pin2`} to="net.GND" />
      <trace from={`CDD${ch}.pin1`} to="net.V3_3" />
      <trace from={`CDD${ch}.pin2`} to="net.GND" />

      <trace from={`U${ch}.AGND`} to="net.GND" />
      <trace from={`U${ch}.DGND`} to="net.GND" />
      <trace from={`U${ch}.AVDD`} to="net.V3_3" />
      <trace from={`U${ch}.DVDD`} to="net.V3_3" />
      <trace from={`U${ch}.N_CS`} to={`net.${csNet}`} />
      <trace from={`U${ch}.SCK`} to="net.SCK" />
      <trace from={`U${ch}.SDI`} to="net.MOSI" />
      <trace from={`U${ch}.SDO`} to="net.MISO" />
    </>
  )
}