# AshLight

A cordless **620 nm** night light: no blue, no flicker, no cord. Open-source hardware, firmware
and enclosure. Design package Rev B, 30 October 2026.

Project page (interactive 3D preview, schematics, BOM, costs): **https://ashlight.radiantmachines.com**

## What's here

| Path | What | Regenerate |
|---|---|---|
| `hardware/design.py` | **single source of truth** for the electronics: every part, value, LCSC code and net. Writes BOMs, KiCad netlists, `CALCULATIONS.md` and runs ERC | `python3 hardware/design.py` |
| `hardware/schematic.py` | draws the four schematic sheets (SVG + PNG) from `design.py` | needs `schemdraw` |
| `hardware/verify_sourcing.py` | checks every LCSC code against JLCPCB's live catalogue, prices the BOM | `python3 hardware/verify_sourcing.py` |
| `hardware/optics.py` | melanopic / blue-content comparison of light sources | `python3 hardware/optics.py` |
| `firmware/` | portable lamp behaviour (`src/ashlight_core.c`), RP2040 board support, 15 host tests | `make -C firmware test rp2040` |
| `mechanical/build.py` | parametric enclosure → print-ready STLs + data for the web model | `python3 mechanical/build.py` (needs `manifold3d`, `trimesh`) |
| `site/` | the project page, including the three.js viewer and a JS port of the firmware | `python3 tools/build_site.py` |
| `docs/orders.md` | draft orders and RFQ text (nothing placed) | — |
| `docs/rev-a0-breadboard.md` | Raspberry Pi Pico breadboard prototype | — |
| `tools/` | JLCPCB part lookup/search, UF2 converter, KiCad pin lookup, site builder | — |

## Key decisions

* **LEDs:** 24 × Lumileds LUXEON 2835 Red-Orange (615 nm dominant, ~621 nm peak) in four
  vertical zones. Second source: Cree J Series JE2835ARO (same footprint).
* **Drive:** MCP4728 DAC → TLV9002 op-amp → AO3400A → 10 Ω sense, one per zone. True DC current
  (0–35.9 mA per zone). There is no PWM anywhere in the LED path.
* **Power:** 21700 cell (~5 Ah), bq24073 power-path charger (0.74 A), DW01A + 2 × AO3400A
  protection, RT9013 3.3 V LDO gated by a soft latch (≈10 µA standby).
* **MCU:** Raspberry Pi RP2040. USB bootloader in ROM, so it programs over the lamp's own USB-C
  port by drag-and-drop. Unbrickable.
* **Enclosure:** 216 mm × Ø34 mm with a 43 mm flared foot, matching the reference renders. Printed
  for prototypes. Three sleeve patterns.

## Build

```bash
make -C firmware test                                  # host unit tests
make -C firmware trace && node site/sim/parity.mjs        # JS simulator == C firmware, frame for frame
make -C firmware rp2040 BOARD=ashlight_revb            # needs the Pico SDK + Arm GNU toolchain
python3 tools/build_site.py && python3 -m http.server -d site 8000
```

The RP2040 build sets `PICO_NO_PICOTOOL=1` and makes the `.uf2` with `tools/bin2uf2.py`, so it
needs no network access at build time.

## Status

Done: schematic and netlist (ERC clean), verified sourcing, firmware (host-tested, builds for
RP2040), enclosure STLs, interactive 3D preview, cost model, draft orders.
Next: PCB layout (main board + flex), then Stage A0 breadboard, then the first JLCPCB run.

## Licences

Firmware and tools: MIT (`LICENSE`). Hardware, enclosure and documentation: CERN-OHL-P v2
(`LICENSE-HARDWARE`).
