mohan-bee/warm5-flex-strip

A 5 V flexible PCB strip with five parallel warm-white LED branches, each current-limited by a 330 Ω resistor, plus input/output power test terminals and pass-through connections.

Version
0.0.5
License
unset
Stars
0

index.circuit.tsx

PCBPCB preview for index.circuit.tsx
SchematicSchematic preview for index.circuit.tsx
// 5 V DC, five 2500–3100 K warm-white LEDs. Dimensions are millimetres.
// Imported footprint pin 1 = cathode (left), pin 2 = anode (right).
import { Fragment } from "react"
import { RC0805FR_07330RL } from "./imports/RC0805FR_07330RL"
import { XL_2012WWC } from "./imports/XL_2012WWC"

const ledXs = [-32, -14, 4, 22, 36]
const inputStiffenerOutline = [
  { x: -49.5, y: -2.5 }, { x: -42, y: -2.5 }, { x: -42, y: 2.5 },
  ...Array.from({ length: 9 }, (_, i) => ({
    x: -49.5 + 0.5 * Math.cos(Math.PI / 2 + i * Math.PI / 16),
    y: 2 + 0.5 * Math.sin(Math.PI / 2 + i * Math.PI / 16),
  })),
  ...Array.from({ length: 9 }, (_, i) => ({
    x: -49.5 + 0.5 * Math.cos(Math.PI + i * Math.PI / 16),
    y: -2 + 0.5 * Math.sin(Math.PI + i * Math.PI / 16),
  })),
]

export function StripContents({ referenceOffset = 0, terminalBase = 1, schematicName = "main", netPrefix = "" }: { referenceOffset?: number; terminalBase?: number; schematicName?: string; netPrefix?: string }) {
  const powerPin = `.TP${terminalBase} > .pin1`
  const groundPin = `.TP${terminalBase + 1} > .pin1`
  const outputPowerPin = `.TP${terminalBase + 2} > .pin1`
  const outputGroundPin = `.TP${terminalBase + 3} > .pin1`
  return (
      <schematicsheet name={schematicName} displayName="WARM5 — five LED 5 V flex strip">
      <pcbstiffener name="input_support" layer="bottom" material="polyimide"
        shape="polygon" outline={inputStiffenerOutline} thickness={0.2} />
      <pcbstiffener name="output_support" layer="bottom" material="polyimide"
        shape="polygon" outline={inputStiffenerOutline.map(({ x, y }) => ({ x: -x, y })).reverse()} thickness={0.2} />
      <schematicsection name="input" displayName="5 V DC input" />
      <schematicsection name="output" displayName="5 V DC pass-through" />
      <schematicsection name="lights" displayName="Five warm-white LED branches" />
      <net name={`${netPrefix}V5`} />
      <net name={`${netPrefix}GND`} />

      <testpoint name={`TP${terminalBase}`} doNotPlace footprintVariant="pad" padShape="rect" width={5} height={1.5}
        pcbX={-46} pcbY={1.1} schX={-8} schY={3} schSectionName="input"
        footprint={<footprint><smtpad portHints={["pin1"]} shape="rect" width={5} height={1.5} solderMaskMargin={0.1} noSolderPaste /></footprint>}
        connections={{ pin1: `net.${netPrefix}V5` }} />
      <testpoint name={`TP${terminalBase + 1}`} doNotPlace footprintVariant="pad" padShape="rect" width={5} height={1.5}
        pcbX={-46} pcbY={-1.1} schX={-8} schY={-3} schSectionName="input"
        footprint={<footprint><smtpad portHints={["pin1"]} shape="rect" width={5} height={1.5} solderMaskMargin={0.1} noSolderPaste /></footprint>}
        connections={{ pin1: `net.${netPrefix}GND` }} />

      <testpoint name={`TP${terminalBase + 2}`} doNotPlace footprintVariant="pad" padShape="rect" width={5} height={1.5}
        pcbX={46} pcbY={1.1} schX={20} schY={3} schSectionName="output"
        footprint={<footprint><smtpad portHints={["pin1"]} shape="rect" width={5} height={1.5} solderMaskMargin={0.1} noSolderPaste /></footprint>}
        connections={{ pin1: `net.${netPrefix}V5` }} />
      <testpoint name={`TP${terminalBase + 3}`} doNotPlace footprintVariant="pad" padShape="rect" width={5} height={1.5}
        pcbX={46} pcbY={-1.1} schX={20} schY={-3} schSectionName="output"
        footprint={<footprint><smtpad portHints={["pin1"]} shape="rect" width={5} height={1.5} solderMaskMargin={0.1} noSolderPaste /></footprint>}
        connections={{ pin1: `net.${netPrefix}GND` }} />

      {ledXs.map((x, i) => {
        const n = i + 1 + referenceOffset
        const r = `.R${n} > .pin2`
        const k = `.D${n} > .pin1`
        return (
          <Fragment key={n}>
            <RC0805FR_07330RL name={`R${n}`}
              pcbX={x - 4} pcbY={0} pcbRotation={180}
              schX={i * 4} schY={2} schRotation={90} schSectionName="lights" />
            <XL_2012WWC name={`D${n}`} color="white" schDisplayValue="2500–3100 K"
              datasheetUrl="https://www.lcsc.com/datasheet/C965820.pdf"
              pcbX={x} pcbY={0} pcbRotation={180}
              schX={i * 4} schY={-1} schRotation={270} schSectionName="lights" />
            <trace name={`LED${n}`} from={`.R${n} > .pin1`} to={`.D${n} > .pin2`} width={0.4}
              pcbPaths={[[`.R${n} > .pin1`, `.D${n} > .pin2`]]} />
            <trace name={`V5_${n}`} from={i === 0 ? powerPin : `.R${n - 1} > .pin2`} to={r} width={0.6}
              pcbPathRelativeTo={powerPin}
              pcbPaths={[i === 0
                ? [powerPin, { x: 2.5, y: 0 }, { x: 3.05, y: 0.55 }, { x: x + 41.000002, y: 0.55 }, r]
                : [`.R${n - 1} > .pin2`, { x: ledXs[i - 1]! + 41.000002, y: 0.55 }, { x: x + 41.000002, y: 0.55 }, r]]} />
            <trace name={`GND_${n}`} from={i === 0 ? groundPin : `.D${n - 1} > .pin1`} to={k} width={0.6}
              pcbPathRelativeTo={groundPin}
              pcbPaths={[i === 0
                ? [groundPin, { x: 2.5, y: 0 }, { x: 3.05, y: -0.55 }, { x: x + 47.100074, y: -0.55 }, k]
                : [`.D${n - 1} > .pin1`, { x: ledXs[i - 1]! + 47.100074, y: -0.55 }, { x: x + 47.100074, y: -0.55 }, k]]} />
            {i < ledXs.length - 1 && <silkscreentext text={`D${n}`} pcbX={x + 5.3} pcbY={0} fontSize={1.7} pcbStyle={{ silkscreenTextVisibility: "visible" }} />}
            <silkscreentext text="K" pcbX={x + 2.7} pcbY={0} fontSize={1.7} pcbStyle={{ silkscreenTextVisibility: "visible" }} />
          </Fragment>
        )
      })}
      <trace name="V5_out" from={`.R${referenceOffset + 5} > .pin2`} to={outputPowerPin} width={0.6}
        pcbPathRelativeTo={powerPin}
        pcbPaths={[[`.R${referenceOffset + 5} > .pin2`, { x: ledXs[4]! + 41.000002, y: 0.55 }, { x: 88.95, y: 0.55 }, { x: 89.5, y: 0 }, outputPowerPin]]} />
      <trace name="GND_out" from={`.D${referenceOffset + 5} > .pin1`} to={outputGroundPin} width={0.6}
        pcbPathRelativeTo={groundPin}
        pcbPaths={[[`.D${referenceOffset + 5} > .pin1`, { x: ledXs[4]! + 47.100074, y: -0.55 }, { x: 88.95, y: -0.55 }, { x: 89.5, y: 0 }, outputGroundPin]]} />
      <silkscreentext text="+5V" pcbX={-40} pcbY={1} fontSize={1.7} pcbStyle={{ silkscreenTextVisibility: "visible" }} />
      <silkscreentext text="-" pcbX={-40} pcbY={-1} fontSize={1.7} pcbStyle={{ silkscreenTextVisibility: "visible" }} />
      <silkscreentext text="+5V" pcbX={41.1} pcbY={1.1} fontSize={1.7} pcbStyle={{ silkscreenTextVisibility: "visible" }} />
      <silkscreentext text="-" pcbX={41.1} pcbY={-1.1} fontSize={1.7} pcbStyle={{ silkscreenTextVisibility: "visible" }} />
      </schematicsheet>
  )
}

export default function WarmLedFlexStrip() {
  return (
    <board
      width={100} height={5} borderRadius={0.5}
      material="flex" layers={1} thickness={0.07}
      solderMaskColor="yellow" silkscreenColor="black"
      title="WARM5 FLEX REV D — JLCPCB parts — 5 V DC — terminals at both ends"
      minTraceWidth={0.4} minBoardEdgeClearance={0.5}
      minTraceToPadEdgeClearance={0.25} minPadEdgeToPadEdgeClearance={0.25}
      pcbStyle={{ silkscreenTextVisibility: "hidden" }}
      autorouter="auto-local" routeRemaining={false} schLayout={{ layoutMode: "none" }}
    >
      <StripContents />
    </board>
  )
}