HarrisonMauseth / network-connectivity-monitor

0 stars 0 forks source link

Network Connectivity Monitor

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:

Project Inspiration

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.

Key Features

1. Wi-Fi Event Handling

2. Memory Management and Log Handling

3. API Communication

4. Backend API and Database Integration

5. Time Synchronization

Technologies and Tools Used

Setup Instructions

  1. ESP32 Setup:

    • Clone the ESP32 project and deploy it using PlatformIO or Arduino IDE.
    • Ensure the credentials.h file contains the correct WiFi SSID, password, and API endpoint.
  2. Java API Setup:

    • Deploy the Spring Boot web API on a Raspberry Pi with a reserved DHCP IP.
    • Configure PostgreSQL and ensure the database is accessible by the API.
  3. Testing:

    • Run integration tests on the server-side API to ensure proper communication with the PostgreSQL database.

What I Learned

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!