Skip to main content
Forrest O. Interactive

Week 11. Networking and Communications

Web Radio

One of my final project ideas was a web radio with token bookmarks to streams and playlists. For this week I wanted to see if I could get the web stream → ESP → I2S → speaker part working in an afternoon.

Web radio on a breadboard.

Using XIAO ESP32C3, Adafruit max98357 I2S mono amp, and lofi speaker.

There was contention on the XIAO forum if XIAO ESP32C3 supports I2S, but it seems to work without any audio issues. I started from the arduino-audio-tools' streams-url_mp3_helix-i2s example. The only trick to get it working was to configure the I2S pins correctly.

// LRC
config.pin_ws = D0;
// BCLK
config.pin_bck = D1;
// DIN
config.pin_data = D2; 

Using the arduino-audio-tools library feels like cheating a bit, since it abstracts away most of the networking.

I'm struck how much can be done these days with off-the-shelf breakout board components, without needing to do circuit design or fabrication. This wall plotter has clever software and case design, but most of the electronics are stock boards.

The audio streaming and decoding takes 90% of the XIAO ESP32C3's memory, so if I want to add NFC reading to the project I might have to use a microcontroller with more memory, or move to an external mp3 decoding board like the VS1053.

Jeopardy answer: IT'S BELIEVED THAT IN 1994 WXYC IN CHAPEL HILL IN THIS STATE BECAME THE FIRST RADIO STATION TO WEBCAST

(That's a funny answer if the question is "what is North Carolina?" but ok.)

I set up the radio to play my alma mater's college radio station, WXYC. The UNC school of library science hosts serveral North Carolina public radio station streams with a directory at ibiblio.org. If I continue the audio player project I'll make tokens for some of these.

Arduino audio libraries

Group Work

XIAO boards for WIFI communication.

Wireless Networking with XIAO ESP32C3.

We looked at the board design and programming to make two boards that can communicate over wifi. Pressing a button on one board sends a request that vibrates the other board.

server.on("/on", HTTP_GET, [](AsyncWebServerRequest *request) {
  localState = true;
  updateFromLocalState();
  request->send(200, "application/json", "OK");
});

server.on("/off", HTTP_GET, [](AsyncWebServerRequest *request) {
  localState = false;
  updateFromLocalState();
  request->send(200, "application/json", "OK");
});

A server that takes requests for /on and /off to toggle a vibration buzzer on the board.

The server code looks quite familiar to me, compared to basic web servers written in Node.

Networking libraries

Machine week planning

For the machine building week, we're planning a distributed project with Turkey. I'll be doing some UI work that takes websocket messages from a 6dof stylus controller, shows a simulation of the x/y/z gantry machine, and sends WebSerial messages to the machine.

Final project progress

Ported my Blender simulation to the web for added interactivity.