Microbit GPS to Ubidots - Kevin #5
Introduction
This week I moved on to working on getting a GPS value from our Microbit with the Xinabox xChips to Ubidots. I was in a team of two with my other classmate to get this working and it came with a lot of challenges. After last week trying to get the values up and down from Ubidots via the Xinabox xChips we learned that the xChips can be very ureliable and often will just stop working for a random amount of time and start working again, without changing any code on the Microbit. I plan on looking more into that at a later point, this week we want to get a proof of concept that the xChips can display GPS to Ubidots.
Microbit Makecode
The first thing we needed to design was the makecode to get the GPS value to return to Ubidots. We started by using the code we had previously worked on for sending and receiving a value from Ubidots and then added in the extension for the SN01 xChip. The SN01 xChip is a xChip that has time, GPS and speed tracking capability's. Making it an extremely useful xChip to have.
Once I brought in this extension I designed the code like the image shown below, I had to blur out the password for my wifi and my API token from Ubidots.
Issue's and Debugging
As with all things in the tech industry the code didn't work initially, the Microbit came up with 3 red dots, and nothing else happened, we were sitting inside and left it running for about 5 minutes hoping it would change. When nothing did, we turned to our good friend Google to figure out a solution to the problem.
We looked around for what the three dots on the Microbit lighting up meant, we found a document online that explains all the different lights on the Microbit when using the Xinabox xChips and discovered the three dots means Microbit system is busy. This was good news, it meant that the code was more than likely working and it was just trying to get a GPS signal but failing. I'll link the document here: https://drive.google.com/file/
We then tried just turning on one of the Microbits and leaving it running with the three dots to see if it would change. While this was running I did some more debugging on a different Microbit, seeing if I could adjust or change the code to get it working, or simplifying it to speed up the process, but nothing worked.
Into the Cold
Our next phase was to contact the Xinabox support, we sent off an email and they came back informing us that the GPS will only work if it is outside and not surrounded by any buildings.
Following learning this information we set off outside into the cold with our laptops and ran the code again. After many attempts, different iterations of the code and a lot of patience, it finally worked and printed out the latitude and longtitude onto the Microbit screen that I was working with. Then we put the code I was using onto my classmates microbit and after about 20 minutes of waiting, that worked aswell, we now had two working GPS signals on the microbits.
The next step was to change the code so that the GPS values would be transmitted to Ubidots, once this was done we had GPS values going from our microbit the whole way up to Ubidots.
Comments
Post a Comment