mohan-bee/keychain

This design features a battery-powered electronic circuit with surface-mount LEDs, resistors, a squeeze switch, and custom silkscreen artwork on a PCB with specific component footprints and routing.

Version
1.0.1
License
unset
Stars
2

Use with the tscircuit CLI

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

tsci clone mohan-bee/keychain  # download the package files into ./keychain
tsci add mohan-bee/keychain    # add it to your project as @tsci/mohan-bee.keychain

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.

index.circuit.tsx

PCBPCB preview for index.circuit.tsx
SchematicSchematic preview for index.circuit.tsx
import { BS_08_B2AA010_R } from "./imports/BS_08_B2AA010_R"

const SqueezeSwitch = (props: {
  name: string
  pcbX: number | string
  pcbY: number | string
}) => (
  <chip
    name={props.name}
    pcbX={props.pcbX}
    pcbY={props.pcbY}
    pinLabels={{ pin1: ["1"], pin2: ["2"] }}
    footprint={
      <footprint>
        <smtpad
          portHints={["1"]}
          shape="rect"
          width="8mm"
          height="12mm"
          pcbX="-4.5mm"
          pcbY="0mm"
          layer="top"
        />
        <smtpad
          portHints={["2"]}
          shape="rect"
          width="8mm"
          height="12mm"
          pcbX="4.5mm"
          pcbY="0mm"
          layer="top"
        />
      </footprint>
    }
  />
)

export default () => (
  <board
    minViaHoleDiameter="0.3mm"
    minViaPadDiameter="0.45mm"
    width="34mm"
    height="36mm"
    pcbX="0"
    pcbY="0"
    borderRadius="4mm"
  >
    {/* Battery on the back */}
    <pinheader
      name="B1"
      gender="female"
      pinCount={2}
      pitch="2.54mm"
      pcbX={-12}
      pcbY={-15}
    />
    {/* Hole at the top left corner */}
    <hole pcbX="-13mm" pcbY="14mm" diameter="3mm" name="H1" />

    {/* Components on the back (hiding everything for a clean front!) */}
    {/* Center Bottom LED (inverted triangle tip) */}
    <led
      name="LED1"
      footprint="1206"
      color="red"
      pcbX="0mm"
      pcbY="8.5mm"
      layer="top"
    />
    <resistor
      name="R1"
      resistance="220"
      footprint="0603"
      pcbX="0mm"
      pcbY="10.5mm"
      layer="top"
    />

    {/* Left LED (top left lobe) */}
    <led
      name="LED2"
      footprint="1206"
      color="red"
      pcbX="-4.5mm"
      pcbY="12.5mm"
      layer="top"
    />
    <resistor
      name="R2"
      resistance="220"
      footprint="0603"
      pcbX="-4.5mm"
      pcbY="15mm"
      layer="top"
    />

    {/* Right LED (top right lobe) */}
    <led
      name="LED3"
      footprint="1206"
      color="red"
      pcbX="4.5mm"
      pcbY="12.5mm"
      layer="top"
    />
    <resistor
      name="R3"
      resistance="220"
      footprint="0603"
      pcbX="4.5mm"
      pcbY="15mm"
      layer="top"
    />

    {/* Heart Silkscreen around the LED holes */}
    <silkscreenpath
      layer="top"
      strokeWidth="0.5mm"
      route={[
        { x: 0.0, y: 13.0 },
        { x: 0.01, y: 13.11 },
        { x: 0.07, y: 13.43 },
        { x: 0.24, y: 13.92 },
        { x: 0.54, y: 14.51 },
        { x: 1.0, y: 15.13 },
        { x: 1.62, y: 15.7 },
        { x: 2.4, y: 16.15 },
        { x: 3.28, y: 16.41 },
        { x: 4.24, y: 16.45 },
        { x: 5.2, y: 16.25 },
        { x: 6.1, y: 15.82 },
        { x: 6.88, y: 15.19 },
        { x: 7.49, y: 14.39 },
        { x: 7.87, y: 13.48 },
        { x: 8.0, y: 12.5 },
        { x: 7.87, y: 11.5 },
        { x: 7.49, y: 10.51 },
        { x: 6.88, y: 9.55 },
        { x: 6.1, y: 8.63 },
        { x: 5.2, y: 7.75 },
        { x: 4.24, y: 6.91 },
        { x: 3.28, y: 6.09 },
        { x: 2.4, y: 5.31 },
        { x: 1.62, y: 4.56 },
        { x: 1.0, y: 3.87 },
        { x: 0.54, y: 3.25 },
        { x: 0.24, y: 2.73 },
        { x: 0.07, y: 2.33 },
        { x: 0.01, y: 2.08 },
        { x: 0.0, y: 2.0 },
        { x: -0.01, y: 2.08 },
        { x: -0.07, y: 2.33 },
        { x: -0.24, y: 2.73 },
        { x: -0.54, y: 3.25 },
        { x: -1.0, y: 3.87 },
        { x: -1.62, y: 4.56 },
        { x: -2.4, y: 5.31 },
        { x: -3.28, y: 6.09 },
        { x: -4.24, y: 6.91 },
        { x: -5.2, y: 7.75 },
        { x: -6.1, y: 8.63 },
        { x: -6.88, y: 9.55 },
        { x: -7.49, y: 10.51 },
        { x: -7.87, y: 11.5 },
        { x: -8.0, y: 12.5 },
        { x: -7.87, y: 13.48 },
        { x: -7.49, y: 14.39 },
        { x: -6.88, y: 15.19 },
        { x: -6.1, y: 15.82 },
        { x: -5.2, y: 16.25 },
        { x: -4.24, y: 16.45 },
        { x: -3.28, y: 16.41 },
        { x: -2.4, y: 16.15 },
        { x: -1.62, y: 15.7 },
        { x: -1.0, y: 15.13 },
        { x: -0.54, y: 14.51 },
        { x: -0.24, y: 13.92 },
        { x: -0.07, y: 13.43 },
        { x: -0.01, y: 13.11 },
        { x: -0.0, y: 13.0 },
      ]}
    />

    {/* The squeeze switch at the bottom of the front */}
    <SqueezeSwitch name="SW1" pcbX="0mm" pcbY="-9.5mm" />

    {/* Silkscreen Text */}
    <silkscreentext
      text="Stay wild. friend."
      pcbX="0mm"
      pcbY="0mm"
      fontSize="2mm"
      anchorAlignment="center"
      layer="top"
    />

    {/* Small TS logo at the bottom right corner */}
    <silkscreentext
      text="tscircuit"
      pcbX="9mm"
      pcbY="-16.5mm"
      fontSize="1.5mm"
      anchorAlignment="center"
      layer="top"
    />
    <silkscreenrect
      pcbX={12}
      layer="top"
      pcbY={-13}
      width={4}
      height={4}
      cornerRadius={1}
    />
    <silkscreentext
      text="ts"
      layer="top"
      pcbX={12}
      pcbY={-13}
      fontSize="1.5mm"
    />
    <silkscreencircle layer="top" pcbX={11} pcbY={-12} radius={0.1} />
    {/* Routing */}
    {/* Connect positive terminal to all resistors */}
    <trace from=".B1 > .pin1" to=".R1 > .pin1" />
    <trace from=".B1 > .pin1" to=".R2 > .pin1" />
    <trace from=".B1 > .pin1" to=".R3 > .pin1" />

    {/* Connect resistors to LEDs */}
    <trace from=".R1 > .pin2" to=".LED1 > .pin1" />
    <trace from=".R2 > .pin2" to=".LED2 > .pin1" />
    <trace from=".R3 > .pin2" to=".LED3 > .pin1" />

    {/* Connect all LEDs to the switch */}
    <trace from=".LED1 > .pin2" to=".SW1 > .pin1" />
    <trace from=".LED2 > .pin2" to=".SW1 > .pin1" />
    <trace from=".LED3 > .pin2" to=".SW1 > .pin1" />

    {/* Connect the switch to battery negative */}
    <trace from=".SW1 > .pin2" to=".B1 > .pin2" />
  </board>
)