Week 10 - Networking and Communications

  • How do I WiFi?

    This week I was learning about how to use WiFi boards and communication mechanisms. I wanted to iterate on my final project boards, however, they are Xiao-RP-2040, which don't have a WiFi module. However, one of the other boards I worked on before - a parrot board - has ESP32-S3 microcontroller that supports WiFi. So I decided to experient on that one. More information about design of this board can be found on Week 4 and Week 5 pages.
    The main objective of the week was to experiment with WiFi module and understand how to send messages between my laptop and a board. I chose a simple project that iterates on my previous results on this board, to get that understanding.
    I decided to make an interface that would turn on or off respective RGB channels on the LED by controlling it from my laptop interface and sending signals over wifi.
    The image on the left is my resulting interface for the week. As you can see, it's super simple, with a few toggle buttons to send messages over wifi. Each of those buttons triggers an HTTP message being sent over wifi and received by the ESP32-S3.

  • Sounds good, but how?

    The main idea was to use WiFi.h library in Arduino IDE. Then you have to connect to an available WiFi (EECS_Labs had a very convenient open network which doesn't need duo authentication and other complicated systems like MIT Secure). Then I had to establish connection with the WiFi server and generate interface. Please find my code for the project here (ChatGPT does a pretty good job providing a basic version of the code if you don't want to go through all the documentation).
    I started with controlling just one LED channel, just a simple on/off system. As you see on the videos, there is an IP address that gets printed by the code (based on the established WiFi connection), and after that the idea is that the system gets controlled by the buttons.
    My first attempts were buggy for no good reason. As you see on the videos on the right, the website wasn't establishing connection, messages were not being sent every time, which I imagine was just the network issue, maybe board or my laptop not having good connection with the WiFi.

  • Debugging and combining RGB

    To deal with those bugs I was breaking down the code line by line, rerunning and reuploading the code, and making sure that just one LED channel works reliably and responsively through WiFi.
    There wasn't really much to debug in the code, but I had to make sure that the board is connected to the WiFi and that the IP address is correct. I also had to make sure that the board is connected to the right pins and that the pins are working.
    After that, I added two more channels to the interface. Because all the channels can be triggered separately, I can trigger different colors. So Blue+Red+Green is White for example, Blue+Red is Purple, and so on.
    The second video illustrates the final system after adding two more channels, showing how the system can respond to all the buttons in real time and generate combined colored LED.

  • Conclusions

    This week had a lot of learning about how to use WiFi and how to send messages over it. I also learned how to use the WiFi.h library in Arduino IDE, and how to establish connection with the WiFi server and generate interface. I also learned how to debug the system and how to combine different channels to generate different colors.
    As usual, thanks to Anthony, ChatGPT and Github Copilot for helping me!
    Source code can be found here.
    Future work would be controlling microphone and speaker over WiFi.

Go to the top