This is a small project I did for the Mechatronics class i’m taking this semester. I used an ESP32. It’s a microcontroller with WiFi, Bluetooth, and two cores with allows me to create threads. The goal of the project was to use an ESP32 to control the brightness of three individual LEDs using PWM and Python to deploy an HTML page accessed over wifi.
How? Well, first I needed to connect it to WiFi, obviously. It was easy. I just used python’s WiFi library. Then, I had to set up a socket. That allows for communication between the client and the server. For this project, we had to use TCP as the message protocol and an IPv4 socket. Once a connection was accepted, the client (me) was able to send POST requests to the server (ESP32). My code would then read that data and change the state of a a single or multiple LEDs and update the webpage. It would keep doing that for as long as there was an Internet connection
WiFi
Socket using TCP
Listen for any connections
Accept Connection
Client sends POST request
Read Data and Update Web Page
Repeat Step 3
Yes, so what? That wasn’t very impressive. I agree! It wasn’t supposed to be. This project isn’t my favorite because it’s impressive. It’s my favorite because it taught me about something I didn’t know before but I was curious about. Ever since I got into computer science, I wanted to understand more about how computers communicate between themselves. Here I learned one type of communication but there are still many more I could learn about.
Now that I have more knowledge about the ESP and communication protocols I can work on harder projects.
Maybe an autonomous garden with sensors and actuators that I can control over the internet.
Maybe a whole smart home system controlled with multiple ESP’s that can communicate between themselves.
Or maybe a compact and widely compatible kit that can transform existing vehicles into fully self-driving vehicles…