Week 11: Networking and Communications

Assignment and Idea:

For this assignment, we were asked to build a wired or wireless node(s) with network or bus address and local input or output devices. One of my goals for this course was to learn how to control a networked device that I built via a web browser; I thought this would also fit nicely with being able to potentially control output sound manually on my final project. I decided that a good proof of concept would be to remotely blink an LED on the ESP32 mounted on my own board, fabricated and tested in week 6: Week 6: Electronics Production

Final Soldered Board

A lightweight approach to do this would be to use web sockets. I found this page to be a very helpful guide:

https://randomnerdtutorials.com/esp32-websocket-server-arduino/#1

I started by adding the web serial library and followed by downloading the ESPAsyncWebServer library and the AsyncTCP library outlined in the documentation. I added these new files using the “add .zip library” option in the IDE:

Adding Libraries in IDE ESPAsyncWebServer and AsyncTCP Library

I pasted in the sample code and updated it to connect to my wifi via the SSID and password placeholders, and voila, it appears on my network with a local IP address:

ESP32 Connected to Network

The sample code was written for a different ESP32 board and called for a pin. Since I wanted to test an LED mounted on the XIAO, I needed to adjust the code to use the LED_BUILTIN constant, along with some updates to the text to adapt it for my final project.

I was able to upload the new code and it looked great and worked exactly as expected:

Web Interface with Toggle Button LED On

I acknowledge the sample code provided by Rui Santos, the help and support of The MIT EECS staff, particularly Anthony Pennes, in thinking through the steps required to do this assignment simply, and ChatGPT 3.5, which helped me take text and images from the native OS X text editor I used to quickly document on my Mac into simple HTML for my git repo.

Updated June 8, 2024