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-controllerIn 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.
dist/index.js
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
const PCB$1 = {
termX: -22.5,
termY: 8.0,
fetX: -13.5,
fetY: 8.5,
gateRX: -13,
gateRY: 3.0,
bulkX: -24.5,
bulkY: 0.0,
};
const TerminalFootprint = () => (jsxs("footprint", { insertionDirection: "from_above", children: [jsx("platedhole", { portHints: ["1"], pcbX: -2.54, pcbY: 0, outerDiameter: 2.8, holeDiameter: 1.3, shape: "circle" }), jsx("platedhole", { portHints: ["2"], pcbX: 2.54, pcbY: 0, outerDiameter: 2.8, holeDiameter: 1.3, shape: "circle" }), jsx("silkscreenrect", { pcbX: 0, pcbY: 0, width: 10.4, height: 7.4, strokeWidth: 0.15 }), jsx("courtyardrect", { pcbX: 0, pcbY: 0, width: 11.2, height: 8.2, strokeWidth: 0.05 })] }));
const PowerInput = () => (jsxs(Fragment, { children: [jsx("connector", { name: "J17", schSheetName: "Power", footprint: jsx(TerminalFootprint, {}), pinLabels: { pin1: "VIN", pin2: "GND" }, manufacturerPartNumber: "MX126-5.0-02P", schPinArrangement: {
topSide: { pins: ["VIN"], direction: "left-to-right" },
bottomSide: { pins: ["GND"], direction: "left-to-right" },
}, schX: -10, schY: 6, pcbX: PCB$1.termX, pcbY: PCB$1.termY, connections: { pin1: "net.VM_IN", pin2: "net.GND" } }), jsx("mosfet", { name: "Q1", schSheetName: "Power", channelType: "p", mosfetMode: "enhancement", footprint: "sot23", manufacturerPartNumber: "AO3401A", pinLabels: { pin1: "gate", pin2: "source", pin3: "drain" }, schX: -5, schY: 6, pcbX: PCB$1.fetX, pcbY: PCB$1.fetY, connections: {
gate: "net.GATE",
source: "net.VM",
drain: "net.VM_IN",
} }), jsx("resistor", { name: "R27", schSheetName: "Power", resistance: "10k", footprint: "0402", schX: -1.5, schY: 6, schRotation: 270, pcbX: PCB$1.gateRX, pcbY: PCB$1.gateRY, pcbRotation: 270, connections: { pin1: "net.GATE", pin2: "net.GND" } }), jsx("capacitor", { name: "C1", schSheetName: "Power", capacitance: "1000uF", footprint: "electrolytic_d6.3mm_p2.5mm", schRotation: 270, schX: 2, schY: 6, pcbX: PCB$1.bulkX, pcbY: PCB$1.bulkY, pcbRotation: 180, connections: { pin1: "net.VM", pin2: "net.GND" } })] }));
const PCB = {
u1X: 1.0,
u1Y: 2.5,
vccX: 24.5,
vccY: 8.6,
cDecX: 6.4,
cDecY: 7.6,
i2cLeftX: -30,
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 = {
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}`;
const PCA9685 = () => (jsx("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 }));
const LogicRail = () => (jsxs(Fragment, { children: [jsx("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" } }), jsx("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" } }), jsx("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",
} }), jsx("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",
} }), jsx("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" } }), jsx("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"];
const AddressJumpers = () => (jsx(Fragment, { children: ADDR_PINS.map((label, i) => (jsx("solderjumper", { name: `J${22 + i}`, schSheetName: "Control", footprint: "solderjumper3_bridged12", bridgedPins: [["1", "2"]], schWidth: 1.0, schX: -3.6 + 1.6 * i, schY: -3, pcbX: PCB.jumperX0 + PCB.jumperPitch * i, pcbY: PCB.jumperY, pcbRotation: 270, connections: {
pin1: "net.GND",
pin2: `net.${label}`,
pin3: "net.VDD",
} }, label))) }));
const SERVO_COUNT = 16;
const SERVO_PITCH = 2.54;
const SERVO_X0 = (-15 * SERVO_PITCH) / 2;
const SERVO_HEADER_Y = -8.85;
const SERVO_RESISTOR_Y = -4.1;
const servoX = (i) => SERVO_X0 + SERVO_PITCH * i;
const ServoHeaderFootprint = () => (jsxs("footprint", { insertionDirection: "from_above", children: [jsx("platedhole", { portHints: ["1"], pcbX: 0, pcbY: -2.54, outerDiameter: 1.7, holeDiameter: 1.0, shape: "circle" }), jsx("platedhole", { portHints: ["2"], pcbX: 0, pcbY: 0, outerDiameter: 1.7, holeDiameter: 1.0, shape: "circle" }), jsx("platedhole", { portHints: ["3"], pcbX: 0, pcbY: 2.54, outerDiameter: 1.7, holeDiameter: 1.0, shape: "circle" }), jsx("silkscreenrect", { pcbX: 0, pcbY: 0, width: 2.2, height: 6.6, strokeWidth: 0.12 }), jsx("courtyardrect", { pcbX: 0, pcbY: 0, width: 2.4, height: 7.0, strokeWidth: 0.05 })] }));
const ServoOutputs = () => (jsxs(Fragment, { children: [Array.from({ length: SERVO_COUNT }).map((_, i) => {
const col = i % 8;
const row = Math.floor(i / 8);
return (jsx("pinheader", { name: `J${i + 1}`, pinCount: 3, pitch: "2.54mm", gender: "male", footprint: jsx(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}`,
} }, `J${i + 1}`));
}), Array.from({ length: SERVO_COUNT }).map((_, i) => {
const col = i % 8;
const row = Math.floor(i / 8);
return (jsx("resistor", { 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}` } }, `R${i + 1}`));
})] }));
var index_circuit = () => (jsxs("board", { width: "65mm", height: "25mm", layers: 2, defaultTraceWidth: 0.25, minTraceWidth: 0.15, children: [jsx("net", { name: "VM_IN", isPowerNet: true, nominalTraceWidth: 0.8 }), jsx("net", { name: "VM", isPowerNet: true, nominalTraceWidth: 0.8 }), jsx("net", { name: "GND", isGroundNet: true, nominalTraceWidth: 0.8 }), jsx("net", { name: "VDD", isPowerNet: true, nominalTraceWidth: 0.4 }), jsx("net", { name: "GATE", nominalTraceWidth: 0.25 }), jsx("net", { name: "SDA", nominalTraceWidth: 0.25 }), jsx("net", { name: "SCL", nominalTraceWidth: 0.25 }), [0, 1, 2, 3, 4, 5].map((i) => (jsx("net", { name: `A${i}`, nominalTraceWidth: 0.2 }, `A${i}`))), Array.from({ length: 16 }).map((_, i) => (jsx("net", { name: `PWM${i}`, nominalTraceWidth: 0.2 }, `PWM${i}`))), Array.from({ length: 16 }).map((_, i) => (jsx("net", { name: `SRV${i}`, nominalTraceWidth: 0.3 }, `SRV${i}`))), jsx("schematicsheet", { name: "Power", displayName: "Servo power input", sheetIndex: 0 }), jsx("schematicsheet", { name: "Control", displayName: "PCA9685 and I2C", sheetIndex: 1 }), jsx("schematicsheet", { name: "Servo", displayName: "Servo outputs", sheetIndex: 2 }), jsx(PowerInput, {}), jsx(PCA9685, {}), jsx(LogicRail, {}), jsx(AddressJumpers, {}), jsx(ServoOutputs, {})] }));
export { index_circuit as default };