aj0070/servo-controller

16-channel PCA9685 I²C PWM servo controller board with adjustable address jumpers, protected external servo power input, MOSFET switching, bulk decoupling, and 16 three-pin servo headers.

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

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.

parts/control.tsx

import React from "react"

export const PCB = {
  u1X: 1.0,
  u1Y: 2.5,
  vccX: 24.5,
  vccY: 8.6,
  cDecX: 6.4,
  cDecY: 7.6,
  i2cLeftX: -30.0,
  i2cLeftY: 0.5,
  i2cRightX: 30.0,
  i2cRightY: 0.5,
  rPullX: 12.6,
  rPullY: 8.6,
  jumperX0: 8.4,
  jumperY: 3.4,
  jumperPitch: 2.9,
}

const CHIP_CONNECTIONS: Record<string, string> = {
  VSS: "net.GND",
  VDD: "net.VDD",
  SDA: "net.SDA",
  SCL: "net.SCL",
  N_OE: "net.GND",
  EXTCLK: "net.GND",
}
for (let i = 0; i < 16; i++) CHIP_CONNECTIONS[`LED${i}`] = `net.PWM${i}`
for (let i = 0; i < 6; i++) CHIP_CONNECTIONS[`A${i}`] = `net.A${i}`

export const PCA9685 = () => (
  <chip
    name="U1"
    schSheetName="Control"
    supplierPartNumbers={{ jlcpcb: ["C2678753"] }}
    manufacturerPartNumber="PCA9685PW,118"
    footprint="tssop28_p0.65mm_w4.5964mm_pw0.4064mm_pl1.8034mm_rounded0.2032mm"
    pinLabels={{
      pin1: ["A0"],
      pin2: ["A1"],
      pin3: ["A2"],
      pin4: ["A3"],
      pin5: ["A4"],
      pin6: ["LED0"],
      pin7: ["LED1"],
      pin8: ["LED2"],
      pin9: ["LED3"],
      pin10: ["LED4"],
      pin11: ["LED5"],
      pin12: ["LED6"],
      pin13: ["LED7"],
      pin14: ["VSS"],
      pin15: ["LED8"],
      pin16: ["LED9"],
      pin17: ["LED10"],
      pin18: ["LED11"],
      pin19: ["LED12"],
      pin20: ["LED13"],
      pin21: ["LED14"],
      pin22: ["LED15"],
      pin23: ["N_OE"],
      pin24: ["A5"],
      pin25: ["EXTCLK"],
      pin26: ["SCL"],
      pin27: ["SDA"],
      pin28: ["VDD"],
    }}
    pinAttributes={{
      VDD: { requiresPower: true },
      VSS: { requiresGround: true },
      N_OE: { mustBeConnected: true },
      EXTCLK: { mustBeConnected: true },
    }}
    schWidth={2.15}
    schHeight={3.0}
    schX={0}
    schY={1}
    pcbX={PCB.u1X}
    pcbY={PCB.u1Y}
    connections={CHIP_CONNECTIONS}
  />
)

export const LogicRail = () => (
  <>
    <pinheader
      name="J19"
      schSheetName="Control"
      pinCount={2}
      pitch="2.54mm"
      gender="male"
      footprint="pinrow2_p2.54mm"
      pinLabels={["VDD", "GND"]}
      schWidth={0.77}
      schX={-1.2}
      schY={5.2}
      pcbX={PCB.vccX}
      pcbY={PCB.vccY}
      connections={{ pin1: "net.VDD", pin2: "net.GND" }}
    />
    <capacitor
      name="C2"
      schSheetName="Control"
      capacitance="100nF"
      footprint="0402"
      schRotation={270}
      schX={1.2}
      schY={2.8}
      pcbRotation={180}
      pcbX={PCB.cDecX}
      pcbY={PCB.cDecY}
      connections={{ pin1: "net.VDD", pin2: "net.GND" }}
    />
    <pinheader
      name="J20"
      schSheetName="Control"
      pinCount={4}
      pitch="2.54mm"
      gender="male"
      footprint="pinrow4_p2.54mm"
      pinLabels={["VDD", "SDA", "SCL", "GND"]}
      schWidth={0.485}
      schX={-5.2}
      schY={1.0}
      pcbX={PCB.i2cLeftX}
      pcbY={PCB.i2cLeftY}
      pcbRotation={90}
      connections={{
        pin1: "net.VDD",
        pin2: "net.SDA",
        pin3: "net.SCL",
        pin4: "net.GND",
      }}
    />
    <pinheader
      name="J21"
      schSheetName="Control"
      pinCount={4}
      pitch="2.54mm"
      gender="male"
      footprint="pinrow4_p2.54mm"
      pinLabels={["VDD", "SDA", "SCL", "GND"]}
      schWidth={0.485}
      schX={5.2}
      schY={1.0}
      pcbX={PCB.i2cRightX}
      pcbY={PCB.i2cRightY}
      pcbRotation={90}
      connections={{
        pin1: "net.VDD",
        pin2: "net.SDA",
        pin3: "net.SCL",
        pin4: "net.GND",
      }}
    />
    <resistor
      name="R28"
      schSheetName="Control"
      resistance="4.7k"
      footprint="0402"
      schRotation={270}
      schX={3.0}
      schY={4.6}
      pcbRotation={180}
      pcbX={PCB.rPullX}
      pcbY={PCB.rPullY}
      connections={{ pin1: "net.VDD", pin2: "net.SDA" }}
    />
    <resistor
      name="R29"
      schSheetName="Control"
      resistance="4.7k"
      footprint="0402"
      schRotation={270}
      schX={4.2}
      schY={4.6}
      pcbX={PCB.rPullX + 2.4}
      pcbY={PCB.rPullY}
      connections={{ pin1: "net.VDD", pin2: "net.SCL" }}
    />
  </>
)

const ADDR_PINS = ["A0", "A1", "A2", "A3", "A4", "A5"]

export const AddressJumpers = () => (
  <>
    {ADDR_PINS.map((label, i) => (
      <solderjumper
        key={label}
        name={`J${22 + i}`}
        schSheetName="Control"
        footprint="solderjumper3_bridged12"
        bridgedPins={[["1", "2"]]}
        schWidth={1.0}
        schX={-3.6 + 1.6 * i}
        schY={-3.0}
        pcbX={PCB.jumperX0 + PCB.jumperPitch * i}
        pcbY={PCB.jumperY}
        pcbRotation={270}
        connections={{
          pin1: "net.GND",
          pin2: `net.${label}`,
          pin3: "net.VDD",
        }}
      />
    ))}
  </>
)