USB Powered Offline Map Server

by waymond91 in Circuits > Gadgets

19909 Views, 228 Favorites, 0 Comments

USB Powered Offline Map Server

thumbnail3.png
IMG_3871.png
map.png
Screenshot 2024-08-14 at 17-41-10 Files on SD Card.png
Backcountry Beacon - Overview

Backcountry Beacon: Because Your Phone Gets Lost in the Wild


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.

And don’t worry about lugging around some brick of a device. Backcountry Atlas is compact, ready to be powered by your car adapter or that trusty external battery while you’re out chasing sunsets and scaring squirrels off your food bag.

Features:

  1. Offline Maps & GPS: Navigate with confidence using USGS topo maps and hardware GPS, all without an internet connection.
  2. Custom File Server: Upload your own trail essentials—knot guides, plant IDs, audiobooks, you name it—and access them anytime.
  3. 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.
  4. Easy Connection: Hosts a Wi-Fi access point with a QR code, making it easy to connect and access your maps and files.

Limitations:

  1. 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.
  2. 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.
  3. 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.

Backcountry Beacon is your go-to for offline adventure essentials, even if it likes to take things a bit slower. It’s not built for speed, but it’s ready to keep you on track, no matter where the trail leads.


GIT REPOSITORY IS NOW PUBLIC, SORRY FOR THE OVERSITE

Supplies

parts-landscape.png

To build it as seen on TV, you will need:

  1. Lilygo TDongle S3
  2. BZ-181 FPV Gps Module
  3. 50mm Qwiic Cable
  4. Appropriate micro sd card (I am using this one)
  5. 3D printed gps holders (optional)

The hardware list is pretty small here, this project will cost under 100 USD, and could be as low as 60 USD depending on your SD card and if you want the shorter cable.

Print GPS Holder

Screenshot 2024-08-24 at 9.13.43 PM.png
Screenshot 2024-08-24 at 6.49.45 PM.png
Screenshot 2024-08-24 at 6.50.36 PM.png
Screenshot 2024-08-24 at 6.50.30 PM.png

Bringing Your Backcountry Beacon to Life – One Layer at a Time

It’s time to fire up the 3D printer and create the custom parts that will house your GPS module and keep everything secure. I have embedded the part files below to make it easy to review the parts before printing.

Download the 3D Models:

  1. Head over to the parts3D/ folder in our GitHub repository (insert actual link) and download the STL files for the GPS holder and any other components you plan to use.

Printing the Parts:

We printed these parts using a resin printer with ABS-like material to ensure durability. We used the following settings:

  1. Supports: Auto supports at 80% support density
  2. Layer Thickness: 100µm (0.1mm)

Due to the smaller features of the design, we can’t guarantee how it will print on an extrusion (FDM) printer, but if you’re familiar with tuning your machine for detailed prints, feel free to give it a try!

Don’t Have a 3D Printer?

No worries! These parts can be purchased online from various 3D printing services. Just provide them with the STEP files, and they’ll do the rest.

Wiring the GPS Module

IMG_3938.jpg
Screenshot 2024-08-24 at 6.53.35 PM.png
T-Dongle-LILYGO_16_1024x1024.jpeg

Now that you’ve got your custom parts ready, it’s time to wire up the GPS module.

Both the T-Dongle S3 and the drone GPS module use Qwiic connectors, making the connection straightforward—almost. The catch is that while they share the same connector, the pin configurations are different. You'll need to swap the pins on the GPS side of the connector—a delicate operation, but once complete, you’ll have a working connection.

Qwiic Connector Pin Configuration:

  1. T-Dongle S3 (Qwiic): GND, 3.3V, TX (T-Dongle), RX (T-Dongle)
  2. GPS Module: 5V, RX (GPS), TX (GPS), GND

Adjust the Pin Order:

To match the correct pinout, carefully use a small flathead screwdriver or a pin extractor tool to release each pin from the GPS connector housing. Reinsert them in the correct order according to the pin configurations above.

If you are unfamiliar with this process, there is an example of how to remove and re-insert these pins here.

For clarity, I have shown my cables pin positions clearly, so it is easy to replicate.

Connect the GPS Module to the T-Dongle S3:

Once the pins are correctly ordered, plug the Qwiic connector into your GPS module and connect the other end to the T-Dongle S3. Make sure the connection is secure and that the wires aren’t strained or loose.

With the wiring complete, your GPS module is now ready to start communicating with the T-Dongle S3. Next, we’ll move on to installing the GPS holder and getting everything assembled!

Installing the GPS Holder – Snap, Slide, and Secure

assy2.jpg
assy3.jpg
assy4.jpg
assy5.jpg
assy6.jpg

Assembling Your GPS Module – It’s That Simple

Putting together your GPS module with the T-Dongle S3 is a breeze. Just follow these simple steps:

  1. Connect the Cable: Start by connecting the Qwiic cable between the T-Dongle S3 and the GPS module. The pin order is already configured, so no need for extra adjustments.
  2. Place the Bottom GPS Holder: Slide the bottom GPS holder onto the T-Dongle S3. It should fit snugly, but if it feels too tight or loose, you can lightly sand or shape the 3D-printed part for a perfect fit.
  3. Position the GPS Module: Place the GPS module onto the bottom GPS holder. Make sure it sits securely in place.
  4. Snap on the Top Holder: Carefully snap the top GPS holder over the GPS module. It should click into place, keeping everything securely together.
  5. Optional – Secure with Tie Wire: If you’re planning on some rugged adventures, you can add an extra layer of security by tying a piece of wire around the assembly. This will keep everything locked in place, even if things get bumpy.

And that’s it! Your GPS module is now securely attached to the T-Dongle S3 and ready to go. Remember, if the 3D-printed parts don’t fit perfectly right out of the printer, a little sanding or shaping can make all the difference.

Get Ready to Compile

dynamic tile rendering.png

The ESP32: Small but Mighty (With a Few Quirks)

This teeny-tiny microcontroller is an absolute powerhouse for its size, but it does have its limits. Think of it as a trail-ready multitool: super handy, but you wouldn’t use it to fell a tree. The ESP32 is great at serving simple web pages, handling Wi-Fi, and running some lightweight tasks. But here’s the thing—it’s not going to win any speed races, and it doesn’t have the muscle to run complex applications or heavy servers.

Why Static Files?

Given these constraints, we’re playing to the ESP32’s strengths by using static files. What does that mean? Everything—maps, web interfaces, resources—is precompiled and stored on a microSD card as static files. When you connect to the Backcountry Beacon, the ESP32 isn’t scrambling to generate pages or process requests in real-time. Instead, it’s simply serving up those pre-made files, like a friendly camp host handing you a map at the trailhead.

The Limitations of Our Static HTTPS Server

Here’s where it gets real: our static file approach means no dynamic content. If you’re dreaming of fancy web apps with real-time interactivity, this isn’t it. The server we’re using is basic—it’s like the reliable old compass you keep in your pack. It does one thing really well: it serves static content quickly and reliably. But, it’s not going to handle complex operations, process data on the fly, or manage multiple heavy requests at once. The trade-off? Simplicity and reliability. This thing just works, and that’s exactly what you need out there in the wild.

What Are We Compiling?

So, what’s in the mix? Here’s what we’re packing into those static files:

  1. Offline Maps: Detailed USGS topographical maps stored as image tiles. These are your bread and butter when you’re off the grid, showing you exactly where you are and what’s around you.
  2. Web Interface: HTML, CSS, and JavaScript files that make up the simple, intuitive interface you’ll use to interact with the device. No bells and whistles, just what you need to get the job done.
  3. Trail Resources: Whatever you might need on the trail—knot-tying guides, plant identification PDFs, or even a tv shows for those stuck in your tent.

By compiling all of this into static files, we’re ensuring that the Backcountry Beacon can do its job—no internet required, no updates needed, and no fuss. Just reliable, ready-to-go access to the maps and files that matter most when you’re miles from the nearest Wi-Fi signal.

Prepping Your SD Card – the Digital Trailhead

DALL·E 2024-08-24 23.02.51 - A realistic and detailed image of a 3D topographic map sitting on top of an SD card. The topographic map should have distinct elevation lines and terr.jpeg

Formating Your SD Card

Before we dive into loading up your SD card with all the maps and goodies, we need to give it a fresh start.

  1. Grab Your MicroSD Card: You’ll need a card with at least 32GB of space—more if you’re planning on loading up a ton of maps and resources.
  2. Format the Card:
  3. On Windows:
  4. 32GB or Less: Right-click on your SD card in “This PC,” choose “Format,” and select FAT32 as the file system. A quick format will do the trick.
  5. 64GB or Larger: Windows might not let you format large cards as FAT32, so choose exFAT instead. It’s just as reliable, and it handles bigger files.
  6. On macOS:
  7. 32GB or Less: Open “Disk Utility,” select your SD card, and click “Erase.” Choose MS-DOS (FAT) for FAT32 or ExFAT for larger cards, with the scheme set to Master Boot Record (MBR). Then hit “Erase.”
  8. 64GB or Larger: Follow the same steps, but choose ExFAT as your format option.
  9. On Linux:
  10. 32GB or Less: Use sudo mkfs.vfat -F 32 /dev/sdX (replace X with your SD card’s identifier) to format the card to FAT32.
  11. 64GB or Larger: Format the card to exFAT using sudo mkfs.exfat /dev/sdX. This will allow you to handle larger files and more space efficiently.


Setting Up the Initial Directory Structure

With your card freshly formatted and ready to go, it’s time to set up the directory structure that the Backcountry Beacon needs to function. This is where you’ll be loading all the maps, web assets, and any extra resources you want to access on the trail.

  1. Download the Template:
  2. Head over to our GitHub repository and download the sdCard folder. This folder contains the template structure you’ll need to copy onto your SD card.
  3. Copy the sdCard Folder:
  4. Simply drag the sdCard folder you downloaded from GitHub onto the root of your freshly formatted SD card. Once copied, your SD card should have the following structure:
  5. Root Directory:
  6. leaflet.css (for styling the map)
  7. leaflet.js (for making the map interactive)
  8. error.png (for those rare moments when a tile doesn’t load)
  9. favicon.ico (because every good site needs a favicon)
  10. /tiles Directory: This is where your map tiles will go, organized by zoom level and coordinates.
  11. /serve Directory: This is where you’ll store your extra resources like PDFs, guides, or any other files you might need.

Downloading Map Tiles – Your Offline Navigator

Screenshot 2024-08-24 at 10.36.00 PM.png
Screenshot 2024-08-24 at 10.36.12 PM.png
Screenshot 2024-08-24 at 10.36.21 PM.png
Screenshot 2024-08-24 at 10.37.45 PM.png

Setting Up and Using the Node.js Script to Download Map Tiles

Before you can hit the trail with your Backcountry Beacon, you need to load it up with the maps you’ll rely on when you’re off the grid. These map tiles allow you to see detailed topographical information without needing an internet connection. We’ve made this process easy with a handy Node.js script. Here's how to get started:

1. Start with the Cache Explorer:

  1. Visualize Available Tiles: Before diving into the download process, take a moment to explore the Cache Explorer site. This visual tool helps you understand the structure of the map tiles and gives you a preview of the tiles you’ll be downloading. While it currently shows tiles for Hawaii, it provides a great sense of how zoom levels and regions are organized.
  2. Plan Your Downloads: Use the Cache Explorer to get a clear idea of which tiles and zoom levels you need for your specific area.

2. Set Up Your Local Machine:

  1. Install Node.js: Ensure you have Node.js installed on your computer. If not, you can download it from the official Node.js website.
  2. Clone the Repository: Download the tileDownloader folder from our GitHub repository and navigate to it in your terminal.

3. Install Dependencies:

  1. Run npm Install: In your terminal, navigate to the tileDownloader directory and run the command to install the necessary dependencies for the script, including @turf/turf and @mapbox/tilebelt.

4. Download Tiles:

  1. Run the Download Command: To download tiles for a specific state, such as California up to zoom level 14, run the appropriate command in your terminal.

node tile-downloader.js --states "California:14" --output ./tiles

  1. Output Directory: The --output flag specifies where the downloaded tiles will be saved. In this example, they will be saved in a folder called tiles in the current directory.

5. Verify the Download:

  1. Check the Output: Once the download completes, navigate to the output directory and ensure that the tiles have been downloaded correctly.
  2. Organize Your Files: If needed, organize the tiles into the appropriate directories for use with the Backcountry Beacon.

6. Load Tiles onto Your Backcountry Beacon:

  1. Transfer to Your Device: Once you’ve downloaded all the necessary tiles, transfer them to the appropriate location on your Backcountry Beacon’s microSD card.
  2. Test the Setup: Make sure everything is working by powering on the Backcountry Beacon and verifying that the maps load correctly.

By starting with the Cache Explorer, you’ll have a clear understanding of the tiles you need, making the download process even smoother. With these steps, your Backcountry Beacon will be fully equipped with the detailed maps you need for your outdoor adventures.

Flashing the Firmware – Bringing Your Backcountry Beacon to Life

maxresdefault-2675850501.jpg


The firmware is the brain of your Backcountry Beacon. It’s what turns the ESP32 into a powerful, portable server that can serve up offline maps and files whenever you need them. Flashing the firmware is the step where we program the ESP32 to do exactly what we want—serve up those precompiled static files and manage Wi-Fi connections.

Getting the Firmware Ready

  1. Download the Firmware:
  2. Head over to our GitHub repository and download the latest firmware for the Backcountry Beacon. The firmware is located in the firmware/ directory and is pre-configured to work with the LilyGo S3 USB dongle.
  3. Set Up PlatformIO:
  4. You’ll need PlatformIO, an integrated development environment (IDE) that makes flashing firmware to the ESP32 easy. If you haven’t installed it yet, download PlatformIO as a plugin for Visual Studio Code.
  5. Open Visual Studio Code, navigate to the firmware/ directory you downloaded, and open it as a project in PlatformIO.
  6. Connect Your ESP32:
  7. Plug the LilyGo S3 USB dongle into your computer using a USB cable. Make sure PlatformIO recognizes the device by checking the bottom bar in Visual Studio Code for the connected COM port.
  8. Configure and Flash:
  9. With the project open in PlatformIO, make sure you’ve selected the correct board configuration. The platformio.ini file in the firmware/ directory should already be configured for the ESP32, so you shouldn’t need to change anything.
  10. Click the “Upload” button in PlatformIO (it looks like an arrow pointing up) to start the flashing process. PlatformIO will compile the firmware and upload it to the ESP32. This may take a few minutes, but once it’s done, your ESP32 is officially a Backcountry Beacon!
  11. Verify the Flash:
  12. After the firmware is flashed, open the Serial Monitor in PlatformIO to check that the ESP32 is running correctly. You should see status messages indicating that the device is booting up and ready to serve files.

What’s Next?

With the firmware flashed, your Backcountry Beacon is now fully operational. All that’s left is to power it up, connect to its Wi-Fi network, and start exploring your offline maps and resources. In the next step, we’ll walk you through deploying and using the device in the real world.

Get Out and Explore

IMG_1011.jpg


Your Backcountry Beacon is now loaded and ready to guide you on your next adventure. But the journey doesn’t end here—it's just beginning.

Make It Your Own: Whether you’re tweaking the setup, exploring new ways to use your device, or adding your personal touches, this project is yours to shape. Your creativity and curiosity are the driving forces behind making the most of your Backcountry Beacon.

Share Your Discoveries: As you venture out, consider sharing your experiences, tips, and insights. You never know who might benefit from your knowledge, and it’s a great way to contribute to the broader spirit of outdoor exploration.

Most Importantly—Get Outside: Now that your device is ready, it’s time to hit the trails. The world is waiting to be explored, and your Backcountry Beacon is here to help you navigate and discover new places. Enjoy the fresh air, embrace the adventure, and make the most of every journey.