jeffsteels/awesome

A 2-layer PCB for balancing a 5-cell battery pack using four coupled-inductor flyback stages with MOSFETs, Schottky diodes, capacitors, bias resistors, and protected six-tap connections.

Version
0.0.1
License
unset
Stars
0

Use with the tscircuit CLI

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

tsci clone jeffsteels/awesome  # download the package files into ./awesome
tsci add jeffsteels/awesome    # add it to your project as @tsci/jeffsteels.awesome

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.

dist/index.js

import { jsxs, jsx } from 'react/jsx-runtime';
import React from 'react';

const BridgeStage5S = ({ index, x, y, netLow, netMid, netHigh, }) => {
    const n = index + 1;
    // Arrange the schematic in a 2 x 2 grid.
    const sx = index % 2 === 0 ? -34 : 34;
    const sy = index < 2 ? 29 : -27;
    const section = `STAGE_${n}`;
    return (jsxs(React.Fragment, { children: [jsx("chip", { name: `L${n}`, pcbX: x, pcbY: y + 11, schX: sx, schY: sy + 13, schSectionName: section, pinLabels: {
                    pin1: "P1_DOT",
                    pin2: "P1_END",
                    pin3: "P2_DOT",
                    pin4: "P2_END",
                }, schPinArrangement: {
                    leftSide: {
                        direction: "top-to-bottom",
                        pins: ["P1_DOT", "P2_DOT"],
                    },
                    rightSide: {
                        direction: "top-to-bottom",
                        pins: ["P1_END", "P2_END"],
                    },
                }, footprint: jsxs("footprint", { children: [jsx("smtpad", { portHints: ["pin1"], pcbX: "-4.5mm", pcbY: "4.5mm", width: "3mm", height: "3mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin2"], pcbX: "4.5mm", pcbY: "4.5mm", width: "3mm", height: "3mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin3"], pcbX: "-4.5mm", pcbY: "-4.5mm", width: "3mm", height: "3mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin4"], pcbX: "4.5mm", pcbY: "-4.5mm", width: "3mm", height: "3mm", shape: "rect" })] }) }), jsx("chip", { name: `Q${n}_A`, footprint: "soic8", pcbX: x - 5.5, pcbY: y - 3, schX: sx - 9, schY: sy - 1, schSectionName: section }), jsx("chip", { name: `Q${n}_B`, footprint: "soic8", pcbX: x + 5.5, pcbY: y - 3, schX: sx + 9, schY: sy - 1, schSectionName: section }), jsx("diode", { name: `D${n}_A`, footprint: "sma", pcbX: x - 5.5, pcbY: y - 10, schX: sx - 16, schY: sy - 11, schSectionName: section }), jsx("diode", { name: `D${n}_B`, footprint: "sma", pcbX: x + 5.5, pcbY: y - 10, schX: sx + 16, schY: sy - 11, schSectionName: section }), jsx("capacitor", { name: `C${n}_A`, capacitance: "10uF", footprint: "0805", pcbX: x - 8, pcbY: y + 3, schX: sx - 16, schY: sy + 12, schSectionName: section }), jsx("capacitor", { name: `C${n}_B`, capacitance: "10uF", footprint: "0805", pcbX: x + 8, pcbY: y + 3, schX: sx + 16, schY: sy + 12, schSectionName: section }), jsx("resistor", { name: `R${n}_A`, resistance: "10k", footprint: "0805", pcbX: x - 2.5, pcbY: y - 16, schX: sx - 9, schY: sy - 19, schSectionName: section }), jsx("resistor", { name: `R${n}_B`, resistance: "10k", footprint: "0805", pcbX: x + 2.5, pcbY: y - 16, schX: sx + 9, schY: sy - 19, schSectionName: section }), jsx("trace", { from: `.C${n}_A > .pin1`, to: netLow }), jsx("trace", { from: `.C${n}_A > .pin2`, to: netMid }), jsx("trace", { from: `.C${n}_B > .pin1`, to: netMid }), jsx("trace", { from: `.C${n}_B > .pin2`, to: netHigh }), jsx("trace", { from: `.L${n} > .P1_DOT`, to: netLow }), jsx("trace", { from: `.L${n} > .P1_END`, to: `.Q${n}_A > .pin5` }), jsx("trace", { from: `.L${n} > .P2_DOT`, to: netMid }), jsx("trace", { from: `.L${n} > .P2_END`, to: `.Q${n}_B > .pin5` }), jsx("trace", { from: `.D${n}_A > .pin1`, to: netLow }), jsx("trace", { from: `.D${n}_A > .pin2`, to: `.Q${n}_A > .pin5` }), jsx("trace", { from: `.D${n}_B > .pin1`, to: netMid }), jsx("trace", { from: `.D${n}_B > .pin2`, to: `.Q${n}_B > .pin5` }), jsx("trace", { from: `.R${n}_A > .pin1`, to: `.Q${n}_A > .pin1` }), jsx("trace", { from: `.R${n}_A > .pin2`, to: netLow }), jsx("trace", { from: `.R${n}_B > .pin1`, to: `.Q${n}_B > .pin1` }), jsx("trace", { from: `.R${n}_B > .pin2`, to: netMid })] }));
};
function Universal5SBalancer() {
    const stages = [0, 1, 2, 3];
    const tapPins = [0, 1, 2, 3, 4, 5];
    return (jsxs("board", { width: "112mm", height: "64mm", layers: 2, autorouter: "auto-local", children: [jsx("schematicsection", { name: "STAGE_1", displayName: "Stage 1 \u2014 B0 / B1 / B2" }), jsx("schematicsection", { name: "STAGE_2", displayName: "Stage 2 \u2014 B1 / B2 / B3" }), jsx("schematicsection", { name: "STAGE_3", displayName: "Stage 3 \u2014 B2 / B3 / B4" }), jsx("schematicsection", { name: "STAGE_4", displayName: "Stage 4 \u2014 B3 / B4 / B5" }), jsx("schematicsection", { name: "TAPS", displayName: "Battery connector and tap resistors" }), jsx("pinheader", { name: "J1_CELLS", pinCount: 6, pitch: "2.5mm", pcbX: 0, pcbY: -26, schX: 0, schY: -82, schSectionName: "TAPS" }), tapPins.map((i) => (jsxs(React.Fragment, { children: [jsx("resistor", { name: `F${i + 1}`, resistance: "0.02ohm", footprint: "1812", pcbX: -27.5 + i * 11, pcbY: -19.5, schX: -30 + i * 12, schY: -63, schSectionName: "TAPS" }), jsx("trace", { from: `.J1_CELLS > .pin${i + 1}`, to: `.F${i + 1} > .pin1` }), jsx("trace", { from: `.F${i + 1} > .pin2`, to: `net.B${i}` })] }, `fuse-${i}`))), stages.map((i) => (jsx(BridgeStage5S, { index: i, x: -36 + i * 24, y: 3.5, netLow: `net.B${i}`, netMid: `net.B${i + 1}`, netHigh: `net.B${i + 2}` }, `stage-${i}`)))] }));
}

export { Universal5SBalancer as default };