Project information

  • Course: ECE 3140 — Embedded Systems
  • Date: May 1 – May 15, 2024
  • Languages: C, Assembly (ARM Cortex-M0+)
  • Board: FRDM-KL46Z (ARM Cortex-M0+)
  • Demo: YouTube
  • Showcase: Project Website
C Assembly ADC Embedded FRDM-KL46Z ARM Cortex-M0+ LED

Summary

This project implements a digital VU meter for Cornell University's ECE 3140 Embedded Systems course. An Analog-to-Digital Converter (ADC) on the FRDM-KL46Z microcontroller samples a live audio signal and maps the instantaneous amplitude to an LED bar — more LEDs light as volume increases, with color transitioning from green to yellow to red.

Implementation

The ADC is configured in continuous conversion mode, sampling the audio input at a fixed rate. Each sample is read via an interrupt handler, which computes a rolling peak amplitude and maps it to a 0–N LED index. The LED output is driven through GPIO, with the mapping logic written in a mix of C and ARM Assembly for tight timing control.

  • ADC initialization and calibration for accurate reading across the board's reference voltage range
  • Interrupt-driven sample acquisition to avoid polling delays that would cause visible flicker
  • Peak-hold decay logic to smooth LED transitions so the meter doesn't drop instantly on silence

Challenges

The main debugging effort focused on ADC calibration — without proper calibration, the conversion results were nonlinear and the LED bar stuck at either end of its range. A secondary challenge was timing: the LED update had to be fast enough to track audio transients but not so frequent that it overwhelmed the main loop. Interrupt priorities and the peak-hold decay constant were tuned empirically against live audio input.