Source: https://mokxi.com/learn/path/sound-and-audio
Updated: 2026-11-20

All paths

# Sound and audio on microcontrollers

Make sound and hear it, on the Uno and the ESP32: square waves with tone(), a sine from PWM, an MCP4725 DAC and its speed limit, I2S to a MAX98357A, recorded clips on a DFPlayer, an INMP441 microphone, and a spaceship voice clock.

Arduino Uno R3 Free 7 lessons 6 h 4 chapters 2,210 XP Embedded engineering · Intermediate +150 XP

0 of 7 done

Start the course free Tone and square waves Lesson plan for teachers

What you will build

## 2 projects, built step by step

7 lessons in 4 chapters, about 6 hours on a simulated Arduino Uno R3. Free, in your browser, every step checked by the simulator.

Chapter 1 project

### The MCP4725 DAC

A 12-bit DAC on I2C puts out a real voltage, no PWM and no filter. Then its speed limit: the sketch measures its own sample rate, and the pitch it can reach.
Open it in the simulator

Chapter 2 project

### DFPlayer clips

A DFPlayer Mini decodes recorded clips from a microSD card and drives the speaker itself; the Uno sends it commands over serial. Two buttons, a BUSY pin and a spaceship sound board.
Open it in the simulator

The map

## Chapter by chapter

Each lesson opens when the one before it is done, and each chapter ends in a project.

Chapter 1

## Making a waveform

Square waves, PWM samples and a real voltage from a DAC.

Open 267 XP

### Tone and square waves

A piezo on pin 8 plays a coin pickup, a power-up and a laser sweep: tone() makes a square wave, and the piezo and a frequency counter read the pitch back, to the hundredth of a hertz.

0 of 7 steps

Start What is in it

Locked 231 XP

### PWM audio

A real sine from a pin that can only be HIGH or LOW: 62.5 kHz PWM, a sample table played 8000 times a second by a timer interrupt, and two RC stages that smooth it into 440 Hz.

0 of 7 steps

Project Locked 436 XP

### The MCP4725 DAC

A 12-bit DAC on I2C puts out a real voltage, no PWM and no filter. Then its speed limit: the sketch measures its own sample rate, and the pitch it can reach.

0 of 6 steps

5 questions, graded as you go.

Chapter 2

## Digital audio

I2S out to a speaker, and recorded clips from a card.

Locked 249 XP

### I2S with the MAX98357A

An ESP32 sends a sine as 16-bit samples over I2S to a MAX98357A, which drives an 8 ohm speaker by itself. Then the amplifier’s gain and shutdown pins, wired on the canvas.

0 of 7 steps

Project Locked 498 XP

### DFPlayer clips

A DFPlayer Mini decodes recorded clips from a microSD card and drives the speaker itself; the Uno sends it commands over serial. Two buttons, a BUSY pin and a spaceship sound board.

0 of 7 steps

4 questions, graded as you go.

Chapter 3

## Listening

An I2S microphone: level, decibels and pitch.

Locked 249 XP

### The INMP441 microphone

Sound in: an INMP441 sends 24-bit samples over I2S to an ESP32, which works out the level in dBFS from their RMS and the pitch from counting zero crossings, and flags when it gets loud.

0 of 7 steps

3 questions, graded as you go.

Chapter 4

## Boss project

A talking clock built from recorded words.

Locked 280 XP

### Boss: a talking clock

A spaceship voice clock: a DFPlayer strings number clips into "ship time is eight o’clock", a button asks for the time, and a piezo chimes ding-dong on the hour.

0 of 8 steps

3 questions, graded as you go.

Syllabus

## Every lesson in the course

All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.

Chapter 1

### Making a waveform

- Tone and square waves A piezo on pin 8 plays a coin pickup, a power-up and a laser sweep: tone() makes a square wave, and the piezo and a frequency counter read the pitch back, to the hundredth of a hertz.
- PWM audio A real sine from a pin that can only be HIGH or LOW: 62.5 kHz PWM, a sample table played 8000 times a second by a timer interrupt, and two RC stages that smooth it into 440 Hz.
- The MCP4725 DAC A 12-bit DAC on I2C puts out a real voltage, no PWM and no filter. Then its speed limit: the sketch measures its own sample rate, and the pitch it can reach.

Chapter 2

### Digital audio

- I2S with the MAX98357A An ESP32 sends a sine as 16-bit samples over I2S to a MAX98357A, which drives an 8 ohm speaker by itself. Then the amplifier’s gain and shutdown pins, wired on the canvas.
- DFPlayer clips A DFPlayer Mini decodes recorded clips from a microSD card and drives the speaker itself; the Uno sends it commands over serial. Two buttons, a BUSY pin and a spaceship sound board.

Chapter 3

### Listening

- The INMP441 microphone Sound in: an INMP441 sends 24-bit samples over I2S to an ESP32, which works out the level in dBFS from their RMS and the pitch from counting zero crossings, and flags when it gets loud.

Chapter 4

### Boss project

- Boss: a talking clock A spaceship voice clock: a DFPlayer strings number clips into "ship time is eight o’clock", a button asks for the time, and a piezo chimes ding-dong on the hour.

Kits

## Build it on your bench too

Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.

Have a kit already?

### Find your kit

Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.
See every kit

Questions

## About Sound and audio on microcontrollers

Is Sound and audio on microcontrollers free?

Yes. All 7 lessons of Sound and audio on microcontrollers are free and run in your browser, with nothing to install and no parts to buy before you start.

Do I need a real Arduino Uno R3?

No. Every lesson runs on a simulated Arduino Uno R3 with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.

How long does Sound and audio on microcontrollers take?

About 6 hours: 7 lessons in 4 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.

What will I build?

Each chapter ends in a project that puts it together: The MCP4725 DAC and DFPlayer clips.

Where do I start?

With "Tone and square waves", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.
