gokul/acoustic-guitar-tuner
This code defines a miniature circuit board featuring a microcontroller (ATTINY1616-MNR), audio and power components, tactile switch, various LEDs, and passive components arranged with specific footprints, connections, and mechanical markings for a mini acoustic guitar tuner.
- Version
- 1.0.8
- License
- unset
- Stars
- 2
README.md
# Mini Acoustic Guitar Tuner
A self-contained, guitar-shaped acoustic tuner PCB written in tscircuit. The board listens through an onboard analog MEMS microphone, conditions the signal with an MCP6002, and samples it with an ATtiny1616. Six neck LEDs identify the closest standard-tuning string; three headstock LEDs show flat, in tune, or sharp.
Release 1.0.8 pins tscircuit to 0.0.2509 and specifies the source entrypoint and hosted build command explicitly. The command generates the package website, transpiled code, and PCB/schematic/3D previews. This addresses build reproducibility following the 1.0.7 hosted build timeout; publishing alone does not establish that the hosted build succeeded.
The complete circuit remains inside one A4 schematic sheet, using automatic placement and net labeling, with no schematic sections or manual component `schX`/`schY` coordinates. The local PCB autorouter and supplier LED polarity are unchanged: pin 1 is cathode and pin 2 is anode. Schematic page overflow and long schematic wires remain separate layout issues.
## Hardware
- 70 mm × 40 mm maximum outline, shaped like a miniature guitar
- Two-layer, 1.6 mm FR-4 PCB
- CR2032 holder and battery on the back
- Physical slide switch for zero standby drain
- MSM381ACB026 bottom-port analog MEMS microphone
- MCP6002 two-channel rail-to-rail op-amp
- ATtiny1616-MNR microcontroller with UPDI programming pads
- Six yellow string LEDs: E2, A2, D3, G3, B3, E4
- Red/green/red flat, in-tune, and sharp LEDs
- LED-test button
## Electrical design
The microphone signal is AC-coupled into a non-inverting amplifier biased at half the battery voltage. The first stage has a gain of approximately 11. A buffered 1.6 kHz low-pass output drives PA2/AIN2 on the ATtiny1616. Firmware samples at 8 kHz and uses normalized autocorrelation to estimate pitch.
The board operates directly from one CR2032 cell. Only one note LED and one direction LED are lit at a time to limit battery load. The power switch disconnects the cell when the tuner is stored.
## Programming
Use the three marked pads on the front:
- `UPDI` — programmer data
- `VCC` — target supply reference
- `GND` — ground
Build and flash `firmware/acoustic_tuner_attiny1616.ino` with a megaTinyCore-compatible UPDI programmer. Select ATtiny1616 and the 10 MHz internal oscillator.
Holding the `LED TEST` button lights all indicators so assembled boards can be checked without an audio source.
## Build and export
```sh
bun install
bun run typecheck
bunx tscircuit check netlist index.circuit.tsx
bunx tscircuit build index.circuit.tsx
bunx tscircuit export index.circuit.tsx -f gerbers -o dist/acoustic-guitar-tuner-gerbers.zip
```
Fabrication artifacts are included in `dist/manufacturing/`. The published package also mirrors the Gerber/BOM/PnP archive, schematic PDF, and assembly SVG in `manufacturing/`.
See `MANUFACTURING.md` for the stack-up, ordering files, assembly sequence, and first-article test procedure.
## Assembly note
The MEMS microphone is bottom-port. Do not cover the acoustic hole under `MK1` with solder mask, tape, foam, or an enclosure wall. Install the CR2032 with its marked positive face away from the PCB, as indicated on the bottom silkscreen.