mohan-bee/speaker

This code defines configurable 3D models and PCB footprints for various electronic components, including a battery charger IC, a dual Hall sensor, a dual power switch, and a voltage regulator, with detailed pinouts, footprints, and CAD models for schematic and physical design.

Version
0.0.2
License
unset
Stars
0

index.tsx

PCBPCB preview for index.tsx
SchematicSchematic preview for index.tsx
import manualEdits from "./manual-edits.json";

import { ESP32_WROOM_32E_N4 as ESP32 } from "./imports/c701341";
import { TP4056 as ChargerIC } from "./imports/c725790";
import { TYPE_C_31_M_12 as UsbCPort } from "./imports/c165948";
import { DW01 as ProtectionIC } from "./imports/c686633";
import { A_8205A as DualMosfet } from "./imports/c2762931";
import { XC6206P332MR_G as Regulator_3V3 } from "./imports/c5446";



const Battery18650 = ({ name, pcbX, pcbY, rotation }) => ( 
  <chip
    name={name}
    pcbX={pcbX}
    pcbY={pcbY}
    rotation={rotation}
    pinLabels={{ pin1: ["pos"], pin2: ["neg"] }}
    footprint={
      <footprint>
        <smtpad portHints={["pin1"]} pcbX={0} pcbY={31} width="5mm" height="5mm" shape="rect" />
        <smtpad portHints={["pin2"]} pcbX={0} pcbY={-31} width="5mm" height="5mm" shape="rect" />
        <silkscreentext text="BATT+" pcbX={0} pcbY={26} fontSize="1mm" />
        <silkscreentext text="BATT-" pcbX={0} pcbY={-26} fontSize="1mm" /> 
      </footprint>
    }
  />
);
const AudioAmp_MAX98357A = ({ name, pcbX, pcbY, rotation }) => (
  <chip
    name={name} 
    pcbX={pcbX}
    pcbY={pcbY}
    rotation={rotation}
    footprint="qfn16_3x3_0.5mm" 
    pinLabels={{
      pin1: ["DIN"], pin2: ["BCLK"], pin3: ["LRCLK"], pin4: ["GND"],
      pin7: ["OUT_P"], pin8: ["OUT_N"], pin9: ["VDD"], pin10: ["SD_MODE"]
    }}
    cadModel={null}
  />
);
export default () => {
  return (
    <board width="60mm" borderRadius="10mm" height="70mm" manualEdits={manualEdits}>
      
      <UsbCPort name="USBC" pcbX={0} pcbY={-26} rotation={0} />
      <ESP32 name="MCU" pcbX={0} pcbY={15} rotation={0} />
      <silkscreentext text="மோகன் SPEAKER" fontSize="5mm" pcbX={-25} pcbY={2} pcbRotation={90} />
      <Battery18650 name="Onboard_Battery" pcbX={-15} pcbY={0} rotation={0} /> 
      <pinheader name="Speaker_L" pinCount={2} rotation={-90} />
      
      <AudioAmp_MAX98357A name="AudioAmp" pcbX={15} pcbY={2} rotation={0} />
      <ChargerIC name="Charger" pcbX={-8} pcbY={-14} />
      <ProtectionIC name="Protect_IC" pcbX={10} pcbY={-24} />
      <DualMosfet name="Mosfet" pcbX={18} pcbY={-24} />
      <Regulator_3V3 name="LDO_3V3" pcbX={16} pcbY={-14} />
      <net 
        name="power" 
        nets={["BATT+", "BATT-", "VBUS", "VCHG"]} 
        trace_width="0.2mm" 
      />
      <net 
        name="signal" 
        nets={["*"]}  
        trace_width="0.2mm" 
      />
      <hole name="Mount1" pcbX={-24} pcbY={28} diameter="3.2mm" />
      <hole name="Mount2" pcbX={24} pcbY={28} diameter="3.2mm" />
      <hole name="Mount3" pcbX={-24} pcbY={-28} diameter="3.2mm" />
      <hole name="Mount4" pcbX={24} pcbY={-28} diameter="3.2mm" />
      
      <trace from=".USBC > .B4A9" to=".Charger > .VCC" thickness="1mm" />
      <trace from=".USBC > .A1B12" to=".Charger > .GND" thickness="1mm" />
      

      <trace from=".Onboard_Battery > .pin1" to=".Charger > .BAT" thickness="1mm" />
      <trace from=".Charger > .BAT" to=".Protect_IC > .VCC" thickness="1mm" />
      <trace from=".Onboard_Battery > .pin2" to=".Protect_IC > .GND" thickness="1mm" />
      

      <trace from=".Mosfet > .D1" to=".LDO_3V3 > .Vin" thickness="1mm" />
      <trace from=".Mosfet > .D1" to=".AudioAmp > .VDD" thickness="1mm" />
      <trace from=".LDO_3V3 > .Vout" to=".MCU > .3V3" thickness="1mm" />
      

      <trace from=".AudioAmp > .OUT_P" to=".Speaker_L > .pin1" thickness="1mm" />
      <trace from=".AudioAmp > .OUT_N" to=".Speaker_L > .pin2" thickness="1mm" />
      
      <trace from=".Charger > .GND" to=".MCU > .GND1" thickness="1mm" />
      <trace from=".LDO_3V3 > .GND" to=".MCU > .GND2" thickness="1mm" />
      <trace from=".MCU > .GND2" to=".AudioAmp > .GND" thickness="1mm" />
      
    </board>
  );
};