seveibar/led-water-accelerometer

This is an LED matrix with an accelerometer and a PICO. When you tilt the PCB, the LEDs dim and change color to simulate water flowing.

Version
1.0.18
License
unset
Stars
7

dist/index.js

PCBPCB preview for dist/index.js
SchematicSchematic preview for dist/index.js
import { jsx, jsxs } from 'react/jsx-runtime';
import { WS2812B_2020 } from '@tsci/seveibar.WS2812B_2020';
import { PICO } from '@tsci/seveibar.PICO';
import { grid } from '@tscircuit/math-utils';
import { sel } from '@tscircuit/core';

const pinLabels = {
    pin1: ["VDDIO"],
    pin2: ["NC1"],
    pin3: ["NC2"],
    pin4: ["SPC"],
    pin5: ["GND1"],
    pin6: ["SDI"],
    pin7: ["SDO"],
    pin8: ["CS"],
    pin9: ["INT2"],
    pin10: ["RES"],
    pin11: ["INT1"],
    pin12: ["GND2"],
    pin13: ["ADC3"],
    pin14: ["VDD"],
    pin15: ["ADC2"],
    pin16: ["ADC1"]
};
const LIS3DHTR = (props) => {
    return (jsx("chip", Object.assign({ pinLabels: pinLabels, supplierPartNumbers: {
            "jlcpcb": [
                "C15134"
            ]
        }, manufacturerPartNumber: "LIS3DHTR", footprint: jsxs("footprint", { children: [jsx("smtpad", { portHints: ["pin1"], pcbX: "-1.4000479999999982mm", pcbY: "1.0001249999999828mm", width: "0.7999983999999999mm", height: "0.2800096mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin2"], pcbX: "-1.4000479999999982mm", pcbY: "0.4999989999999883mm", width: "0.7999983999999999mm", height: "0.2800096mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin3"], pcbX: "-1.4000479999999982mm", pcbY: "0.00012699999999199463mm", width: "0.7999983999999999mm", height: "0.2800096mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin4"], pcbX: "-1.4000479999999982mm", pcbY: "-0.4999990000000025mm", width: "0.7999983999999999mm", height: "0.2800096mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin5"], pcbX: "-1.4000479999999982mm", pcbY: "-0.999871000000013mm", width: "0.7999983999999999mm", height: "0.2800096mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin6"], pcbX: "-0.49987200000001053mm", pcbY: "-1.3999210000000062mm", width: "0.2800096mm", height: "0.7999983999999999mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin7"], pcbX: "0mm", pcbY: "-1.3999210000000062mm", width: "0.2800096mm", height: "0.7999983999999999mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin8"], pcbX: "0.5001259999999803mm", pcbY: "-1.3999210000000062mm", width: "0.2800096mm", height: "0.7999983999999999mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin9"], pcbX: "1.4000479999999982mm", pcbY: "-0.999871000000013mm", width: "0.7999983999999999mm", height: "0.2800096mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin10"], pcbX: "1.4000479999999982mm", pcbY: "-0.4999990000000025mm", width: "0.7999983999999999mm", height: "0.2800096mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin11"], pcbX: "1.4000479999999982mm", pcbY: "0.00012699999999199463mm", width: "0.7999983999999999mm", height: "0.2800096mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin12"], pcbX: "1.4000479999999982mm", pcbY: "0.4999989999999883mm", width: "0.7999983999999999mm", height: "0.2800096mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin13"], pcbX: "1.4000479999999982mm", pcbY: "1.0001249999999828mm", width: "0.7999983999999999mm", height: "0.2800096mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin14"], pcbX: "0.5001259999999803mm", pcbY: "1.3999210000000062mm", width: "0.2800096mm", height: "0.7999983999999999mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin15"], pcbX: "0mm", pcbY: "1.3999210000000062mm", width: "0.2800096mm", height: "0.7999983999999999mm", shape: "rect" }), jsx("smtpad", { portHints: ["pin16"], pcbX: "-0.49987200000001053mm", pcbY: "1.3999210000000062mm", width: "0.2800096mm", height: "0.7999983999999999mm", shape: "rect" }), jsx("silkscreenpath", { route: [{ "x": -1.724888600000014, "y": 1.450111399999983 }, { "x": -1.724888600000014, "y": 1.7251171999999855 }, { "x": -1.0248899999999992, "y": 1.7251171999999855 }] }), jsx("silkscreenpath", { route: [{ "x": 1.0250932000000006, "y": 1.7251171999999855 }, { "x": 1.7251171999999855, "y": 1.7251171999999855 }, { "x": 1.7251171999999855, "y": 1.450111399999983 }] }), jsx("silkscreenpath", { route: [{ "x": -1.724888600000014, "y": -1.449882800000026 }, { "x": -1.724888600000014, "y": -1.7248886000000283 }, { "x": -1.0248899999999992, "y": -1.7248886000000283 }] }), jsx("silkscreenpath", { route: [{ "x": 1.0250932000000006, "y": -1.7248886000000283 }, { "x": 1.7251171999999855, "y": -1.7248886000000283 }, { "x": 1.7251171999999855, "y": -1.449882800000026 }] }), jsx("silkscreenpath", { route: [{ "x": -2.049678400000005, "y": 1.574926999999974 }, { "x": -1.9240564439124341, "y": 1.698648786962778 }, { "x": -1.799698052107189, "y": 1.573656999999983 }, { "x": -1.9240564439124341, "y": 1.4486652130371738 }, { "x": -2.049678400000005, "y": 1.5723869999999778 }] })] }), cadModel: {
            objUrl: "https://modelcdn.tscircuit.com/easyeda_models/download?uuid=c4b5277f94624e3ba038828676140c3b&pn=C15134",
            rotationOffset: { x: 0, y: 0, z: 0 },
            positionOffset: { x: 0, y: 0, z: 0 },
        } }, props)));
};

/**
 * Updated board description that fixes the power‑/ground‑/data‑line issues
 * highlighted in the design review:
 *   • Single common GND net
 *   • Sensor powered from Pico 3V3_OUT (and VDDIO tied as well)
 *   • Series 330 Ω resistor on the LED data line
 *   • Bulk and local decoupling capacitors for the LED string
 */
var index = () => (jsxs("board", { width: 142, height: 130, children: [grid({
            cols: 8,
            rows: 6,
            xSpacing: 32,
            ySpacing: 30,
            offsetX: 0,
            offsetY: 36,
        }).map(({ center, index, row, col }) => {
            /* zero‑based index → user‑facing 1‑based name */
            const ledNum = index + 1;
            const ledName = `LED${ledNum}`;
            const prevLedName = ledNum > 1 ? `LED${ledNum - 1}` : null;
            return (jsxs("group", { pcbX: center.x / 2, pcbY: center.y / 2, schX: col * 3.5 - 24, schY: row * 2, children: [jsx(WS2812B_2020, { name: ledName }), jsx("trace", { from: `.${ledName} .GND`, to: "net.GND" }), jsx("trace", { from: `.${ledName} .VDD`, to: "net.V5" }), prevLedName && (jsx("trace", { from: `.${prevLedName} .DO`, to: `.${ledName} .DI` }))] }, ledName));
        }), jsx(PICO, { name: "U1", pcbY: -45, pcbX: -44, schX: -25, schY: -6, schWidth: 4, showPinAliases: true }), jsx(LIS3DHTR, { name: "U2", schX: -20, schY: -6, pcbY: -48, pcbX: 34 }), jsx("capacitor", { name: "C2", footprint: "1206", capacitance: "100uF", pcbX: -5, pcbY: -50, schX: -32, schY: -10 }), jsx("trace", { from: sel.C2.pin1, to: "net.V5" }), jsx("trace", { from: sel.C2.pin2, to: "net.GND" }), jsx("capacitor", { name: "C1", footprint: "0402", capacitance: "100nF", schX: -20, schY: -4, schRotation: 180, pcbX: 20, pcbY: -45 }), jsx("trace", { from: sel.C1.pin1, to: sel.U1["3V3_OUT"] }), jsx("trace", { from: sel.C1.pin2, to: "net.GND" }), jsx("resistor", { name: "R1", footprint: "0603", resistance: "330", schX: -10, schY: -3, pcbX: 30, pcbY: -40 }), jsx("trace", { from: sel.U1.GP6, to: sel.R1.pin1 }), jsx("trace", { from: sel.R1.pin2, to: sel.LED1.DI }), jsx("trace", { from: sel.U1["3V3_OUT"], to: sel.U2.VDD }), jsx("trace", { from: sel.U1["3V3_OUT"], to: sel.U2.VDDIO }), jsx("trace", { from: sel.U1["VBUS"], to: "net.V5" }), jsx("hole", { pcbX: -65, pcbY: 60, radius: 3 }), jsx("hole", { pcbX: 65, pcbY: 60, radius: 3 }), jsx("hole", { pcbX: 65, pcbY: -54, radius: 3 }), [
            sel.U1(PICO).GND1,
            sel.U1(PICO).GND2,
            sel.U1(PICO).GND3,
            sel.U1(PICO).GND4,
            sel.U1(PICO).GND5,
            sel.U2(LIS3DHTR).GND1,
            sel.U2(LIS3DHTR).GND2,
        ].map((pin, i) => (jsx("trace", { from: pin, to: "net.GND" }, `g${i}`))), jsx("trace", { from: sel.U1.GP10, to: sel.U2.SPC }), jsx("trace", { from: sel.U1.GP11, to: sel.U2.SDI }), jsx("trace", { from: sel.U1.GP12, to: sel.U2.SDO }), jsx("trace", { from: sel.U1.GP17, to: sel.U2.CS }), jsxs("group", { pcbY: -59, children: [jsx("silkscreentext", { text: "Routed with the tscircuit autorouter", pcbX: 70, pcbY: 0, fontSize: 2, anchorAlignment: "bottom_right" }), jsx("silkscreentext", { text: "MIT Open Source", pcbX: 70, pcbY: -2, fontSize: 2, anchorAlignment: "bottom_right" }), jsx("silkscreentext", { text: "tscircuit.com/seveibar/led-water-accelerometer", pcbX: 70, pcbY: -4, fontSize: 2, anchorAlignment: "bottom_right" })] })] }));

export { index as default };