Guides · 8 min read

ESP32 Internet Radio: Build It With MAX98357A, Buttons and OLED

Build an ESP32 internet radio: MAX98357A I2S amp wiring, the ESP32-audioI2S library, stream URLs, station and volume buttons, OLED, PSRAM and fixing dropouts.

An ESP32 internet radio is a small device that pulls a live radio stream over Wi-Fi, decodes the MP3 or AAC data on its own processor and plays the sound through an I2S amplifier and a speaker. All you need is an ESP32, a MAX98357A amplifier module that costs a few dollars, a 4–8 Ω speaker and some wires. No transmitter or antenna is involved; you just put the stream address of any station in the world into the code. In this guide you will build a complete radio that changes station and volume with buttons, shows the station name and the current song on an OLED display and resumes the last station after a power cycle.

The tricky part is not the sound but the continuity: if the stream stutters every few seconds or goes silent after a few minutes, the cause is almost always memory, Wi-Fi or power. So first we will work out which boards and which version of the ESP32-audioI2S library work, why PSRAM matters and how many seconds of reserve the buffer gives you. Then come the wiring table, the code, how to find stream URLs and a symptom-cause-fix table for dropouts.

ESP32 development board for an internet radio
ESP32 development board: for an internet radio pick a version with a WROVER module, meaning one with PSRAM, or an ESP32-S3; on ordinary WROOM boards the buffer stays very small.

How does an ESP32 internet radio work?

Internet radio stations send their programme from Icecast or Shoutcast servers as an endless file stream over HTTP. The ESP32 connects to that stream, first fills a buffer with the incoming bytes, then turns them into audio samples (PCM) with its MP3 or AAC decoder and sends them over the I2S bus to the MAX98357A. The MAX98357A is a digital-to-analog converter (DAC) and a class D amplifier in one, so a single module drives the speaker directly. A 128 kbps MP3 stream means 16 KB of data per second. The buffer covers every short pause in Wi-Fi; when it runs dry, the sound cuts out.

PartJobNote
ESP32 (with PSRAM)Wi-Fi, streaming, MP3/AAC decodingESP32-WROVER or ESP32-S3 (N8R2, N16R8)
MAX98357AI2S DAC and 3.2 W class D amplifierRuns on 2.5–5.5 V, mono output
SpeakerPlays the sound4–8 Ω, at least 3 W
0.96 inch OLED (SSD1306)Station name, song, volumeI2C, 128×64 pixels
3 push buttonsStation, volume up, volume downTo GND with internal pull-ups
5 V adapterPowers the whole circuitAt least 2 A recommended

Why PSRAM? Choosing the board and library version

The current 4.x version of the ESP32-audioI2S library only runs with ESP32 Arduino core 3.x and on boards with PSRAM; if it finds no PSRAM it prints "PSRAM not found" to the Serial Monitor and stays silent. On classic ESP32 boards without PSRAM the only option is core 2.x with the old 2.0.0 version of the library. The buffer shows the difference clearly: version 2.0.0 allocates an input buffer of about 8000 bytes without PSRAM and 300000 bytes with PSRAM. On a 128 kbps stream, 8000 bytes is only half a second of reserve, while 300000 bytes is about 19 seconds. Even a brief hiccup from your router causes a dropout on a board without PSRAM, whereas a board with PSRAM rides it out unnoticed.

BoardPSRAMArduino IDE setting (Tools > PSRAM)For the radio
ESP32 DevKit (WROOM-32)NoneNoneOnly with version 2.0.0 and a tiny buffer
ESP32-WROVER DevKitYes (usually 8 MB)EnabledSuitable
ESP32-S3 DevKitC-1 N8R22 MBQSPI PSRAMSuitable
ESP32-S3 DevKitC-1 N16R88 MBOPI PSRAMThe most comfortable choice
ESP32-C3 / ESP32-S2VariesNoneNot supported by the library
On WROVER modules GPIO 16 and 17 are wired to the PSRAM; connect buttons or anything else there and the board will not boot or will crash. On ESP32-S3 boards with octal (OPI) PSRAM such as the N16R8, GPIO 35, 36 and 37 are also reserved for the PSRAM. The wiring table below uses none of these pins.

Wiring diagram: MAX98357A, buttons and OLED

ConnectionESP32 (WROVER)ESP32-S3Note
MAX98357A BCLKGPIO 27GPIO 12Bit clock
MAX98357A LRCGPIO 26GPIO 13Left/right channel clock (WS)
MAX98357A DINGPIO 25GPIO 11Audio data
MAX98357A VIN / GND5V (VIN) / GND5V / GNDDo not power from the 3.3 V pin
MAX98357A GAIN / SDUnconnectedUnconnected9 dB gain, mix of both channels
OLED SDA / SCLGPIO 21 / GPIO 22GPIO 8 / GPIO 9VCC to 3V3
Button: next stationGPIO 32GPIO 4Other leg to GND
Button: volume upGPIO 33GPIO 5Other leg to GND
Button: volume downGPIO 4GPIO 6Other leg to GND

The MAX98357A's GAIN pin sets the gain: left unconnected it gives 9 dB, tied to GND 12 dB and tied to VIN 6 dB; through a 100 kΩ resistor to GND you get 15 dB and to VIN 3 dB. For a small desk speaker 9 dB is plenty; if the sound distorts, lower the gain. With the SD pin unconnected the module plays a mix of the left and right channels; pull it to GND and the amplifier shuts down. For stereo you connect two MAX98357A boards to the same I2S bus and use the SD pin to set one to the left and the other to the right channel. The buttons use the internal pull-up resistors, so no external resistors are needed.

Connect the speaker straight to the module's + and − outputs; these outputs are bridge-tied (BTL) and neither of them is GND. Connecting one speaker lead to GND or to another amplifier destroys the module. Do not power the module from the ESP32's 3.3 V pin; with a 4 Ω speaker at high volume it can draw current peaks of 700–800 mA. A 470–1000 µF capacitor between VIN and GND right next to the module noticeably reduces dropouts and crackling.

Installing the libraries

  1. In the Arduino IDE pick your board under Tools > Board: ESP32 Dev Module or ESP32 Wrover Module for a classic WROVER, ESP32S3 Dev Module for an S3.
  2. Set Tools > PSRAM to Enabled, QSPI PSRAM or OPI PSRAM depending on your board.
  3. Search the Library Manager for "ESP32-audioI2S" and install the library by schreibfaul1. With ESP32 core 3.x take the latest version; with core 2.x choose 2.0.0 from the version list.
  4. Install the U8g2 library for the OLED from the same place; it displays accented letters correctly, which is why we use it here instead of Adafruit SSD1306.
  5. If compiling fails with "Sketch too big", set Tools > Partition Scheme to Huge APP (3MB No OTA).

The code: a radio with station and volume buttons

The code starts with a list of five stations; add as many as you like or swap the addresses for stations from your own country. The pins are chosen automatically for the board type: compile for an ESP32-S3 and the pins from the S3 column are used, compile for a classic ESP32 and the WROVER column applies. Because the way the library reports the station name and song changed between versions, the code has two separate sections, and the compiler picks the right one for your core version.

C++ (Arduino IDE)
1// ESP32 internet radyosu: MAX98357A + 3 buton + SSD1306 OLED
2// ESP32 internet radio: MAX98357A + 3 buttons + SSD1306 OLED
3// Çekirdek 3.x: ESP32-audioI2S 4.x (PSRAM şart) / core 3.x: ESP32-audioI2S 4.x (PSRAM required)
4// Çekirdek 2.x: ESP32-audioI2S 2.0.0 / core 2.x: ESP32-audioI2S 2.0.0
5#include <WiFi.h>
6#include <Preferences.h>
7#include <U8g2lib.h>
8#include "Audio.h"
9
10const char* WIFI_SSID = "WIFI_ADIN";      // Wi-Fi adı / Wi-Fi name
11const char* WIFI_PASS = "WIFI_SIFRESI";   // Wi-Fi şifresi / Wi-Fi password
12
13#if defined(CONFIG_IDF_TARGET_ESP32S3)
14  #define I2S_BCLK 12
15  #define I2S_LRC  13
16  #define I2S_DOUT 11
17  #define OLED_SDA 8
18  #define OLED_SCL 9
19  #define BTN_NEXT 4
20  #define BTN_UP   5
21  #define BTN_DOWN 6
22#else                                      // klasik ESP32 (WROVER) / classic ESP32 (WROVER)
23  #define I2S_BCLK 27
24  #define I2S_LRC  26
25  #define I2S_DOUT 25
26  #define OLED_SDA 21
27  #define OLED_SCL 22
28  #define BTN_NEXT 32
29  #define BTN_UP   33
30  #define BTN_DOWN 4
31#endif
32
33struct Station { const char* name; const char* url; };
34const Station stations[] = {               // kendi istasyonlarını ekle / add your own stations
35  {"Deutschlandfunk", "http://st01.sslstream.dlf.de/dlf/01/128/mp3/stream.mp3"},
36  {"SWR3",            "http://liveradio.swr.de/sw282p3/swr3/play.mp3"},
37  {"1LIVE",           "http://wdr-1live-live.icecast.wdr.de/wdr/1live/live/mp3/128/stream.mp3"},
38  {"Bayern 3",        "http://dispatcher.rndfnk.com/br/br3/live/mp3/mid"},
39  {"Radio Paradise",  "http://stream.radioparadise.com/mp3-128"},
40};
41const uint8_t STATION_COUNT = sizeof(stations) / sizeof(stations[0]);
42
43Audio audio;
44Preferences prefs;
45U8G2_SSD1306_128X64_NONAME_F_HW_I2C oled(U8G2_R0, U8X8_PIN_NONE, OLED_SCL, OLED_SDA);
46
47uint8_t station = 0, volume = 10;          // ses 0-21 / volume 0-21
48char stationName[48] = "";
49char streamTitle[96] = "";
50volatile bool screenDirty = true;
51uint8_t lastFill = 0;
52unsigned long lastFillCheck = 0, lastRetry = 0;
53
54const uint8_t BTN_PINS[3] = {BTN_NEXT, BTN_UP, BTN_DOWN};
55bool btnState[3] = {HIGH, HIGH, HIGH};
56unsigned long btnTime[3] = {0, 0, 0};
57
58// Kütüphaneden gelen istasyon adı ve şarkı bilgisi / station name and song info from the library
59#if ESP_ARDUINO_VERSION_MAJOR >= 3
60void onAudioInfo(Audio::msg_t m) {
61  if (!m.msg) return;
62  if (m.e == Audio::evt_name) { strlcpy(stationName, m.msg, sizeof(stationName)); screenDirty = true; }
63  else if (m.e == Audio::evt_streamtitle) { strlcpy(streamTitle, m.msg, sizeof(streamTitle)); screenDirty = true; }
64  else if (m.e == Audio::evt_info) Serial.printf("info: %s\n", m.msg);
65}
66#else
67void audio_showstation(const char* info) { strlcpy(stationName, info, sizeof(stationName)); screenDirty = true; }
68void audio_showstreamtitle(const char* info) { strlcpy(streamTitle, info, sizeof(streamTitle)); screenDirty = true; }
69void audio_info(const char* info) { Serial.printf("info: %s\n", info); }
70#endif
71
72void playStation() {
73  strlcpy(stationName, stations[station].name, sizeof(stationName));  // yayın adı gelene kadar / until the stream sends its name
74  streamTitle[0] = '\0';
75  screenDirty = true;
76  audio.connecttohost(stations[station].url);
77}
78
79void drawScreen() {
80  screenDirty = false;
81  oled.clearBuffer();
82  oled.setFont(u8g2_font_6x13_te);         // ä ö ü ß ve ş ğ ı içerir / includes umlauts and Turkish letters
83  char top[24];
84  snprintf(top, sizeof(top), "%u/%u  Vol %u", station + 1, STATION_COUNT, volume);
85  oled.drawStr(0, 11, top);
86  oled.drawUTF8(0, 28, stationName);
87  oled.drawUTF8(0, 44, streamTitle);
88  oled.drawFrame(0, 54, 128, 10);          // tampon doluluğu / buffer fill level
89  oled.drawBox(2, 56, lastFill * 124 / 100, 6);
90  oled.sendBuffer();
91}
92
93void onPress(uint8_t i) {
94  if (i == 0) {
95    station = (station + 1) % STATION_COUNT;
96    prefs.putUChar("st", station);         // son istasyonu hatırla / remember the last station
97    playStation();
98  }
99  else if (i == 1 && volume < 21) volume++;
100  else if (i == 2 && volume > 0) volume--;
101  if (i > 0) { audio.setVolume(volume); prefs.putUChar("vol", volume); }
102  screenDirty = true;
103}
104
105void handleButtons() {
106  for (uint8_t i = 0; i < 3; i++) {
107    bool s = digitalRead(BTN_PINS[i]);
108    if (s != btnState[i] && millis() - btnTime[i] > 40) {   // 40 ms debounce
109      btnTime[i] = millis();
110      btnState[i] = s;
111      if (s == LOW) onPress(i);
112    }
113  }
114}
115
116void setup() {
117  Serial.begin(115200);
118  for (uint8_t i = 0; i < 3; i++) pinMode(BTN_PINS[i], INPUT_PULLUP);   // buton GPIO ile GND arası / button between GPIO and GND
119  oled.begin();
120  oled.enableUTF8Print();
121  prefs.begin("radio", false);
122  station = prefs.getUChar("st", 0) % STATION_COUNT;
123  volume = prefs.getUChar("vol", 10);
124
125  WiFi.mode(WIFI_STA);
126  WiFi.setSleep(false);                    // Wi-Fi güç tasarrufu kesintiye yol açar / power save causes dropouts
127  WiFi.begin(WIFI_SSID, WIFI_PASS);
128  while (WiFi.status() != WL_CONNECTED) delay(300);
129
130#if ESP_ARDUINO_VERSION_MAJOR >= 3
131  Audio::audio_info_callback = onAudioInfo;
132#endif
133  audio.setPinout(I2S_BCLK, I2S_LRC, I2S_DOUT);
134  audio.setVolume(volume);
135  audio.setConnectionTimeout(1000, 3000);  // yavaş sunucular için / for slow servers (http, https)
136  playStation();
137}
138
139void loop() {
140  audio.loop();                            // akışı çözer ve I2S'e yollar / decodes the stream to I2S
141  handleButtons();
142  if (millis() - lastFillCheck > 1000) {   // saniyede bir tampon doluluğu / buffer fill once a second
143    lastFillCheck = millis();
144    uint32_t used = audio.inBufferFilled(), total = used + audio.inBufferFree();
145    uint8_t fill = total ? used * 100 / total : 0;
146    if (fill != lastFill) { lastFill = fill; screenDirty = true; }
147  }
148  if (screenDirty) drawScreen();           // ekranı yalnızca değişince çiz / redraw only on change
149  if (!audio.isRunning() && millis() - lastRetry > 10000) {   // yayın durduysa 10 s'de bir dene / retry every 10 s if the stream stopped
150    lastRetry = millis();
151    playStation();
152  }
153#if ESP_ARDUINO_VERSION_MAJOR >= 3
154  vTaskDelay(1);
155#endif
156}

In the core 3.x section, the onAudioInfo() function of version 4.x catches the station name (evt_name) and the song information (evt_streamtitle) by event type; in the core 2.x section audio_showstation() and audio_showstreamtitle() do the same job. The volume runs from 0 to 21 and is saved, together with the last station, in the ESP32's non-volatile storage (NVS) with the Preferences library, so after unplugging the radio you carry on where you left off. The WiFi.setSleep(false) line turns off Wi-Fi power saving; with it on, the ESP32 naps at short intervals and the stream arrives unevenly. The display is only redrawn when something changes, because pushing 1 KB of image data to the OLED on every loop delays audio.loop(). The bar at the bottom shows how full the buffer is; if the stream stops, the code tries to reconnect every 10 seconds.

FunctionWhat it does
audio.setPinout(BCLK, LRC, DOUT)Sets the I2S pins
audio.setVolume(0–21)Sets the volume
audio.connecttohost(url)Connects to the stream and starts playing
audio.loop()Decodes the data and feeds the amplifier; call it as often as possible
audio.isRunning()Returns true while a stream is playing
audio.inBufferFilled() / inBufferFree()Bytes used and bytes still available in the buffer
audio.setConnectionTimeout(http, https)Connection timeout (ms)
audio.setBufsize(ram, psram)Version 2.0.0 only: buffer size, call before connecting

How do you find a radio station's stream URL?

The "listen live" page on a station's website is usually a player, not a stream address. The easiest way to find the real address is to download the station's .m3u or .pls file and open it in a text editor; the line starting with http is the stream URL. Open station databases such as Radio Browser also list the direct address, format and bitrate of tens of thousands of stations. Before you put an address in the code, test it in VLC with Open Network Stream: an MP3 or AAC address that plays in VLC will also play on the ESP32. The library follows redirects (302) by itself, which is why the German public radio addresses in the code work without trouble.

FormatBitrateData per secondNote
MP3128 kbps16 KBThe most compatible option
MP3320 kbps40 KBDrops out often without PSRAM
AAC / HE-AAC48–64 kbps6–8 KBIdeal for weak Wi-Fi, sounds surprisingly good
FLAC700–1000 kbps90–125 KBNeeds PSRAM and strong Wi-Fi
HTTPS streamVariesSameEncryption costs about 40 KB of extra RAM

Station name and song info on the OLED

Most stations announce their name in the icy-name header at the start of the connection and embed the current song at regular intervals in the stream as a StreamTitle in the form "Artist - Title". The library picks out this information and passes it to the functions in our code. Since song titles often contain accented letters, the code uses U8g2's drawUTF8() function with the u8g2_font_6x13_te font, which has an extended character set. The default font of Adafruit GFX cannot show these letters. Some stations send no song information; in that case only the station name stays on the screen.

0.96 inch I2C OLED display
0.96 inch I2C OLED: in the radio it shows the station number, volume, station name, current song and how full the buffer is.

Stream dropouts: causes and fixes

SymptomLikely causeFix
Short stutters every few secondsNo PSRAM, buffer holds half a secondUse a board with PSRAM; in 2.0.0 enlarge the RAM buffer with setBufsize
Stutters change from room to roomWeak Wi-Fi (RSSI worse than -70 dBm)Move closer to the router, use a board with an external antenna or a 64 kbps AAC station
The board resets when you turn it upBrownout: the amplifier draws current peaksAn adapter of at least 2 A and 470–1000 µF on VIN
Sound breaks up when a button is pressed or the screen refreshesSomething in loop() is waitingAvoid delay(), redraw the screen only on changes
The stream goes silent after minutes or hoursThe server closed the connection or Wi-Fi droppedReconnect with isRunning(), use WiFi.setSleep(false)
Info scrolls in the Serial Monitor but there is no soundBCLK and LRC swapped or SD pin on GNDCheck the wiring table, leave SD unconnected
"PSRAM not found" appearsPSRAM disabled in the IDE or no PSRAM on the boardEnable Tools > PSRAM or switch to version 2.0.0
Constant crackling and humLong wires, no common ground, weak supplyShorten wires, join all grounds, add a capacitor
The buffer bar on the screen tells you where the problem lies. If it slowly sinks towards zero, data arrives more slowly than it is played: the problem is Wi-Fi or the bitrate. If the sound stutters while the bar is full, the problem is on the output side: check the power supply, the wiring and any waiting code in loop().

Project ideas for your ESP32 internet radio

  • Retro radio: fit the ESP32 into the case of an old valve radio from a flea market and replace the original knob with a rotary encoder for volume and station selection.
  • Clock radio: get the time from the internet with NTP and start your favourite station in the morning with slowly rising volume.
  • Stereo radio: connect two MAX98357A boards to the same I2S bus and use the SD pins to set one to left and one to right.
  • Radio with a web interface: control stations and volume from a page on your phone and store the station list in the ESP32's memory instead of the code.
  • Remote-controlled radio: with an IR receiver, map the buttons of an old TV remote to your stations.
  • Offline music: for places without Wi-Fi, add a second mode that plays MP3 files from a microSD card with the DFPlayer Mini.

An ESP32 internet radio brings Wi-Fi, audio and a display together in one project; it is fun to build and gets used every day afterwards, and a board with PSRAM plus a solid power supply is half the battle. If you want to try the Wi-Fi connection, OLED and button parts of this project on their own first, the BlueGrays app has projects such as the ESP32 Wi-Fi connection, the weather display on an OLED and playing a melody with a buzzer, step by step with circuit diagrams and ready-to-use code.

Frequently asked questions

What parts do you need for an ESP32 internet radio?

An ESP32 with PSRAM (WROVER or ESP32-S3), a MAX98357A I2S amplifier module, a 4–8 Ω 3 W speaker and a 5 V adapter that delivers at least 2 A are enough. Add push buttons to change stations and a 0.96 inch OLED to show the station name.

Does an ESP32 internet radio need PSRAM?

The current version of the ESP32-audioI2S library does not work without PSRAM at all. On a board without PSRAM the radio plays with the old 2.0.0 version, but because the buffer only bridges half a second, every short Wi-Fi pause interrupts the sound.

Why does my ESP32 radio stream keep cutting out?

The most common causes are a tiny buffer without PSRAM, a weak Wi-Fi signal, the supply voltage sagging when the amplifier draws current, and waiting code in loop(). Using WiFi.setSleep(false), a board with PSRAM, a strong adapter and a capacitor on VIN fixes most dropouts.

What speaker works with the MAX98357A?

The MAX98357A works with speakers between 4 and 8 Ω and delivers about 3.2 W into 4 Ω at 5 V. Connect the speaker directly to the module's + and − outputs; neither of these outputs may be connected to GND.

Can you build a stereo internet radio with an ESP32?

Yes. Connect two MAX98357A modules to the same BCLK, LRC and DIN lines and set their SD pins with resistors so that one plays the left and the other the right channel. Alternatively, use a stereo I2S DAC such as the PCM5102A and feed its output to a ready-made amplifier.

How do I find a radio station's stream URL?

Download the station's .m3u or .pls file and open it in a text editor; the http address inside is the stream URL. Open databases such as Radio Browser also list direct addresses, and the safest approach is to test an address in VLC before adding it to the code.

See all projects
ESP32 Wi-Fi STA Connection (with LCD Screen)
ES-25Advanced

ESP32 Wi-Fi STA Connection (with LCD Screen)

In this project, we connect the ESP32 to the home Wi-Fi network in Station (STA) mode in a secure, fault-tolerant manner. We store the SSID and password in a separate secrets.h file to prevent leaking to Git, set up an auto-reconnect mechanism, and display the RSSI signal level and IP address on an I2C LCD screen. The internal LED works as a status indicator. It is a production-grade connection manager.

4.4(21)
40
ESP32 Melody Playback with Buzzer
ES-12Beginner
Premium

ESP32 Melody Playback with Buzzer

Playing a simple melody (Twinkle Twinkle Little Star) with a passive buzzer. We play notes with tone() and noTone() functions like in Arduino - ESP32 works with the same syntax as Arduino Core 3.0+. Passive buzzer must be used (active buzzer does not play melody).

4.8(31)
55
ESP32 HTTPClient + Weather API (with SSD1306 OLED Display)
ES-32Advanced
Premium

ESP32 HTTPClient + Weather API (with SSD1306 OLED Display)

In this project the ESP32 makes a REST API call over the internet to a weather API (wttr.in) using HTTPClient.h. Unlike the I2C LCD version, it uses an SSD1306 OLED (128×64) display, with large text and vector icons for a richer look. Seven weather icons (sunny, rainy, snowy and more) are drawn on the fly, with no bitmap files.

4.3(10)
22
Real-Time Clock from the Internet via ESP32 NTP
ES-26Advanced
Premium

Real-Time Clock from the Internet via ESP32 NTP

The ESP32 connects to Wi-Fi and fetches the real time from NTP (Network Time Protocol) servers with millisecond precision. configTzTime() applies the Turkey time zone (TRT, UTC+3) automatically, and in countries with daylight saving time the DST switch is handled by a POSIX TZ string. The time is printed both to the Serial Monitor and to an optional I2C LCD.

4.5(13)
22
ESP32 Asynchronous Web Server (with IP Display on LCD)
ES-27Advanced

ESP32 Asynchronous Web Server (with IP Display on LCD)

In this project, we’re turning the ESP32 into an asynchronous web server that you can control from your phone or computer on the same Wi-Fi network. Thanks to the ESPAsyncWebServer library, the server can process multiple requests simultaneously (unlike the classic WebServer.h, which blocks on a single request). You’ll be able to open the ESP32’s IP address in a browser and click the ON/OFF buttons (the /on and /off routes) to turn the LED connected to GPIO 5 on and off.

4.8(16)
27
ESP32 IR Universal Remote (IR Receiver + Remote Control + 3 LEDs + Buzzer + OLED)
ES-39Advanced
Premium

ESP32 IR Universal Remote (IR Receiver + Remote Control + 3 LEDs + Buzzer + OLED)

Read a ready-made IR remote with the ESP32 and control your own device! The infrared receiver (NEC protocol, 38kHz) captures the signals of a 20-key remote: keys 1/2/3 toggle three separate LEDs and PWR turns them all off. Press an unknown key and the OLED shows its HEX code, so you can easily add your own remote's buttons to the code.

4.5(9)
16
ESP32 LED Brightness Control with a Potentiometer (Analog → PWM)
ES-13Intermediate
Premium

ESP32 LED Brightness Control with a Potentiometer (Analog → PWM)

In this project, we control the brightness of an LED analogically using a potentiometer. The ESP32's ADC pin reads the 0-3.3V voltage from the potentiometer, and this value is then converted into a PWM (Pulse Width Modulation) signal and sent to the LED. As a result, as you turn the potentiometer, the LED gradually brightens and dims. With Arduino Core 3.0+, analogWrite() can be used directly; on the ESP32-S2/S3, the ADC resolution is fixed at 12-bit.

4.4(20)
32
ESP32 LED Control with Push Button (Push)
ES-2Beginner

ESP32 LED Control with Push Button (Push)

The LED lights up when the button is pressed and turns off when released. Shows how the ESP32's digital input pin and internal pull-up resistor are used. The INPUT_PULLUP mode eliminates the need for an external resistor.

4.6(36)
57