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-ioIn 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/inputs.tsx
import React from "react"
const INPUT_CHANNELS = [1, 2, 3, 4, 5, 6, 7, 8]
// Eight opto-isolated 24 V digital inputs (PC817 class), each with a series
// resistor, indicator LED, reverse diode and a 10k pull-up on the logic side.
// Schematic sheets: Inputs A (3) and Inputs B (4).
export const InputsBlock = () => (
<>
{INPUT_CHANNELS.map((ch, i) => {
const x = -42 + i * 12
const schX = -12 + (i % 4) * 7
const sheet = ch <= 4 ? "Inputs A" : "Inputs B"
return (
<React.Fragment key={ch}>
<connector
name={`J${10 + ch}`}
footprint="pinrow2_p5.08mm"
pinLabels={{ pin1: "IN", pin2: "COM" }}
schPinArrangement={{ topSide: ["COM"], bottomSide: ["IN"] }}
connections={{ pin1: `net.FIELD_IN_${ch}`, pin2: "net.FIELD_COM" }}
allowOffBoard
pcbX={x}
pcbY={-29}
pcbRotation={270}
schSheetName={sheet}
schX={schX}
schY={8}
>
<footprint insertionDirection="from_above" />
</connector>
<resistor
name={`R${30 + ch}`}
footprint="1206"
resistance="2.2k"
connections={{ pin1: `net.FIELD_IN_${ch}`, pin2: `net.IN_LED_${ch}` }}
pcbX={x - 3.5}
pcbY={-15.5}
schSheetName={sheet}
schX={schX}
schY={5}
schRotation={270}
/>
<led
name={`LED${10 + ch}`}
footprint="0603"
color="red"
pinLabels={{ pin1: "cathode", pin2: "anode" }}
supplierPartNumbers={{ jlcpcb: ["C2904374"] }}
connections={{ pin1: `net.IN_OPTO_${ch}`, pin2: `net.IN_LED_${ch}` }}
pcbX={x + 3.5}
pcbY={-15.5}
schSheetName={sheet}
schX={schX}
schY={2.5}
schRotation={270}
/>
<chip
name={`U${20 + ch}`}
footprint="dip4"
manufacturerPartNumber="PC817"
pinLabels={{ pin1: "A", pin2: "K", pin3: "E", pin4: "C" }}
connections={{
A: `net.IN_OPTO_${ch}`,
K: "net.FIELD_COM",
C: `net.IN_${ch}`,
E: "net.GND",
}}
pcbX={x}
pcbY={-20}
schSheetName={sheet}
schX={schX}
schY={-1.5}
schWidth={1.39}
schHeight={0.6}
/>
<resistor
name={`R${40 + ch}`}
footprint="0603"
resistance="10k"
connections={{ pin1: "net.V3_3", pin2: `net.IN_${ch}` }}
pcbX={x}
pcbY={-6.3}
pcbRotation={270}
schSheetName={sheet}
schX={schX + 4}
schY={-1.5}
schRotation={270}
/>
</React.Fragment>
)
})}
</>
)