You are browsing as a guest. Sign up (or log in) to start making projects!

Kajpa

@Kajpa

Joined June 27th, 2026

  • 2Devlogs
  • 2Projects
  • 1Ships
  • 15Votes
Ship Pending review

Built a contactless ultrasonic distance meter on ATtiny1616 from scratch - custom PCB, 3D-printed enclosure, pure AVR-GCC firmware (no Arduino).

The hard part was getting accuracy below 5 mm on a $11 BOM. Standard ToF alone gives ~5-10 mm resolution limited by 40 kHz wavelength (~8.6 mm). To break through that wall I implemented a Goertzel phase filter on the echo samples - it extracts the carrier phase and lets you "snap" the ToF result to a sub-wavelength grid. Combined with NTC temperature compensation and median + MAD outlier rejection across 9 pings, final RMSE landed at 2.4 mm.

Most proud of the power design: MCU in Standby between measurements, analog frontend (amp + MOSFET gate) powered down via BSS84 - idle draw is 0.18 mA at 5V.

To test: flash main.hex via UPDI (SerialUPDI or jtag2updi), open serial at 115200 8N1, point at a flat surface 10-50 cm away. Output line shows fused distance, raw ToF, phase, PLV coherence score and temperature.

  • 1 devlog
  • 5h build
Video of Project → See source code →
Open comments for this post

5h 2m 4s logged

Built a contactless ultrasonic distance meter for a national engineering competition (WETI 2026, Gdansk University of Technology).

How it works: ATtiny1616 fires a 40 kHz burst, receives the echo through a 2-stage MCP6002 bandpass amp, and fuses two ranging methods - fast ToF envelope onset (TCB0 counter, 100 ns/tick) + Goertzel phase filter for sub-millimeter refinement. NTC thermistor corrects speed of sound in real time. Between measurements the MCU sleeps in Standby, analog frontend powered down - total idle draw: 0.18 mA.

Results: 2.4 mm RMSE over 35 readings, 10-50 cm range, total BOM cost 43.73 PLN (~11 USD). Pure AVR-GCC on bare registers, no Arduino libs.

Custom 2-layer PCB, 3D-printed enclosure, full LaTeX documentation.

0
0
1
Open comments for this post

12h 0m 4s logged

Building KalkMate - a physical AI calculator for students.
Snap a photo of a math, physics or chemistry problem, get a full solution on a 256x64 OLED display. No internet required after setup.
Stack: ESP32-S3, OV2640 camera, custom PCB via JLCPCB, 5x5 keyboard matrix. First production run of 50 units incoming.

0
0
4

Followers

Loading…