aj0070/rs485-io

A 100×70 mm industrial I/O PCB with protected 24 V power conversion, RP2040 control, isolated RS-485, eight opto-isolated digital inputs, and four transistor-driven relay outputs.

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/rs485-io  # download the package files into ./rs485-io
tsci add aj0070/rs485-io    # add it to your project as @tsci/aj0070.rs485-io

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/outputs.tsx

import React from "react"

const OUTPUT_CHANNELS = [1, 2, 3, 4]

// Four relay outputs: G6K-2P DIP8 signal relay, NPN driver, base pull-down,
// flyback diode and a 3-pin COM / NO / NC terminal. Schematic sheet: Outputs (5).
export const OutputsBlock = () => (
  <>
    {OUTPUT_CHANNELS.map((ch, i) => {
      const x = [-23, -5, 13, 31][i]
      const schX = -12 + (i % 4) * 7
      return (
        <React.Fragment key={ch}>
          <chip
            name={`K${ch}`}
            footprint="dip8"
            manufacturerPartNumber="G6K-2P-DC5"
            pinLabels={{
              pin1: "COIL_P",
              pin2: "NC1",
              pin3: "COM1",
              pin4: "NO1",
              pin5: "NO2",
              pin6: "COM2",
              pin7: "NC2",
              pin8: "COIL_N",
            }}
            noConnect={["NO2", "COM2", "NC2"]}
            connections={{
              COIL_P: "net.V5",
              COIL_N: `net.RELAY_K_${ch}`,
              NC1: `net.RELAY_NC_${ch}`,
              COM1: `net.RELAY_COM_${ch}`,
              NO1: `net.RELAY_NO_${ch}`,
            }}
            pcbX={x}
            pcbY={22}
            schSheetName="Outputs"
            schX={schX}
            schY={4}
            schWidth={2.34}
            schHeight={1}
          />

          <transistor
            name={`Q${ch}`}
            type="npn"
            footprint="sot23"
            connections={{
              base: `net.RELAY_B_${ch}`,
              collector: `net.RELAY_K_${ch}`,
              emitter: "net.GND",
            }}
            pcbX={x}
            pcbY={12.5}
            schSheetName="Outputs"
            schX={schX + 3}
            schY={1}
          />

          <resistor
            name={`R${50 + ch}`}
            footprint="0603"
            resistance="1k"
            connections={{ pin1: `net.RELAY_${ch}`, pin2: `net.RELAY_B_${ch}` }}
            pcbX={x - 4.5}
            pcbY={12.5}
            schSheetName="Outputs"
            schX={schX}
            schY={-2}
            schRotation={270}
          />

          <resistor
            name={`R${54 + ch}`}
            footprint="0603"
            resistance="10k"
            connections={{ pin1: `net.RELAY_B_${ch}`, pin2: "net.GND" }}
            pcbX={x}
            pcbY={9}
            schSheetName="Outputs"
            schX={schX + 2}
            schY={-2}
            schRotation={270}
          />

          <diode
            name={`D${50 + ch}`}
            footprint="sod123"
            connections={{ pin1: `net.RELAY_K_${ch}`, pin2: "net.V5" }}
            pcbX={x + 4.6}
            pcbY={12.5}
            schSheetName="Outputs"
            schX={schX + 4.5}
            schY={1}
            schRotation={270}
          />

          <connector
            name={`J${20 + ch}`}
            footprint="pinrow3_p5.08mm"
            pinLabels={{ pin1: "COM", pin2: "NO", pin3: "NC" }}
            connections={{
              pin1: `net.RELAY_COM_${ch}`,
              pin2: `net.RELAY_NO_${ch}`,
              pin3: `net.RELAY_NC_${ch}`,
            }}
            allowOffBoard
            pcbX={x}
            pcbY={31}
            schSheetName="Outputs"
            schX={schX + 2}
            schY={7}
          >
            <footprint insertionDirection="from_above" />
          </connector>
        </React.Fragment>
      )
    })}
  </>
)