When considering different APIs, I wanted to use one that was different from everybody else's. I felt as if the city APIs were quite boring and the COVID would've been unoriginal. So with that in mind, I decided to go for something out of this world. Literally. NASA has multiple APIs to choose from, ranging from Astronomy pictures to Mars weather, which is what I decided to go with.
What I had in mind, was to create some sort of makeshift thermometer that was able to display Mars Pressure on a given day.
Design ProcessThe idea was that when the pressure went up, the little picture of Mars would go up, and when the pressure went down, the picture of Mars would go down too. With that design in mind, I had to figure out how to power that moves up and down. That's when I thought of creating a conveyor belt-like system that would allow for the simple movement of the picture.
Building ProcessThe building process was a complicated one. At first, I wanted to create the conveyor belt system using a tissue box or a small cardboard box but realized this was too flimsy and would likely fall apart. That's when discussing the project with my stepdad, he suggested using wooden parts instead to add stability. With the power tools, we cut a small wooden plank for a large piece of wood and made a thin incision in the middle for the clipboard we would use to hold the servo motor and the two wheels. After that with 8 smaller wooden blocks, we secured the clipboard to the wooden plank and made a hole in the clipboard for the servo motor. Once that was done, we then added the second wheel at the top, secured it with a washer and a wooden stick, and then added our string, which came from dollar tree lanyards.
API SetupAs soon as I opened the API and the JSON Object, I knew I had run into trouble. Firstly, it was incredibly long. Multiple objects and I had trouble identifying the pressure data. Fortunately, I was able to get the Pressure data by using the "{{{770.PRE.av}}}" response template. Day followed by the key phrases for pressure and average. However, I wanted to get the pressure for the most recent day, not the day I manually inputted. Yet this was not possible.
Attempt no. 1The first attempt to get around the limitation was by setting up a second webhook to get the specific day on Mars.
The logic behind this was that if we could get the most recent Mars day automatically, then we wouldn't have to get manually input it into the marsPressure webhook response template. At first, it worked, the webhook response was able to successfully pull the most recent day from the JSON object. However, it was not possible to feed this data into the marsPressure webhook response.
The second attempt at getting around the limitation was deserializing the JSON object. However, this won't work because it's so long. Trying to create a response template for it doesn't work because you can't access the latest sol key using URL parameters.
What would I do differently?Firstly, I wish I had a cleaner design. Everything is multicolored, from the wheel to the string, and I wish it was all a uniform color. Secondly, I would've tried to get a servo motor that can move a full 360 degrees as opposed to just 180 degrees. And lastly, I wished I would've asked for help on this earlier. The is probably a fix to this or some sort of way of getting the most recent information that I'm massively overlooking. However, I still enjoyed the project and got to visualize some data at the very least.
Comments