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

import React from "react"

export const SERVO_COUNT = 16
export const SERVO_PITCH = 2.54
export const SERVO_X0 = (-(SERVO_COUNT - 1) * SERVO_PITCH) / 2
export const SERVO_HEADER_Y = -8.85
export const SERVO_RESISTOR_Y = -4.1

export const servoX = (i: number) => SERVO_X0 + SERVO_PITCH * i

export const ServoHeaderFootprint = () => (
  <footprint insertionDirection="from_above">
    <platedhole portHints={["1"]} pcbX={0} pcbY={-2.54} outerDiameter={1.7} holeDiameter={1.0} shape="circle" />
    <platedhole portHints={["2"]} pcbX={0} pcbY={0} outerDiameter={1.7} holeDiameter={1.0} shape="circle" />
    <platedhole portHints={["3"]} pcbX={0} pcbY={2.54} outerDiameter={1.7} holeDiameter={1.0} shape="circle" />
    <silkscreenrect pcbX={0} pcbY={0} width={2.2} height={6.6} strokeWidth={0.12} />
    <courtyardrect pcbX={0} pcbY={0} width={2.4} height={7.0} strokeWidth={0.05} />
  </footprint>
)

export const ServoOutputs = () => (
  <>
    {Array.from({ length: SERVO_COUNT }).map((_, i) => {
      const col = i % 8
      const row = Math.floor(i / 8)
      return (
        <pinheader
          key={`J${i + 1}`}
          name={`J${i + 1}`}
          pinCount={3}
          pitch="2.54mm"
          gender="male"
          footprint={<ServoHeaderFootprint />}
          pinLabels={["GND", "VPLUS", "SIG"]}
          showSilkscreenPinLabels={false}
          schWidth={0.77}
          schX={-13.5 + 3.9 * col}
          schY={row === 0 ? 4.2 : -5.4}
          pcbX={servoX(i)}
          pcbY={SERVO_HEADER_Y}
          connections={{
            GND: "net.GND",
            VPLUS: "net.VM",
            SIG: `net.SRV${i}`,
          }}
        />
      )
    })}
    {Array.from({ length: SERVO_COUNT }).map((_, i) => {
      const col = i % 8
      const row = Math.floor(i / 8)
      return (
        <resistor
          key={`R${i + 1}`}
          name={`R${i + 1}`}
          resistance="22"
          footprint="0402"
          schX={-11.9 + 3.9 * col}
          schY={row === 0 ? 3.7 : -5.9}
          schRotation={270}
          pcbX={servoX(i)}
          pcbY={SERVO_RESISTOR_Y}
          pcbRotation={90}
          connections={{ pin1: `net.SRV${i}`, pin2: `net.PWM${i}` }}
        />
      )
    })}
  </>
)