MustafaMulla29/wireless-mouse-pcb
This code defines a 3.3V low dropout voltage regulator chip (AP2112K-3.3TRG1) with five pins (VIN, GND, Enable, NC, VOUT) and its associated PCB footprint and 3D models for hardware implementation.
- Version
- 1.0.6
- License
- unset
- Stars
- 0
sections/BatteryPowerSection.tsx
import { AP2112K_3_3TRG1 } from "../imports/AP2112K_3_3TRG1";
import { S2B_PH_SM4_TB_LF__SN_ } from "../imports/S2B_PH_SM4_TB_LF__SN_";
import { SS_12D00_G3 } from "../imports/SS_12D00_G3";
import { NetTrace, POWER_TRACE, withSchematicSheet } from "./shared";
const PowerSwitch = SS_12D00_G3 as any;
export const BatteryPowerSection = () =>
withSchematicSheet(
"power",
<>
<S2B_PH_SM4_TB_LF__SN_
name="J_BAT_PROTECTED"
noConnect={["pin3", "pin4"]}
pcbX={-15}
pcbY={24}
pcbRotation={90}
schX={-27}
schY={-0.1}
schSectionName="BatteryPower"
/>
<PowerSwitch
name="SW_POWER"
type="spdt"
noConnect={["pin3"]}
pcbX={15}
pcbY={14.5}
pcbRotation={0}
schX={-22}
schY={0}
schSectionName="BatteryPower"
/>
<AP2112K_3_3TRG1
name="U_3V3"
noConnect={["NC"]}
pcbX={-14}
pcbY={14}
schX={-16}
schY={0}
schWidth={1.865}
schHeight={0.6}
schPinArrangement={{
leftSide: { pins: ["VIN", "EN", "GND"], direction: "top-to-bottom" },
rightSide: { pins: ["VOUT", "NC"], direction: "top-to-bottom" },
}}
schSectionName="BatteryPower"
/>
<capacitor
name="C_3V3_IN"
capacitance="1uF"
footprint="0603"
pcbX={-18}
pcbY={11.5}
pcbRotation={270}
schX={-19}
schY={-3}
schOrientation="vertical"
schSectionName="BatteryPower"
/>
<capacitor
name="C_3V3_OUT"
capacitance="1uF"
footprint="0603"
pcbX={-14}
pcbY={10.2}
pcbRotation={270}
schX={-13}
schY={-3}
schOrientation="vertical"
schSectionName="BatteryPower"
/>
<capacitor
name="C_3V3_BULK"
capacitance="10uF"
footprint="0805"
pcbX={-5}
pcbY={13.5}
pcbRotation={270}
schX={-10}
schY={-3}
schOrientation="vertical"
schSectionName="BatteryPower"
/>
<resistor
name="R_VBAT_TOP"
resistance="1M"
footprint="0402"
pcbX={6.5}
pcbY={15}
schX={-22}
schY={5}
schSectionName="BatteryPower"
/>
<resistor
name="R_VBAT_BOTTOM"
resistance="1M"
footprint="0402"
pcbX={8.5}
pcbY={15}
schX={-18}
schY={5}
schSectionName="BatteryPower"
/>
<capacitor
name="C_VBAT_SENSE"
capacitance="100nF"
footprint="0402"
pcbX={7.5}
pcbY={13.3}
pcbRotation={90}
schX={-15}
schY={4}
schOrientation="vertical"
schSectionName="BatteryPower"
/>
<NetTrace
from=".J_BAT_PROTECTED > .pin1"
to="net.VBAT"
width={POWER_TRACE}
/>
<NetTrace
from=".J_BAT_PROTECTED > .pin2"
to="net.GND"
width={POWER_TRACE}
/>
<NetTrace from="net.VBAT" to=".SW_POWER > .pin2" width={POWER_TRACE} />
<NetTrace from=".SW_POWER > .pin1" to="net.VSYS" width={POWER_TRACE} />
<NetTrace from=".U_3V3 > .VIN" to="net.VSYS" width={POWER_TRACE} />
<NetTrace name="VSYS_EN" from=".U_3V3 > .EN" to=".U_3V3 > .VIN" />
<NetTrace from=".U_3V3 > .GND" to="net.GND" width={POWER_TRACE} />
<NetTrace from=".U_3V3 > .VOUT" to="net.V3V3" width={POWER_TRACE} />
<NetTrace from=".C_3V3_IN > .pin1" to="net.VSYS" width={POWER_TRACE} />
<NetTrace from=".C_3V3_IN > .pin2" to="net.GND" width={POWER_TRACE} />
<NetTrace from=".C_3V3_OUT > .pin1" to="net.V3V3" width={POWER_TRACE} />
<NetTrace from=".C_3V3_OUT > .pin2" to="net.GND" width={POWER_TRACE} />
<NetTrace from=".C_3V3_BULK > .pin1" to="net.V3V3" width={POWER_TRACE} />
<NetTrace from=".C_3V3_BULK > .pin2" to="net.GND" width={POWER_TRACE} />
{/* Sense the switched battery rail so an off MCU is not back-powered through its ADC. */}
<NetTrace from="net.VSYS" to=".R_VBAT_TOP > .pin1" />
<NetTrace from=".R_VBAT_TOP > .pin2" to="net.VBAT_ADC" />
<NetTrace from=".R_VBAT_BOTTOM > .pin1" to="net.VBAT_ADC" />
<NetTrace from=".R_VBAT_BOTTOM > .pin2" to="net.GND" />
<NetTrace from=".C_VBAT_SENSE > .pin1" to="net.VBAT_ADC" />
<NetTrace from=".C_VBAT_SENSE > .pin2" to="net.GND" />
</>,
18.5,
-5.7,
);