2 years ago

Location-tracking mountain model project

When Kurt Hunter wanted to create a smart 3D model to show family and colleagues his progress while climbing Mount Kilimanjaro, he turned to the Raspberry Pi

An LED lights up on a scale model placed on a kitchen counter in Washington State, USA, to signify that over 9,000 miles away in Tanzania, Kurt Hunter has reached the summit of Mount Kilimanjaro. Climbing Africa’s highest peak had been a long-held ambition for Kurt. “Ever since moving to Seattle 20 years ago, I would look up at Mount Rainier and dream of climbing it,” he tells us. “After getting myself in shape in 2004, I did indeed climb it and got hooked on climbing. That year I set a goal of climbing Kilimanjaro, but never got around to it until [2015].”

The full article can be found in The MagPi 42

Mount Kilimanjaro from a distance

Mount Kilimanjaro from a distance

In preparing for the two-week expedition, Kurt set himself another challenge. He wanted to combine his passion for 3D printing and programming in an interesting way, to enable his family and co-workers to follow along with his climb in a fun, visual experience. To this end, he set about creating a Raspberry Pi 2-powered 1:100,000 scale model of Kilimanjaro, complete with LEDs to mark the spots of all his planned camps, along with the summit itself. The location data would be supplied by a personal GPS locator device, via his own RainOn web-based tracking solution.

Model making

Kurt spent a weekend designing the 3D model in the Blender CAD program, using accurate elevation data for Kilimanjaro gleaned from Viewfinder Panoramas – with some extra tips from All’s Well That Prints Well – and calculating the physical offsets for the surface holes required for the LEDs. The model needed to be tall enough to contain the Raspberry Pi, mounted on a removable base panel, and include cut-outs for its power and Ethernet connections (via extension cables). The final 150×150mm model was then 3D printed using a PrintrBot Metal Simple, a process that took 26.5 hours to complete.

The printed out model

The printed out model

Once the support scaffolding was removed to hollow out the model, it was time to wire it up. “The biggest labour component was soldering up the individual LEDs and resistors to the GPIO ribbon cable,” reveals Kurt. “The LEDs are held in place on the model by friction and silicon sealant.” While he didn’t encounter any major problems getting it working, since he’d already made a simple prototype with a breadboard, Kurt did discover a difference between the GPIO pin assignments on Windows IoT Core and Raspbian.

Trip tracking

When developing the Pi code for the project, Kurt was keen to evolve the RainOn Adventure Tech (rainon.com) web-based tracking system he’d developed for previous adventures as a Microsoft Azure solution. “Essentially, the system acquires real-time location data from a personal locator device, such as DeLorme inReach or SPOT, for a provisioned ‘trip’ like the Kilimanjaro expedition. It then provides geofence-based waypoint proximity notifications, among other features.”

Mapping out the route

Mapping out the route

Each trip is a combination of an objective (typically the latitude/longitude of a mountain summit), a route (which can include a list of waypoints), and a start and end date/time. “The system polls the services of the personal locator manufacturer and retrieves the last reported location for each device assigned to an active trip. That retrieved location is tested against the geofence for each of the registered set of waypoints associated with the trip.”

The trips and waypoint information are created in advance. “For example, Kilimanjaro using the Machame Route that we climbed has six camps (in fixed locations) and the summit, plus the start and end locations, so that trip has nine associated waypoints, seven of which are on my 3D model. All of the data is stored in a SQL Server database which also supports spatial data, so geofence tests and other geospatial calculations are super easy.”

Coding the Pi

When it came to programming the Raspberry Pi to process the location data, Kurt ended up using the Windows 10 IoT Core operating system. As a senior partner engagement manager in his day job at Microsoft, Kurt was already well versed in Windows and its Visual Studio developer tools. Even so, he tells us he also developed a Python version of the code under Raspbian, but found the Windows 10 IoT Core / Visual Studio route much easier. “Three things were very attractive about using Windows 10 IoT Core: 1) Visual Studio is awesome (and familiar), 2) I could develop in C#, and 3) the remote debugging/deployment was super easy to set up and use.”

Based largely on Microsoft’s Blinky example code, Kurt’s program calls the RainOn Azure service API every ten minutes to obtain JSON location data. If this is within a geofence, set at a 200m radius, for one of the camps or the summit, the corresponding LED is lit.

Testing it out

To check everything was working properly before leaving for Tanzania, Kurt used the Postman test tool to call on his RainOn APIs and simulate data from the personal locator device. “I also use Google Earth quite a bit to find the lat/long of various places and measure distances. So I tested the system by sending simulated locations near the waypoints. When I first developed the geofence/waypoint feature, I did actually use local locations and drive around in my car with the device to test it.”

The model lit up the way it should do as Kurt reached each way point

The model lit up the way it should do as Kurt reached each way point

When it came to the actual Kilimanjaro climb, everything worked, although Kurt admits he could have used more error checking and recovery. “The system worked in real-time and the waypoint LEDs stay lit after I had reached that location. However, if the power went out then only future waypoints would light up, as I didn’t store the previously reached waypoints in the Pi, nor did I report the history in my web APIs. So, sometime between camp three and four, this happened to the setup I had in my office window, but the one at home worked for the whole climb.”

Always another mountain

Kurt admits that a few shortcuts and compromises had to be made in the last-minute rush to get the project completed in time for the Kilimanjaro trip. Given more time, Kurt says he would have liked to use the Pi’s HDMI output to provide an animated map view and real-time data and graph displays. He plans to make improvements to the system for future expeditions. “I would very much like to figure out a way to show more discrete climbing progress on the model, rather than a single LED per day. I’ve thought about a number of ways that I’ve found to be impractical: light pipe projector from an LCD panel, laser, tight string of tiny LEDs… I’m looking for an idea!”

As for the experience of climbing Kilimanjaro, Kurt tells us it was awesome. “The climb itself takes seven days and you hike through four climatic zones before reaching the summit: rainforest, heather and moorland, alpine desert, and finally arctic above 5,000m – the summit is 5,895m. It’s really quite amazing and the local staff make the experience so enjoyable. Every afternoon, when we reached camp, the staff would sing and dance with us… The view from the summit is spectacular as you arrive at sunrise, well above the clouds, and can see for miles and miles.”

A successful climb

A successful climb