This project is built around an ESP32 microcontroller that logs network events and interacts with a custom backend server hosted on a Raspberry Pi. With a PostgreSQL database handling the logs, and a Java-based REST API bridging the communication, it provides detailed tracking of network connectivity issues over time. The idea is to spot problems and have data to back up claims when troubleshooting.
For more details, you can jump to the following sections:
In September of 2024, I was experiencing some network connectivity issues after my internet service provider rolled and out a new Wi-Fi 7 system in my city. The first few weeks were a bit of a nightmare with frequent loss of signal and repeated timeouts from the VPN used for work. Sure, I could have always just spent my own money to get my own mesh network, but I had a perfectly working system prior to the mandatory upgrade and wasn't in a place where I could justify the cost. So I started a google sheet where I would manually log this information.
While the sheet was useful in proving to the customer service team that it was an issue on their end and not on my end, it became obvious that this was not going to be a quick solution. When the ISP sent a technician out to my house, he made it clear that while he has faith the company would eventually iron out their issues, there was no way he could move me back on to my old system and that I'd have to either spend money I didn't have or be patient. So I did what any software developer would do and thought "I could easily automate this process over the weekend" and this project was born.
SYSTEM_EVENT_STA_CONNECTED
) and disconnection (SYSTEM_EVENT_STA_DISCONNECTED
) events. Upon disconnection, a log is generated with the exact downtime, and reconnection triggers a "reconnect" log.8.8.8.8
is sent out to verify that the internet is still connected. Additionally, if a Wi-Fi disconnect event occurs, the system will send a ping to check upon reconnect. To prevent excessive pings, a failed ping needs to wait at least 15 seconds before attempting again.std::list<String>
. Logs contain:
true
or false
).ArduinoJson
to ensure the ESP32 can process a large number of events without exceeding memory limits.pool.ntp.org
) to ensure accurate timestamps for event logs. Logs generated before time synchronization are discarded to prevent invalid timestamps.ArduinoJson
(for JSON serialization)ESP32 Setup:
credentials.h
file contains the correct WiFi SSID, password, and API endpoint.Java API Setup:
Testing:
While there are a lot of aspects to this project that were familiar, there was certainly some new aspects for me as well. First of all, deploying to a Raspberry Pi for the first time took me well outside of my comfort zone in the best way. This proved to be the trickiest part of the entire process simply due to having so many ways to approach it, which was exactly why I was excited. In the process, I had to learn a number of new skills which include, but are not limited to, setting up environment variables in Linux, creating PostgreSQL users on Linux (which is slightly different from doing it on Windows), granting permissions and modifying privileges, and setting up a systemctl
service to make sure the server automatically stars up after a power failure.
All of that directly feeds into the second major learning moment for me: deploying Spring Boot projects in IntelliJ. While I can't say for certain that my approach is the most efficient, it certainly was the one that worked. In a self-taught environment, you don't get the luxury of having code reviews to learn from your peers. You have to make executive decisions and go with them. For me, this meant creating a Tomcat Servlet and adding the ability to export as a .war
file. This took a lot of troubleshooting to get my settings right. And while I'd love to nerd out on this topic, I have kept these changes offline for peace of mind.
The last thing I learned is that I'm either getting better at estimating how long a project will take me, I'm getting faster at developing projects, or, most likely, a combination of both. When I started out, I felt pretty confident that I could get this knocked out in an afternoon. But it's not my first rodeo. The part of me that wasn't speaking from a place of pure excitement said that it would be closer to about a week. I split the difference and convinced myself (and anyone who was around) that it was a going to be my weekend project. Either way, it felt great knowing that I could have an idea, set myself a schedule, and actually accomplish my goals in that time. It might not be a technology, but self awareness is still an important part of the creative process!