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

Contactless ultrasonic distance meter on ATtiny1616

Hardware
  • 1 Devlogs
  • 5 Total hours

Contactless ultrasonic distance meter on ATtiny1616. Measures 10-50 cm with ~2.4 mm RMSE using hybrid Pulse-Phase Ranging - ToF envelope onset + Goertzel phase filter, NTC temperature compensation. Pure AVR-GCC firmware (no Arduino), custom 2-layer PCB, 3D-printed enclosure. Built for WETI 2026 competition at Gdansk University of Technology.

Ship #1 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

Followers

Loading…