mohan-bee/home-v1

This hardware design incorporates a solar charge controller with fused input lines, Schottky and TVS protection diodes, MOSFET switches for energy routing, a temperature sensor, and status LEDs for PV, battery, and load indicators.

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 mohan-bee/home-v1  # download the package files into ./home-v1
tsci add mohan-bee/home-v1    # add it to your project as @tsci/mohan-bee.home-v1

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.

index.tsx

PCBPCB preview for index.tsx
SchematicSchematic preview for index.tsx
const controllerPinLabels = {
  pin1: "VIN",
  pin2: "LIGHT_IN",
  pin3: "FAN_IN",
  pin4: "GND",
  pin5: "LIGHT_GATE",
  pin6: "FAN_GATE",
  pin7: "NC",
  pin8: "ENABLE",
} as const

type ChannelProps = {
  controllerInputPort: string
  controllerGatePort: string
  switchName: string
  pullDownName: string
  statusResistorName: string
  statusLedName: string
  switchX: number
  switchY: number
  ledX: number
  ledY: number
}

const InputChannel = ({
  switchName,
  pullDownName,
  statusResistorName,
  statusLedName,
  controllerInputPort,
  controllerGatePort,
  switchX,
  switchY,
  ledX,
  ledY,
}: ChannelProps) => (
  <>
    <pushbutton
      name={switchName}
      footprint="pushbutton_id1.3mm_od2mm"
      pcbRotation="90deg"
      pcbX={switchX}
      pcbY={switchY}
      connections={{
        pin1: `.U1 > .${controllerInputPort}`,
        pin2: "net.VBUS",
        pin3: `.U1 > .${controllerInputPort}`,
        pin4: "net.VBUS",
      }}
    />
    <resistor
      name={pullDownName}
      resistance="100k"
      footprint="0402"
      pcbX={switchX}
      pcbY={18}
      connections={{ pin1: `.U1 > .${controllerInputPort}`, pin2: "net.GND" }}
    />
    <resistor
      name={statusResistorName}
      resistance="1k"
      footprint="0402"
      pcbX={ledX - 4}
      pcbY={0}
      connections={{
        pin1: `.U1 > .${controllerGatePort}`,
        pin2: `.${statusLedName} > .pos`,
      }}
    />
    <led
      name={statusLedName}
      color="red"
      footprint="0402"
      pcbX={ledX}
      pcbY={ledY}
      connections={{ pos: `.${statusResistorName} > .pin2`, neg: "net.GND" }}
    />
  </>
)

const HomeController = ({ name }: { name: string }) => (
  <chip
    name={name}
    footprint="soic8"
    pinLabels={controllerPinLabels}
    pcbX={0}
    pcbY={0}
  />
)

export default function LevelOneHomeAutomationBoard() {
  return (
    <board width="60mm" height="60mm" schAutoLayoutEnabled>
      {/* Self-contained level-one automation controller built from primitives only */}
      <voltagesource name="VIN" voltage="5V" />

      <capacitor
        name="C1"
        capacitance="10uF"
        footprint="0402"
        pcbX={-14}
        pcbY={-22}
      />
      <capacitor
        name="C2"
        capacitance="100nF"
        footprint="0402"
        pcbX={14}
        pcbY={-22}
      />

      <HomeController name="U1" />

      <InputChannel
        controllerInputPort="LIGHT_IN"
        controllerGatePort="LIGHT_GATE"
        switchName="SW_LIGHT"
        pullDownName="R_LIGHT_PULLDOWN"
        statusResistorName="R_LIGHT_STATUS"
        statusLedName="LED_LIGHT"
        switchX={-18}
        switchY={14}
        ledX={-24}
        ledY={2}
      />

      <InputChannel
        controllerInputPort="FAN_IN"
        controllerGatePort="FAN_GATE"
        switchName="SW_FAN"
        pullDownName="R_FAN_PULLDOWN"
        statusResistorName="R_FAN_STATUS"
        statusLedName="LED_FAN"
        switchX={2}
        switchY={14}
        ledX={22}
        ledY={2}
      />

      <trace from=".U1 > .VIN" to="net.VBUS" />
      <trace from=".U1 > .GND" to="net.GND" />
      <trace from=".U1 > .ENABLE" to="net.VBUS" />
      <trace from=".C1 > .pin1" to="net.VBUS" />
      <trace from=".C1 > .pin2" to="net.GND" />
      <trace from=".C2 > .pin1" to="net.VBUS" />
      <trace from=".C2 > .pin2" to="net.GND" />
    </board>
  )
}