muse/book-reading-clip-lamp

A 60‑mm ESP32‑S3 lamp-head PCB combining USB‑C battery charging/power regulation, OV5640 autofocus camera interfacing, I²S microphone and differential speaker audio, six‑LED boost-driven reading light, buttons, status indicators, and battery monitoring.

Version
0.2.5
License
unset
Stars
0

power-parts.tsx

SchematicSchematic preview for power-parts.tsx
import { BQ24074RGTR as CatalogBQ24074 } from "./imports/BQ24074RGTR"
import { TPS63021DSJR as CatalogTPS63021 } from "./imports/TPS63021DSJR"
import { TPS61165DBVR as CatalogTPS61165 } from "./imports/TPS61165DBVR"
import { A_2N7002_215 as CatalogVbusFet } from "./imports/A_2N7002_215"
import type { ChipProps, InductorProps } from "@tscircuit/props"

/**
 * Power ICs use the exact JLCSearch imports below; inductors and switch retain manufacturer-defined footprints. Dimensions in millimetres.
 * Sources downloaded 2026-10-04 into ../power-parts-import/ for review:
 * - TI BQ24074 SLUS810N, current RGT0016C land pattern, p53.
 * - TI TPS63021 SLVS916I, DSJ 4210895-2/E land pattern, p33.
 * - TI TPS61165 SLVS790E, DBV0006A land pattern, p29.
 * - Coilcraft XFL4020 document 745-3, revised 03/10/26.
 * https://www.ti.com/lit/ds/symlink/bq24074.pdf
 * https://www.ti.com/lit/ds/symlink/tps63021.pdf
 * https://www.ti.com/lit/ds/symlink/tps61165.pdf
 * https://www.coilcraft.com/getmedia/50632d43-da1b-4cdb-8ab4-3029cab51df3/xfl4020.pdf
 * https://www.coilcraft.com/getmedia/11b17d19-33b4-4b4c-8f03-09560f682bf1/lps5030.pdf
 * Copper defined here; assembly shop must review stencil apertures and thermal vias.
 */

export const BQ24074Pins = {
  pin1: ["TS"], pin2: ["BAT1"], pin3: ["BAT2"], pin4: ["N_CE"],
  pin5: ["EN2"], pin6: ["EN1"], pin7: ["N_PGOOD"], pin8: ["VSS"],
  pin9: ["N_CHG"], pin10: ["OUT1"], pin11: ["OUT2"], pin12: ["ILIM"],
  pin13: ["IN"], pin14: ["TMR"], pin15: ["ITERM"], pin16: ["ISET"],
  pin17: ["EP"],
} as const

// Exact JLCSearch/EasyEDA C54313 land pattern; datasheet pin names retained.
export function BQ24074RGTR(props: ChipProps<typeof BQ24074Pins>) {
 return <CatalogBQ24074 {...props as any} pinLabels={BQ24074Pins as any}
  pinAttributes={{pin8:{requiresGround:true},pin17:{requiresGround:true},pin13:{requiresPower:true}}}/>
}

export const TPS63021Pins = {
  pin1: ["VINA"], pin2: ["GND"], pin3: ["FB"], pin4: ["VOUT1"],
  pin5: ["VOUT2"], pin6: ["L2A"], pin7: ["L2B"], pin8: ["L1A"],
  pin9: ["L1B"], pin10: ["VIN1"], pin11: ["VIN2"], pin12: ["EN"],
  pin13: ["PS_SYNC"], pin14: ["PG"], pin15: ["PGND", "EP"],
} as const

// C202140 preserves the exact comb-shaped thermal land. Board rotation 270°
// aligns the imported horizontal package with this board's previous placement.
export function TPS63021DSJR(props: ChipProps<typeof TPS63021Pins>) {
 return <CatalogTPS63021 {...props as any} pinLabels={TPS63021Pins as any}
  pinAttributes={{pin1:{requiresPower:true},pin2:{requiresGround:true},pin10:{requiresPower:true},pin11:{requiresPower:true},pin15:{requiresGround:true}}}/>
}

export const TPS61165Pins = {
  pin1: ["VIN"], pin2: ["CTRL"], pin3: ["SW"],
  pin4: ["GND"], pin5: ["COMP"], pin6: ["FB"],
} as const

export function TPS61165DBVR(props: ChipProps<typeof TPS61165Pins>) {
 return <CatalogTPS61165 {...props as any} pinLabels={TPS61165Pins as any}/>
}

export function XFL4020_152MEC(props: Omit<InductorProps, "inductance"> & { inductance?: InductorProps["inductance"] }) {
  return <inductor
    inductance="1.5uH"
    maxCurrentRating="4.1A"
    manufacturerPartNumber="XFL4020-152MEC"
    footprint={<footprint>
      <smtpad shape="rect" portHints={["pin1"]} pcbX={-1.185} pcbY={0} width={0.98} height={3.4} />
      <smtpad shape="rect" portHints={["pin2"]} pcbX={1.185} pcbY={0} width={0.98} height={3.4} />
      <silkscreenrect width={4.3} height={4.3} />
      <courtyardrect width={4.8} height={4.8} />
    </footprint>}
    {...props}
  />
}

// Coilcraft LPS5030 document 581-2 (2024-05-28), recommended C-shaped lands.
// 10uH: Isat 1.4A (10% drop), Irms 1A (20°C rise), 1.5A (40°C rise).
// The older LPS4018-103ML reaches 1.3A only at 30% inductance drop.
const lps5030LeftLand = [
  {x:-0.76,y:2.755},{x:-1.7,y:2.755},{x:-2.755,y:1.7},
  {x:-2.755,y:-1.7},{x:-1.7,y:-2.755},{x:-0.76,y:-2.755},
  {x:-0.76,y:-1.7},{x:-1.7,y:-0.8445},{x:-1.7,y:0.8445},{x:-0.76,y:1.7},
]

export function LPS5030_103MRC(props: Omit<InductorProps, "inductance"> & { inductance?: InductorProps["inductance"] }) {
  return <inductor
    inductance="10uH"
    maxCurrentRating="1A"
    manufacturerPartNumber="LPS5030-103MRC"
    footprint={<footprint>
      <smtpad shape="polygon" portHints={["pin1"]} points={lps5030LeftLand} />
      <smtpad shape="polygon" portHints={["pin2"]} points={lps5030LeftLand.map(({x,y})=>({x:-x,y})).reverse()} />
      <silkscreenpath route={[{x:-0.6,y:2.6},{x:0.6,y:2.6}]} />
      <silkscreenpath route={[{x:-0.6,y:-2.6},{x:0.6,y:-2.6}]} />
      <courtyardrect width={6.01} height={6.01} />
    </footprint>}
    {...props}
  />
}

// Concise application-facing names; numbered pins remain authoritative.
export const BQ24074 = BQ24074RGTR
export const TPS63021 = TPS63021DSJR
export const TPS61165 = TPS61165DBVR
export const PowerInductor = XFL4020_152MEC
export const LedInductor = LPS5030_103MRC

/** C&K JS102011SAQN: manufacturer PCB layout, current JS series p4.
 * Three 1.2×2.5 mm lands at 2.5 mm pitch; two Ø0.9 locating holes
 * 6.8 mm apart, 4.0 mm from pad top (2.75 mm from pad centre).
 * Pin 2 is common. Non-shorting SPDT, so switching SYS/GND is permitted.
 * Lever exits toward -Y at rotation 0; rotation 270 points it toward -X.
 * https://www.littelfuse.com/assetdocs/littelfuse-c-k-slide-js-series-datasheet?assetguid=aba42b08-0d2c-423b-813d-a2faa5a3bb14
 * Manufacturer drawing copy: ../power-parts-import/js-series.pdf p4.
 */
export const PowerSwitchPins = {pin1:["THROW1"],pin2:["COMMON"],pin3:["THROW2"]} as const
// The builtin SPDT symbol places common on pin1; this physical switch uses pin2.
// A labelled box deliberately preserves the exact manufacturer numbering.
export function PowerSwitch(props: ChipProps<typeof PowerSwitchPins>) {
  return <chip manufacturerPartNumber="JS102011SAQN"
    supplierPartNumbers={{jlcpcb:["C221660"]}}
    pinLabels={PowerSwitchPins}
    footprint={<footprint insertionDirection="from_above" cutoutApertureDirection="from_bottom">
      {[-2.5,0,2.5].map((x,i)=><smtpad shape="rect" portHints={[`pin${i+1}`]} pcbX={x} pcbY={0} width={1.2} height={2.5}/>)}
      <hole pcbX={-3.4} pcbY={-2.75} diameter={0.9}/>
      <hole pcbX={3.4} pcbY={-2.75} diameter={0.9}/>
      <silkscreenpath route={[{x:-4.5,y:1.1},{x:-4.5,y:-2.5},{x:4.5,y:-2.5},{x:4.5,y:1.1}]}/>
      <silkscreenpath route={[{x:-1.75,y:-2.5},{x:-1.75,y:-4.5},{x:1.75,y:-4.5},{x:1.75,y:-2.5}]}/>
      <courtyardrect pcbY={-1.625} width={9.5} height={6.25}/>
    </footprint>} {...props}/>
}

export const VbusDetectorFetPins = {pin1:["GATE"],pin2:["SOURCE"],pin3:["DRAIN"]} as const
/** Nexperia 2N7002 SOT23, table 2: 1=gate, 2=source, 3=drain.
 * https://assets.nexperia.com/documents/data-sheet/2N7002.pdf
 * A chip wrapper preserves the manufacturer's numbering explicitly.
 */
export function VbusDetectorFet(props: ChipProps<typeof VbusDetectorFetPins>) {
 return <CatalogVbusFet {...props as any} symbol={undefined} pinLabels={VbusDetectorFetPins as any}
  pinAttributes={{pin2:{requiresGround:true}}}/>
}