afazero/tscircuit-starter

Two boards are defined: a 5V red LED indicator with a 220Ω resistor and 100nF decoupling capacitor, plus a 5V RC low-pass filter using a 187Ω resistor and 10µF capacitor for transient SPICE simulation.

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 afazero/tscircuit-starter  # download the package files into ./tscircuit-starter
tsci add afazero/tscircuit-starter    # add it to your project as @tsci/afazero.tscircuit-starter

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.

README.md

# tscircuit starter (lokal)

Dua board contoh, semuanya di browser — tidak perlu KiCad/EasyEDA.

| File | Isi | Bisa |
| --- | --- | --- |
| `index.tsx` | LED indikator 5V (header 2 pin, R 220Ω, LED, cap 100nF) | PCB + routing + Gerber |
| `sim.tsx` | RC low-pass filter | Schematic + simulasi SPICE |

## Prasyarat

- **Node.js 20+** dan npm
- **Bun** — CLI `tsci` sekarang dijalankan dengan Bun.
  ```bash
  curl -fsSL https://bun.sh/install | bash
  ```
  (butuh `unzip`; kalau tidak ada: unduh `bun-linux-x64.zip` /
  `bun-linux-aarch64.zip` dari halaman releases Bun, ekstrak, taruh `bun`
  di `PATH`)

## Jalankan

```bash
cd ~/tscircuit-starter
npm install       # sekali saja
npm run dev       # http://localhost:3020/#file=index.tsx
```

Board simulasi:

```
http://localhost:3020/#file=sim.tsx
```

Preview punya tab **PCB / Schematic / 3D / Simulation**. Edit file, simpan,
preview langsung ter-update.

## Buka dari HP (satu Wi-Fi)

Server listen di semua interface, jadi cukup buka dari HP:

```
http://<IP-komputer>:3020/#file=index.tsx
```

Cari IP dengan `hostname -I` atau `ip -4 addr`. Kalau terblokir, cek firewall
(port 3020).

## Perintah lain

```bash
npm run build        # validasi board -> dist/index/circuit.json
npm run build:sim    # validasi file simulasi (tanpa PCB)
npm run check        # DRC & warning (0 errors = aman)
npm run snapshot     # render PCB + schematic + 3D ke __snapshots__/
npm run snapshot:sim # render grafik simulasi
```

`npm run snapshot` menghasilkan:

```
__snapshots__/index-pcb.snap.svg
__snapshots__/index-schematic.snap.svg
__snapshots__/index-3d.snap.png
__snapshots__/sim-simulation.snap.svg
```

## Export fabrikasi

- **Dari UI**: tombol download / menu File di preview.
- **CLI**: `npx tsci export index.tsx --help` untuk format yang tersedia
  (Gerber, BOM, pick-and-place, dll).

## Catatan

- `--disable-parts-engine` dipakai supaya build tidak menebak part JLCPCB.
  Kalau mau assembly, tambahkan `supplierPartNumbers` (mis.
  `supplierPartNumbers={{ jlcpcb: ["C2286"] }}`) atau `mpn` per komponen.
- Warnings yang tersisa hanya soal MPN dan `<schematicsheet>` — bukan error.
- Simulasi memakai `ngspice` (sudah dibundel CLI).

## Ide lanjutan

- Ganti LED jadi WS2812 / tambah resistor array.
- Tambah `<chip>` ESP32 + regulator 3.3V.
- Buat board 2 layer: set `layers={2}` di `<board>`.
- Cek elemen lain: https://docs.tscircuit.com/elements