gokul/musegrow

USB‑C powered ESP32‑C3 controller board with regulated 3.3 V supply, USB ESD protection, buttons/status LEDs, ambient-light I²C sensing, and a 555-driven capacitive soil-moisture electrode.

Version
1.2.2
License
unset
Stars
1

lib/soil-electrodes.tsx

type Point = { x: number; y: number }

const buildCombOutline = (params: {
  fingerCenterYs: number[]
  railSide: "left" | "right"
}): Point[] => {
  const isLeftRail = params.railSide === "left"
  const outerRailX = isLeftRail ? -6 : 6
  const innerRailX = isLeftRail ? -4.7 : 4.7
  const fingerTipX = isLeftRail ? 4.2 : -4.2
  const outline: Point[] = [
    { x: outerRailX, y: -40 },
    { x: outerRailX, y: 7.4 },
    { x: innerRailX, y: 7.4 },
  ]

  for (const fingerCenterY of params.fingerCenterYs) {
    outline.push(
      { x: innerRailX, y: fingerCenterY + 0.6 },
      { x: fingerTipX, y: fingerCenterY + 0.6 },
      { x: fingerTipX, y: fingerCenterY - 0.6 },
      { x: innerRailX, y: fingerCenterY - 0.6 },
    )
  }

  outline.push(
    { x: innerRailX, y: -40 },
    { x: outerRailX, y: -40 },
  )
  return outline
}

const senseCombOutline = buildCombOutline({
  railSide: "left",
  fingerCenterYs: [-1, -5, -9, -13, -17, -21, -25, -29, -33, -37],
})

const groundCombOutline = buildCombOutline({
  railSide: "right",
  fingerCenterYs: [-3, -7, -11, -15, -19, -23, -27, -31, -35, -39],
})

export const SoilElectrodes = () => (
  <>
    <copperpour
      name="SOIL_SENSE_COMB"
      layer="top"
      connectsTo="net.SOIL_RC"
      outline={senseCombOutline}
      clearance="0.25mm"
      coveredWithSolderMask
    />
    <copperpour
      name="SOIL_GROUND_COMB"
      layer="top"
      connectsTo="net.GND"
      outline={groundCombOutline}
      clearance="0.25mm"
      coveredWithSolderMask
    />
  </>
)