rushabhcodes/desk-fidget-counter

A PLA desk fidget counter assembly houses an F1 PCB, 1.28-inch LCD with harness, rotary knob/bearing mechanism, button cap, and screw-secured base/display mount.

Version
6.0.16
License
MIT
Stars
0

Use with the tscircuit CLI

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

tsci clone rushabhcodes/desk-fidget-counter  # download the package files into ./desk-fidget-counter
tsci add rushabhcodes/desk-fidget-counter    # add it to your project as @tsci/rushabhcodes.desk-fidget-counter

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.

system-diagram.tsx

import { systemblock } from "tscircuit"

export function SystemDiagram() {
  return (
    <systemblock.page
      name="classic-f1"
      displayName="Classic F1 system"
      description="A USB-powered scroll ring, turn counter and laptop dashboard."
    >
      <systemblock.group name="signals" displayName="Signal flow">
        <systemblock.component
          name="laptop"
          displayName="Laptop"
          description="Receives scroll events. Sends clock, CPU, RAM and battery data."
        />
        <systemblock.component name="ring" displayName="Rotating ring" description="48-slot optical track" />
        <systemblock.group name="board" displayName="Classic F1 PCB">
          <systemblock.component
            name="usb"
            displayName="USB-C interface"
            description="ESD clamp and series resistors"
            pcbComponentNames={["J1", "U6", "R3", "R4"]}
          />
          <systemblock.component
            name="encoder"
            displayName="Optical encoder"
            description="Dual IR sensor and Schmitt buffer"
            pcbComponentNames={["U2", "U7"]}
          />
          <systemblock.component
            name="button"
            displayName="Mode button"
            description="Tap to change mode. Hold 3 s to clear."
            pcbComponentName="SW1"
          />
          <systemblock.component
            name="controller"
            displayName="RP2040"
            description="Decodes rotation and counts turns"
            pcbComponentName="U1"
          />
          <systemblock.component
            name="storage"
            displayName="FRAM"
            description="32 KB retains the turn count"
            pcbComponentName="U3"
          />
          <systemblock.component
            name="service"
            displayName="Boot and service"
            description="Flash, 12 MHz clock and SWD"
            pcbComponentNames={["U8", "X1", "J4"]}
          />
        </systemblock.group>
        <systemblock.component
          name="lcd"
          displayName="Fixed round LCD"
          description="1.28 in. Turns and laptop metrics."
          pcbComponentName="J6"
        />
        <systemblock.connection from="laptop" to="usb" label="HID / CDC" direction="both" />
        <systemblock.connection from="usb" to="controller" label="D+ / D−" direction="both" />
        <systemblock.connection from="ring" to="encoder" />
        <systemblock.connection from="encoder" to="controller" label="Quadrature A/B" />
        <systemblock.connection from="button" to="controller" label="GPIO0" />
        <systemblock.connection from="controller" to="storage" label="I²C" direction="both" />
        <systemblock.connection from="controller" to="service" direction="both" />
        <systemblock.connection from="controller" to="lcd" label="SPI via J6 / H1" />
      </systemblock.group>
      <systemblock.group name="power" displayName="Power flow">
        <systemblock.component name="vbus" displayName="USB 5 V" description="VBUS from the laptop" pcbComponentName="J1" />
        <systemblock.component name="ldo" displayName="3.3 V regulator" description="TLV75533" pcbComponentName="U5" />
        <systemblock.component name="logic" displayName="3.3 V logic rail" description="RP2040, FRAM, buffer and flash" />
        <systemblock.component name="load-switch" displayName="Load switch" description="Enabled by U1 GPIO1" pcbComponentName="U4" />
        <systemblock.component
          name="peripherals"
          displayName="Switched 3.3 V rail"
          description="Optical sensor and LCD. Off during USB suspend."
        />
        <systemblock.connection from="vbus" to="ldo" kind="power" />
        <systemblock.connection from="ldo" to="logic" label="V3V3" kind="power" />
        <systemblock.connection from="logic" to="load-switch" kind="power" />
        <systemblock.connection from="load-switch" to="peripherals" label="PERIPH_3V3" kind="power" />
      </systemblock.group>
    </systemblock.page>
  )
}