Solar Car GPS Tracker
This is a quick post about a small project that I made for the PRISUM Solar Car Club here at Iowa State.
Every other summer our team competes in the American Solar Challenge.
This competition consists of both a track race as well as a 1300 mile road race across the US seen above. The track race (FSGP) which includes safety scrutineering of the car as well as the American Solar Challenge road race are both about a week long leading to a very long two week competition.
As I could only get one week off from my internship I chose to attend the American Solar Challenge which means that I would have to sit and anxiously wait for updates from the team and completely out of the loop to what was happening live.
I then realized that our car's telemetry system, which is cellularly linked and connected to the internet wherever the car goes, outputs the latitude and longitude of the car live every second through its log files.
The problem was that there wasn't any good way to display that data and as the competition drew near many of my friends and family began asking where they could follow the competition.
This gave me the idea to make this tracker webpage so anyone in the world could see the live position and speed of our car.
The main aspect of this project uses a project called Leaflet.
Leaflet is an open source project for implementing custom maps into websites without the need for embedds, iframes, or api keys. This seemed like the perfect use case for me and I began coding up the site.
Once I got the map readly and scaled correctly I made a basic theme with our team colors and used the official route data from the American Solar Challenge website in order to map a route along the map with checkpoints.
Next I had to handle the hard part which consisted of establishing a live connection to the car while keeping the webpage static which is needed for using Github pages.
I started this process by procrastinating the hard part and spending way to much time in Photoshop creating a clipart-esc sprite of our current solar car.
Finally I started on the live connection aspect and started implementing a websocket connection to the car. Unfortunately for me, our software team that made the telemetry page codes things extremely efficiently compressing all of the car's data output into illegible strings of bytes. While making the message size 20 times smaller this made rummaging through their code trying to understand it all 20 times harder.
In the end I was able to get the connection established to the car with my final bug-fix that got everything working being pushed to Github at 8:57am just three minutes before the competition started at 9:00.
With the tracker up and running there were many current members and alumni of the team as well as friends and family that were able to see the current status of the car with the GPS even being accurate enough for you to be able to roughly see the racing line on the track race.
Over the next several days of the competition I had nothing better to do but to make even more updates to the tracker. The final iteration included a terrain view button, live connection and speed status, and changing the direction the solar car icon faced based on the movement of the actual car.
And with that the project was more or less complete and I headed off to take part in the American Solar Challenge which ended up being a great experience!
If anyone is interested, the live webpage for the solar car is below. Whenever we test drive the car around campus it should connect and update the position live.
Finally, if anyone wants to see my horrid coding skills barely holding this whole project together the source code from the site and the repository its hosted out of is linked below.
This project was really fun to work on and I definitely learned a lot as coding projects are not something I often do. It was also really cool hearing from all the past alumni on the team, some of whom I've never met, talk about religiously stalking the page in an open tab at work for those two weeks.
Caden Kraft Newsletter
Join the newsletter to receive the latest updates in your inbox.