Building a wrapper for a (not that good) locker system
Tags: octograd2020
Published: 2020-05-22 21:14:08

## My school research project

The last big project I started whilst being a student was a wrapper for the locker system for my school. It was for a school research project, I worked on it with 2 of my friends..

Well, I wrote the code, and they did most of the boring stuff for in the document. The most important part was creating the research paper, not the product you've created. 

We have electronic lockers at our school, you can scan your RFID badge to open it, or use the included web app. That web app consists of a button, press it, your locker is unlocked for 20 seconds. That's all. Works 'okay' but nothing impressive. The biggest problem was the WiFi network at school, it was unreliable, so opening your locker via the web app was too. Too many users on one access-point. 
 
So, what did we do? Trying to get school to put up more access-points might sound like a logical approach, and probably would be. It'd increase WiFi reliability and make the online locker system usable, since the locker system was only accessible via the school WiFi.

We didn't ask school to put up more access-points, that made waaay to much sense and would be a pretty boring research paper. We hooked up a Raspberry Pi 1b (that was the best I had, the alternative was a Pi zero) to the school network via a network cable. The problems with reliability were solved, it worked great all the time. 

So the next step was to create a better functioning web-app, that works via 4G/LTE. We connected the Raspberry Pi to my OpenVPN server and installed Raspbian, Nginx and PHP on the Pi. I wrote some simple PHP code to send some requests to the locker API we've reverse engineered. That worked, I could send some requests from 4G to the locker system via the OpenVPN connection. On the server that ran the OpenVPN server we setup Nginx to proxy the requests. We could now access the locker system from everywhere we wanted, so we started building the webapp.

It was a simple webapp, white background, no flashy colors. Fine, it works, it gets the job done. We've created a system to link your locker to our system (with the reverse engineered endpoints) and voila, the basics worked. I could now open my locker via 4G, reliably.

That was fun, and a pretty cool milestone. But it didn't feel like enough for the research paper, since this research paper was the most important research paper of my entire school career. 

We built some systems to share lockers with other users and give them nicknames, to distinguish our webapp from the simple unreliable webapp that came included with the electronic locker system, and that was it for the coding part. We wrote about 45-50 pages about how it worked in detail, and some research we did on RFID and bypassing the anti VPN restrictions my school put in place. It was fun working on it, and definitely nice to see other students using the system and sharing positive experiences!

### Screenshots
![Screenshot of the locker open page containing a circular open button, the nickname of the locker and the ID](https://i.imgur.com/ZPtf0xW.png)
![The manage locker page where you can share your locker with other users](https://i.imgur.com/662dlrV.png)