Add parametric 3D-printable enclosure (OpenSCAD)

A printable reimagining of the wooden Kidsbox: rectangular cabinet with two
front speakers, removable top lid (NFC tag rests there, reader mounts beneath),
and swappable speaker mounts.

- kidsbox.scad: master model + part dispatcher (body/lid/speaker_adapter/grill)
- params.scad: all tunable dimensions in one place
- lib.scad: helper modules (rounded shell, bosses, bolt circles)
- Fixed front-panel speaker interface + swappable adapter so any driver fits
  by printing a new adapter (edit spk_* params, re-export)
- Internal mounts: 2x18650 cradle, ESP32-LyraT standoffs, RC522 under lid,
  3 buttons on lid, USB/charge + power-switch side ports, back-wall vents
- Snap-in speaker grills
- Makefile to export STLs and render previews (headless via xvfb)
- Exported STLs and preview renders included
- Link enclosure from main README

Dimensions are sensible defaults from the reference photos and common parts;
README flags the fit-critical values to verify before mass-printing.

https://claude.ai/code/session_01MhAnh68DPNnTjcKqjNYDmk
This commit is contained in:
Claude committed 2026-06-13 10:39:55 +00:00
1 parent 64475dbf5e
commit 75dd63b56f
17 files changed
+170230

No files matched your search

+145
View File
@@ -0,0 +1,145 @@
# Kidsbox — 3D-printable enclosure
A parametric, fully 3D-printable reimagining of the original wooden Kidsbox.
The design keeps the look of the hand-built box — a rectangular cabinet with two
front-firing speakers and a removable top where the NFC tag rests — but makes the
**speaker mount swappable** so you can print an adapter to fit whatever drivers you
have on hand.
![Assembly](img/hero.png)
> Modelled in [OpenSCAD](https://openscad.org). Everything is driven by
> [`params.scad`](params.scad) — change a few numbers, re-export, and print.
---
## What's in the box
| Part | Qty | File | Notes |
|---|---|---|---|
| Body / cabinet | 1 | `stl/body.stl` | Shell with all internal mounts |
| Lid | 1 | `stl/lid.stl` | Buttons + NFC reader mount underneath |
| Speaker adapter | 2 | `stl/speaker_adapter.stl` | **Swappable** — print to fit your driver |
| Speaker grill | 2 | `stl/grill.stl` | Snaps into the sound opening |
The body carries mounts for everything else:
- **2× 18650 battery holder** — open-top cradle with retaining lips (`batt_*` params)
- **ESP32-LyraT v4.3** — four floor standoffs (`lyrat_*` params)
- **RC522 NFC reader** — pocket on the lid underside, so a tag placed on top reads
through the thin (`lid_t = 2.4 mm`) PLA window
- **3 buttons** (vol−, play/pause, vol+) — 12 mm holes in a row near the lid's front edge
- **Speaker interface** — a fixed bolt pattern the swappable adapters mount to
- **Side ports** — USB/charging cutout and a power-switch hole
- **Vents** on the back wall
| Body | Lid (underside) |
|---|---|
| ![Body](img/body.png) | ![Lid](img/lid.png) |
---
## Printing
| Setting | Recommendation |
|---|---|
| Material | PLA or PETG (PLA is fine; keep metal away from the NFC window) |
| Layer height | 0.2 mm |
| Walls / perimeters | 3+ |
| Infill | 15–20 % |
| Supports | **Body:** none (print open-side up). **Lid:** none. **Adapter/Grill:** none. |
| Orientation | Body open-top up; lid top-face down; adapter & grill flat |
The body is ~190 × 115 × 110 mm, so it fits a 220 × 220 bed (Ender-3 class) and larger.
---
## Assembly
1. **Speakers** → bolt each driver to a `speaker_adapter` using the adapter's inner
screw holes, then bolt the adapter to the four bosses inside the front wall (M3).
2. **Grills** → press a `grill` into each sound opening from the front.
3. **Electronics** → screw the ESP32-LyraT onto the floor standoffs; drop the 18650
holder into the cradle; route the USB/charge lead to the side cutout.
4. **NFC reader** → screw the RC522 to the four posts under the lid.
5. **Buttons** → fit the three 12 mm momentary switches into the lid holes.
6. **Close up** → lower the lid (the lip locates it) and drive four M3 screws into the
corner bosses.
---
## Swapping speakers (the whole point)
The front wall never changes — it has a **fixed interface**: a `spk_sound_d` opening
and four bosses on a `spk_bolt_d` circle. Every speaker bolts to the box through an
**adapter** that you print to match *your* driver. To make a new adapter, edit the
adapter block in [`params.scad`](params.scad):
```scad
// ---- swappable speaker ADAPTER (edit for YOUR speaker) ----
spk_frame_d = 66; // your speaker's outer frame diameter
spk_cutout_d = 58; // cone clearance (a bit less than the cone surround)
spk_screw_count = 4; // your speaker's mounting-hole count
spk_screw_bolt_d = 60; // your speaker's mounting-hole bolt circle
```
Then re-export just that part:
```bash
openscad -D 'part="speaker_adapter"' -o stl/speaker_adapter.stl kidsbox.scad
```
Leave the `spk_sound_d` / `spk_bolt_d` (panel) values alone and your new adapter will
drop straight onto the same box.
| Speaker adapter (swappable) | Grill |
|---|---|
| ![Adapter](img/speaker_adapter.png) | ![Grill](img/grill.png) |
---
## Regenerating everything
```bash
make stl # export all STLs into stl/
make img # render preview PNGs (needs a display, or xvfb on a server)
make all
```
Or one part at a time:
```bash
openscad -D 'part="body"' -o stl/body.stl kidsbox.scad
openscad -D 'part="lid"' -o stl/lid.stl kidsbox.scad
openscad -D 'part="speaker_adapter"' -o stl/speaker_adapter.stl kidsbox.scad
openscad -D 'part="grill"' -o stl/grill.stl kidsbox.scad
```
---
## ⚠️ Verify before mass-printing
These dimensions are sensible defaults derived from the reference photos and common
parts, **not** from calipers on your exact hardware. Before printing the whole set,
print a quick test of the fit-critical features and confirm against your parts:
- ESP32-LyraT mounting-hole rectangle (`lyrat_hole_dx`, `lyrat_hole_dy`)
- RC522 mounting-hole rectangle (`bx`, `by` in the `rc522_mount()` module)
- Your 18650 holder footprint (`batt_holder_*`)
- Speaker frame/cone/bolt-circle (`spk_frame_d`, `spk_cutout_d`, `spk_screw_bolt_d`)
A cheap way to validate the speaker fit is to print one `speaker_adapter` first.
---
## Files
```
enclosure/
├── kidsbox.scad master model + part dispatcher
├── params.scad all tunable dimensions ← edit here
├── lib.scad helper modules
├── Makefile export/render targets
├── stl/ exported STLs
└── img/ rendered previews
```