README.md
# Mini Acoustic Guitar Tuner
A 40 x 70 mm guitar-shaped, two-layer acoustic tuner with an onboard microphone and CR2032 holder. Revision 1.0.10 is a **CAD-checked engineering prototype**, not a physically validated production product. The manufacturing/ files are for this female-header revision. Obtain fabricator/assembler approval before ordering a small first article. See MANUFACTURING.md for outstanding release gates.
## Hardware
- MK1: MSM381ACB026 bottom-port microphone converts guitar sound into an electrical signal.
- U1: MCP6002 dual op-amp amplifies the signal by about 11 and buffers a 1.6 kHz low-pass filter.
- U2: ATtiny1616-MNR samples audio and controls six string LEDs and three tuning LEDs.
- Resistors/capacitors set gain, bias and filter response, stabilize power and limit LED current.
- BT1/SW1: bottom-side CR2032 holder and physical power switch. The battery is replaceable, not rechargeable.
- SW2: holding TEST sequences the nine LEDs one at a time to reduce battery load.
- J1: BOOMELE PM254-1-03-Z-8.5 female header, three sockets on 2.54 mm spacing, replacing all test points.
## Programming: plug in three wires
Use a **3.3 V-compatible UPDI programmer** with male-ended leads that plug into J1. A plain USB cable cannot program this board.
| Board socket | Connect to |
| --- | --- |
| 1 - UPDI | Programmer UPDI data |
| 2 - 3V3 | Regulated 3.3 V target power |
| 3 - GND | Programmer ground |
Remove the CR2032 before programming. J1 powers VCC directly; never apply 5 V or let a programmer charge/back-feed the coin cell. Follow the printed pin numbers. Some programmers only sense target voltage and need a separate regulated 3.3 V supply sharing ground.
The sketch is firmware/acoustic_tuner_attiny1616/acoustic_tuner_attiny1616.ino. Use megaTinyCore 2.6.11, ATtiny1616, internal 10 MHz, BOD 2.6 V enabled, retaining UPDI functionality. Set fuses with the appropriate megaTinyCore programmer operation, then upload using UPDI. No USB bootloader is required.
Firmware compiled successfully: 4,225 bytes flash and 522 bytes static RAM. The pitch detector passed 270 synthetic tone cases (worst error 0.81 cents), plus silence/noise checks. This does **not** establish real acoustic accuracy. Calibrate SAMPLE_CLOCK_SCALE against an accurate tone source and verify capture timing, loaded battery-voltage range and temperature drift on an assembled board.
## Layout and reproducibility
The schematic uses one automatically arranged 420 x 297 mm sheet, without sections or manual component schX/schY coordinates. Grid placement provides predictable separation. PCB routing is local, using capacity-autorouter 0.0.899 with extra edge margin; saved routes are reused only when the complete routing input matches exactly. tscircuit is pinned to 0.0.2509. The microphone's four ground land sectors use separate logical ports, all connected to GND; these are not six physical package pins. Manufacturer physical pin 3 remains the ground ring.
Run typecheck, netlist, schematic-placement, placement, build and Gerber-derived shorts checks before export. A successful build exit code alone is insufficient: inspect circuit JSON entries containing error_type as well as types ending in _error.
Host pitch tests: compile firmware/test_pitch.cpp with clang++ -std=c++17 and execute the resulting program.
## Public-package references
Reviewed [tscircuit/motor-controller](https://tscircuit.com/tscircuit/motor-controller) for explicit connector/signal mapping and [rushabhcodes/Attiny85-Arcade-Keychain](https://tscircuit.com/rushabhcodes/Attiny85-Arcade-Keychain) for coin-cell, switch and custom-outline organization. These are design references, not proof this board works. The ATtiny85 project's ISP interface is not compatible with the ATtiny1616's UPDI. No source code was copied.