aj0070/lora-node

Battery-powered ESP32-S3 LoRa environmental sensor board with USB-C charging, 3.3 V regulation, BME280 I²C sensing, SX1262 LoRa radio and U.FL antenna connector.

Version
1.0.0
License
unset
Stars
0

Use with the tscircuit CLI

tsci is the tscircuit CLI. Install it with npm install -g tscircuit.

tsci clone aj0070/lora-node  # download the package files into ./lora-node
tsci add aj0070/lora-node    # add it to your project as @tsci/aj0070.lora-node

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.circuit.tsx

PCBPCB preview for index.circuit.tsx
SchematicSchematic preview for index.circuit.tsx
import type { ChipProps } from "tscircuit"
import { ESP32_S3_MINI_1_N8 } from "./imports/ESP32_S3_MINI_1_N8"
import { BME280 as BME280Part } from "./imports/BME280"
import { SX1261IMLTRT } from "./imports/SX1261IMLTRT"
import { MCP73831_2DCI_MC } from "./imports/MCP73831_2DCI_MC"
import { UA78M33CDCYR } from "./imports/UA78M33CDCYR"
import { TYPE_C16PIN } from "./imports/TYPE_C16PIN"
import { JST_PH_2P } from "./imports/JST_PH_2P"

const uflPinLabels = {
  pin1: "SIG",
  pin2: "GND1",
  pin3: "GND2",
  pin4: "GND3",
} as const

const UFL = (props: ChipProps<typeof uflPinLabels>) => (
  <chip
    pinLabels={uflPinLabels}
    manufacturerPartNumber="HC-RF-IPEX0303-01"
    supplierPartNumbers={{ jlcpcb: ["C2894919"] }}
    footprint={
      <footprint insertionDirection="from_above">
        <smtpad portHints={["pin2"]} pcbX="1.474978mm" pcbY="0mm" width="1.0500106mm" height="2.1999956mm" shape="rect" />
        <smtpad portHints={["pin3"]} pcbX="-1.474978mm" pcbY="0mm" width="1.0500106mm" height="2.1999956mm" shape="rect" />
        <smtpad portHints={["pin1"]} pcbX="0mm" pcbY="-1.49987mm" width="0.999998mm" height="1.0500106mm" shape="rect" />
        <smtpad portHints={["pin4"]} pcbX="0mm" pcbY="1.49987mm" width="0.999998mm" height="1.0500106mm" shape="rect" />
        <courtyardrect width="4.5mm" height="4.55mm" />
      </footprint>
    }
    {...props}
  />
)

const espNoConnect = Array.from({ length: 30 }, (_, i) => `pin${i + 31}`)

export default () => (
  <board
    width="50mm"
    height="30mm"
    layers={2}
    defaultTraceWidth="0.2mm"
    minTraceWidth="0.15mm"
  >
    <net name="GND" isGroundNet nominalTraceWidth={0.3} />
    <net name="VBUS" isPowerNet nominalTraceWidth={0.5} />
    <net name="VBAT" isPowerNet nominalTraceWidth={0.5} />
    <net name="V3_3" isPowerNet nominalTraceWidth={0.4} />
    <net name="RF_MID" nominalTraceWidth={0.5} />
    <net name="RF_ANT" nominalTraceWidth={0.5} />

    {/* power entry and charge path */}
    <TYPE_C16PIN
      name="J1"
      pcbX={-19.47}
      pcbY={-9.4}
      pcbRotation={270}
      noConnect={["DP1", "DP2", "DN1", "DN2", "SBU1", "SBU2"]}
      connections={{
        VBUS1: "net.VBUS",
        VBUS2: "net.VBUS",
        GND1: "net.GND",
        GND2: "net.GND",
        SHELL1: "net.GND",
        SHELL2: "net.GND",
        SHELL3: "net.GND",
        SHELL4: "net.GND",
      }}
    />
    <MCP73831_2DCI_MC
      name="U3"
      pcbX={-21.5}
      pcbY={-2.0}
      noConnect={["NC", "STAT"]}
      connections={{
        VDD1: "net.VBUS",
        VDD2: "net.VBUS",
        VBAT1: "net.VBAT",
        VBAT2: "net.VBAT",
        VSS: "net.GND",
        EP: "net.GND",
      }}
    />
    <resistor name="R1" resistance="2k" footprint="0402" pcbX={-24.2} pcbY={-0.8} pcbRotation={90} />
    <capacitor name="C11" capacitance="4.7uF" footprint="0805" pcbX={-17.4} pcbY={-2.4} pcbRotation={90} connections={{ pin1: "net.VBUS", pin2: "net.GND" }} />
    <JST_PH_2P
      name="J2"
      pcbX={21.5}
      pcbY={8.4}
      connections={{ pin1: "net.VBAT", pin2: "net.GND" }}
    />

    <capacitor name="C12" capacitance="1uF" footprint="0603" pcbX={-16.3} pcbY={1.2} pcbRotation={90} connections={{ pin1: "net.VBAT", pin2: "net.GND" }} />
    <capacitor name="C13" capacitance="1uF" footprint="0603" pcbX={-16.3} pcbY={4.4} pcbRotation={90} connections={{ pin1: "net.VBAT", pin2: "net.GND" }} />

    {/* mcu */}
    <ESP32_S3_MINI_1_N8
      name="U1"
      pcbX={-7.6}
      pcbY={0}
      noConnect={espNoConnect}
      pinAttributes={{ "3V3": { requiresPower: true } }}
      connections={{
        GND1: "net.GND",
        GND2: "net.GND",
        GND3: "net.GND",
        GND4: "net.GND",
        GND5: "net.GND",
        GND6: "net.GND",
        GND7: "net.GND",
        GND8: "net.GND",
        GND9: "net.GND",
        GND10: "net.GND",
        GND11: "net.GND",
        GND12: "net.GND",
        GND13: "net.GND",
        GND14: "net.GND",
        GND15: "net.GND",
        "3V3": "net.V3_3",
      }}
    />

    {/* regulator in the top strip */}
    <UA78M33CDCYR
      name="U4"
      pcbX={6.5}
      pcbY={11.2}
      pinAttributes={{
        IN: { requiresPower: true },
        COM: { mustBeConnected: true },
        OUT: { providesPower: true },
      }}
      connections={{
        IN: "net.VBAT",
        COM: "net.GND",
        OUT: "net.V3_3",
        EP: "net.V3_3",
      }}
    />
    <capacitor name="C14" capacitance="10uF" footprint="0805" pcbX={-16.3} pcbY={7.8} pcbRotation={90} connections={{ pin1: "net.V3_3", pin2: "net.GND" }} />
    <capacitor name="C15" capacitance="100nF" footprint="0402" pcbX={-16.3} pcbY={10.6} pcbRotation={90} connections={{ pin1: "net.V3_3", pin2: "net.GND" }} />
    <capacitor name="C8" capacitance="100nF" footprint="0402" pcbX={-16.3} pcbY={12.7} pcbRotation={90} connections={{ pin1: "net.V3_3", pin2: "net.GND" }} />
    <capacitor name="C9" capacitance="1uF" footprint="0603" pcbX={-2.0} pcbY={9.0} connections={{ pin1: "net.V3_3", pin2: "net.GND" }} />
    <capacitor name="C10" capacitance="10uF" footprint="0805" pcbX={-7.0} pcbY={9.5} connections={{ pin1: "net.V3_3", pin2: "net.GND" }} />
    <resistor name="R2" resistance="5.1k" footprint="0402" pcbX={-4.05} pcbY={11.0} />
    <resistor name="R3" resistance="5.1k" footprint="0402" pcbX={-6.06} pcbY={11.0} />

    {/* lora transceiver, SX1262 pin compatible QFN-24 */}
    <SX1261IMLTRT
      name="U2"
      manufacturerPartNumber="SX1262IMLTRT"
      pcbX={12.0}
      pcbY={3.0}
      pcbRotation={180}
      noConnect={["DIO2", "DIO3"]}
      pinAttributes={{
        VDD_IN: { requiresPower: true },
        VBAT: { requiresPower: true },
        VBAT_IO: { requiresPower: true },
        NRESET: { mustBeConnected: true },
        BUSY: { mustBeConnected: true },
      }}
      connections={{
        GND1: "net.GND",
        GND2: "net.GND",
        GND3: "net.GND",
        GND4: "net.GND",
        GND5: "net.GND",
        VDD_IN: "net.V3_3",
        VBAT: "net.V3_3",
        VBAT_IO: "net.V3_3",
        NSS: "net.SPI_NSS",
        SCK: "net.SPI_SCK",
        MOSI: "net.SPI_MOSI",
        MISO: "net.SPI_MISO",
        BUSY: "net.LORA_BUSY",
        DIO1: "net.LORA_DIO1",
        NRESET: "net.LORA_NRST",
      }}
    />

    <chip
      name="X1"
      manufacturerPartNumber="32MHz_3225"
      footprint="crystal_px3.2mm_py2.5mm"
      pcbX={18.2}
      pcbY={3.0}
      pinLabels={{ pin1: "XOUT", pin2: "GND1", pin3: "XIN", pin4: "GND2" }}
      connections={{ GND1: "net.GND", GND2: "net.GND" }}
    />

    {/* RF matching network and antenna feed */}
    <inductor name="L1" inductance="15nH" footprint="0402" pcbX={12.75} pcbY={-0.9} pcbRotation={270} />
    <inductor name="L2" inductance="15nH" footprint="0402" pcbX={12.75} pcbY={-3.2} pcbRotation={270} />
    <capacitor name="C1" capacitance="3.3pF" footprint="0402" pcbX={14.4} pcbY={-1.5} />
    <capacitor name="C2" capacitance="100pF" footprint="0402" pcbX={8.2} pcbY={0.5} pcbRotation={270} />
    <capacitor name="C3" capacitance="100pF" footprint="0402" pcbX={9.6} pcbY={-1.6} pcbRotation={90} />
    <UFL
      name="J3"
      pcbX={19.0}
      pcbY={-11.6}
      pcbRotation={180}
      connections={{ pin1: "net.RF_ANT", pin2: "net.GND", pin3: "net.GND", pin4: "net.GND" }}
    />

    {/* radio supply decoupling */}
    <inductor name="L3" inductance="15uH" footprint="0805" pcbX={12.75} pcbY={7.2} />
    <capacitor name="C4" capacitance="1uF" footprint="0603" maxDecouplingTraceLength="10mm" pcbX={16.3} pcbY={7.2} />
    <capacitor name="C5" capacitance="100nF" footprint="0402" maxDecouplingTraceLength="10mm" pcbX={15.9} pcbY={-0.5} pcbRotation={90} />
    <capacitor name="C6" capacitance="100nF" footprint="0402" pcbX={8.5} pcbY={6.9} />
    <capacitor name="C7" capacitance="100nF" footprint="0402" pcbX={16.9} pcbY={9.6} />
    <capacitor name="C16" capacitance="10pF" footprint="0402" pcbX={17.0} pcbY={-0.4} pcbRotation={90} />
    <capacitor name="C17" capacitance="10pF" footprint="0402" pcbX={21.6} pcbY={3.0} pcbRotation={270} />

    {/* environmental sensor */}
    <BME280Part
      name="U5"
      pcbX={6.0}
      pcbY={-9.5}
      pinAttributes={{
        VDD: { requiresPower: true },
        VDDIO: { requiresPower: true },
      }}
      connections={{
        VDD: "net.V3_3",
        VDDIO: "net.V3_3",
        GND1: "net.GND",
        GND2: "net.GND",
        CSB: "net.V3_3",
        SDO: "net.GND",
        SDI: "net.I2C_SDA",
        SCK: "net.I2C_SCL",
      }}
    />
    <capacitor name="C18" capacitance="100nF" footprint="0402" pcbX={8.6} pcbY={-9.5} pcbRotation={90} connections={{ pin1: "net.V3_3", pin2: "net.GND" }} />
    <resistor name="R4" resistance="10k" footprint="0402" pcbX={-11.7} pcbY={9.0} />
    <resistor name="R5" resistance="10k" footprint="0402" pcbX={-9.8} pcbY={9.0} />

    <trace from="U1.IO12" to="U2.SCK" />
    <trace from="U1.IO14" to="U2.MOSI" />
    <trace from="U1.IO13" to="U2.MISO" />
    <trace from="U1.IO15" to="U2.NSS" />
    <trace from="U1.IO16" to="U2.BUSY" />
    <trace from="U1.IO17" to="U2.DIO1" />
    <trace from="U1.IO18" to="U2.NRESET" />
    <trace from="U1.IO19" to="net.I2C_SDA" />
    <trace from="U1.IO20" to="net.I2C_SCL" />

    <trace from="R2.pin1" to="J1.CC2" />
    <trace from="R2.pin2" to="net.GND" />
    <trace from="R3.pin1" to="J1.CC1" />
    <trace from="R3.pin2" to="net.GND" />
    <trace from="R1.pin1" to="U3.PROG" />
    <trace from="R1.pin2" to="net.GND" />

    <trace from="U2.XTA" to="net.XTAL_A" />
    <trace from="U2.XTB" to="net.XTAL_B" />
    <trace from="X1.XIN" to="net.XTAL_B" />
    <trace from="X1.XOUT" to="net.XTAL_A" />
    <trace from="C16.pin1" to="net.XTAL_A" />
    <trace from="C16.pin2" to="net.GND" />
    <trace from="C17.pin1" to="net.XTAL_B" />
    <trace from="C17.pin2" to="net.GND" />

    <trace from="U2.RFO" to="L1.pin1" width="0.5mm" />
    <trace from="L1.pin2" to="net.RF_MID" width="0.5mm" />
    <trace from="C1.pin1" to="net.RF_MID" width="0.5mm" />
    <trace from="C1.pin2" to="net.GND" />
    <trace from="L2.pin1" to="net.RF_MID" width="0.5mm" />
    <trace from="U2.RFI_P" to="C2.pin1" />
    <trace from="C2.pin2" to="net.RF_MID" />
    <trace from="U2.RFI_N" to="C3.pin1" />
    <trace from="C3.pin2" to="net.GND" />
    <trace from="L2.pin2" to="J3.pin1" width="0.5mm" />

    <trace from="U2.DCC_SW" to="L3.pin1" />
    <trace from="L3.pin2" to="U2.VREG" />
    <trace from="C4.pin1" to="U2.VREG" />
    <trace from="C4.pin2" to="net.GND" />
    <trace from="C5.pin1" to="U2.VR_PA" />
    <trace from="C5.pin2" to="net.GND" />
    <trace from="C6.pin1" to="net.V3_3" />
    <trace from="C6.pin2" to="net.GND" />
    <trace from="C7.pin1" to="net.V3_3" />
    <trace from="C7.pin2" to="net.GND" />

    <trace from="R4.pin1" to="net.I2C_SDA" />
    <trace from="R4.pin2" to="net.V3_3" />
    <trace from="R5.pin1" to="net.I2C_SCL" />
    <trace from="R5.pin2" to="net.V3_3" />

    {/* pour free corridor around the 50 ohm feed */}
    <keepout
      shape="rect"
      pcbX={15.7}
      pcbY={-6.1}
      width="8.0mm"
      height="7.0mm"
      layers={["top", "bottom"]}
      allowTraces
      allowPlacements
    />

    <copperpour connectsTo="net.GND" layer="top" clearance="0.25mm" boardEdgeMargin="0.3mm" />
    <copperpour connectsTo="net.GND" layer="bottom" clearance="0.25mm" boardEdgeMargin="0.3mm" />
  </board>
)