Close
0%
0%

Backcountry Beacon

USB Powered Offline Map Server

Similar projects worth following
Picture this: you’ve just arrived at the trailhead, miles from civilization, and your phone’s map app decides it’s time for a little “offline mode” tantrum. App Status? Offloaded. Updates? Forget it. Storage? Full. Welcome to the outdoors, where your phone is more lost than you are.

Enter Backcountry Beacon, the open-source gadget that laughs in the face of Wi-Fi dependency. It’s preloaded with detailed USGS topography maps that don’t need any updates, a reliable GPS that knows exactly where you are, and a simple file server where you can store anything you might need on the trail—whether it’s knot-tying guides, plant identification resources, or even audiobooks from those classic naturalists who really knew their stuff.

Backcountry Beacon is compact, ready to be powered by any USB A supply while you’re out chasing sunsets and scaring squirrels off your food bag.

Features:

  • Offline Maps & GPS: Navigate with confidence using USGS topo maps and hardware GPS, all without an internet connection.
  • Custom File Server: Upload your own trail essentials—knot guides, plant IDs, audiobooks, you name it—and access them anytime.
  • Portable & USB-Powered: Small enough to toss in your pack, and powered by a simple USB-A connection, so you can keep going as long as your battery lasts.
  • Easy Connection: Hosts a Wi-Fi access point with a QR code, making it easy to connect and access your maps and files.

Limitations:

  • Speed Limits: With server I/O capped at around 1MBPS, you might need to pack a little patience along with your gear. This device isn’t winning any speed races.
  • No Concurrency Champs Here: While multiple connections are fine, don’t expect it to juggle multiple file requests at once. One at a time, please— besides, whats your rush out here?
  • DIY File Loading: You’ll need to load your own files and topo maps onto the device, so make sure you’re prepped before hitting the trail

Please check out the git repo for project details

  • GIT REPO NOW PUBLIC

    Brett Smith09/02/2024 at 04:56 0 comments

    Sorry for the oversite, Github makes repository private by default: https://github.com/diyaquanauts/BackcountryBeacon

  • A simple task manager

    Brett Smith08/26/2024 at 09:23 0 comments

    This project brings in FunctionTimer—maybe the simplest task manager ever use for Arduino. It's designed to schedule repetitive tasks effortlessly, and honestly I find myself copying it into most Arduino projects.


    Essentially, all this library does is check how much time has elapsed since the last time it ran. If the correct amount of time has run, it runs the function again. We're basically just

    if ( millis() - last > schedulePeriod){
        last = mills();
        runFunction();
    }

    Only now I have a built up class for it! This is the whole class:

    class FunctionTimer{
    public:
        void (* func_ptr)();
        int update_time;
        int last;
        FunctionTimer(void (* _func_ptr)(), int _update_time){
            func_ptr = _func_ptr;
            update_time = _update_time;
            last = 0;
        }
    
        void service() {
            if ((millis() - last) > update_time) {
                func_ptr();
                last = millis();
            }
        }
    };

    In our project, FunctionTimer helps us keep track of various tasks that need to run at different intervals. Here’s what we’re doing with it:

    • Turning off the display after a period of inactivity
    • Monitoring ISR flags for our user button
    • Disconnecting stale server connections
    • Parsing GPS data regularly

    Here’s how simple it is to implement:

    FunctionTimer screenMonitor(checkIfScreenInactive, 10000);
    FunctionTimer buttonMonitor(buttonHandler, 100);
    FunctionTimer heapMonitor(logHeap, 10000);
    FunctionTimer connectionMonitor(&checkForStaleConnections, 1000);
    FunctionTimer gpsReader(readGPS, 1000); 
    
    void loop() {
        connectionMonitor.service();
        heapMonitor.service();
        gpsReader.service();
        buttonMonitor.service();
        screenMonitor.service();
        vTaskDelay(1); // Yield to the scheduler
    }
    

    One key point: functions triggered by the timer can block others, potentially delaying critical tasks, especially in Arduino's single-threaded environment. To avoid this, it's essential to ensure that functions are quick and non-blocking.

    You can dig deeper into this little helper here: https://github.com/diyaquanauts/BackcountryBeacon/tree/main/firmware/include

  • Resource monitoring with 'express-like' middlewares

    Brett Smith08/26/2024 at 08:53 0 comments

    This project uses the ESPAsyncWebServer to implement all of its server functions. Its a truly wonderful library and is incredibly powerful. 

    However, after doing a few years of node + express + react programming, I found myself yearning for express-like middlewares. Rather than have to add redundant logic in each route manually for the webserver, I wanted to be able to declare a 'middleware' that would run for every request. So I created a small library to try it out!

    For example, our esp32 server can really only handle one request at a time. Anything more, and the heap seems to leak, or watchdog timers timeout.

    We can now create a middleware to send a 503 code if our server resources our low. This also prevents the esp32 from trying to process too many requests at once.

    CREATE_MIDDLEWARE(monitorResources, {
        size_t freeHeap = ESP.getFreeHeap();
        const size_t criticalHeapThreshold = 170000;     
            if (freeHeap < criticalHeapThreshold) {
                Serial.printf("Free Heap: %u bytes. Sending 503\n", freeHeap);
                request->send(503, "text/plain", "Service Unavailable: Low Memory, Please Try Again Later");
                return;
        }
    
        next();
    });

    And then later in our code we can literally:

    AsyncWebServer server(80);
    MiddlewareHandler app(server);
    ...
    app.use(monitorResources);

    This seems to be working well! And I am pretty happy with it!

    However, the library does violoate one my rules for firmware: minimize/eliminate dynamic memory.

    If ever there was a time to not get fancy, and just hard code routes, on a tiny microcontroller seems like the time.

    You can learn more about the library here: https://github.com/diyaquanauts/BackcountryBeacon/tree/main/firmware/include

    Better yet, suggest a better alternative method!

  • USGS Topo Tile Cache Explorer

    Brett Smith08/26/2024 at 08:35 0 comments

    A big part of the project is determining what map tiles need to be downloaded for any given state.

    Computing what tiles are needed is actually rather computationally expensive.

    Essentially, we create a bounding box for the geojson polygon that contains the state outline. Then we iterate through through the tiles at the bounding for every zoom level (until zoom level 9) to build the list of required map tiles for the state. After zoom level 9, we assume that every tile below the current calculated tiles need to be included.

    You can see and explore the outcome of this process here on the state of Hawaii: https://cache-explorer.netlify.app/

    We can really only show to zoom level 12 on the netlify app, as bigger zoom levels make the cache file hundreds of megabytes.

    This could be because the required maps are saved in JSON, which is intuitive but not space efficient:

    {
     "12": {
       "456": [789, 790, 791],
       "457": [789, 790]
     },
     "13": {
       "912": [345, 346],
       "913": [345]
     }
    }
    You can learn more about this process here:
    https://github.com/diyaquanauts/BackcountryBeacon/tree/main/tileDownloader


View all 4 project logs

View all instructions

Enjoy this project?

Share

Discussions

xbtk wrote 09/03/2024 at 08:06 point

cool

  Are you sure? yes | no

Jon Xuereb wrote 08/17/2024 at 02:21 point

Excuse me if I missed something, but what does this add over having the files already on your phone or on a USB-C flash drive?

  Are you sure? yes | no

Brett Smith wrote 08/17/2024 at 21:10 point

Good question. The device hosts a WiFi network that you can connect to from your phone. When you connect you can view your location on a map built from the USGS Topographic Quadrangles maps. You can also access a simple file server.

  Are you sure? yes | no

Jon Xuereb wrote 08/17/2024 at 21:38 point

But like couldn't that be an app, or does the device have better GPS than your phone?

  Are you sure? yes | no

Brett Smith wrote 08/17/2024 at 22:36 point

Absolutely, it can be an app, and there are plenty out there—I've used Garmin's "EarthMate" and even wrote one for work (FastXY). The issue with phone apps is the constant need for updates and managing offline maps and storage, which can be a hassle.

So even if you're okay with allocating a hefty percentage of your phone's storage to offline map tiles, you'd be wrong to expect you can just download a map app, leave it unused for 6 months, and have it still work perfectly before hitting the trail.

With this project, I've got all of California downloaded up to zoom level 16, totaling about 75 GB of offline maps. If you wanted the entire U.S. at zoom level 14, it would take around 500 GB, which is perfectly achievable with the right-sized microSD card.

The real benefit of this device is its longevity and reliability. You can compile tiles for massive areas, stash it in your car’s glove box for 10 years, and it’ll still work without needing any updates or app maintenance. The entire application is compiled as static HTML/JS/CSS.

It's a niche application! 😆

  Are you sure? yes | no

Jon Xuereb wrote 08/18/2024 at 00:22 point

okay, cool that's what I was looking for

  Are you sure? yes | no

kbirkenmayer wrote 08/26/2024 at 18:24 point

Hey Jon, if I understand the concept correctly I imagine this project also doesn't tie you down to one mobile device... Like if I go backpacking with my friends and I'm the only one with a subscription to AllTrails (or whatever) we'll have access to offline maps only until my phone dies. Whereas with this thing that's not a problem - we can just access the maps hosted by this device on any other mobile device that still has some charge left.

  Are you sure? yes | no

JPwnage (Jpwn4g3) wrote 08/16/2024 at 00:33 point

Be really cool if meshtastic was added in some way. That was communication could "possibly" still happen if no cell service and it would be all in one device.  

Plus you be honest, it just seems fitting to add it. 😂

  Are you sure? yes | no

Brett Smith wrote 08/16/2024 at 20:02 point

Meshtastic would be really cool! Being able to send messages to buddies a mile or two away out in the woods would be a blast.

From a hardware perspective, it shouldnt be hard to layout a custom PCB. This meshtastic device just needs an SD card:

https://meshtastic.org/docs/hardware/devices/heltec/

Its worth noting the current project communicates with the SD card via MMC, so Im not sure how much using regular SPI would throttle it. Wouldnt be too to test this kinda thing out though!

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates