Starshield: Situational Awareness for the Star Labs StarBook
Going off-the-grid with an add-on for the Star Labs StarBook – and pretty much every other laptop – that adds situational awareness through various sensors and removes the need for privacy-invasive cloud services for things like GPS positioning and current temperature.
As someone who doesn’t always have access to stable internet connectivity – whether that’s at the places I stay or when travelling – I like to rely as little as possible on the cloud. For example, instead of Dropbox, I use my own decentralized Dropbox, and I keep my data with me all the time. I also store important knowledge locally whenever possible and make use of open-source software for e.g. navigation, which allows me to download complete maps.
In an effort to not only make static data available all the time, but also dynamic data like current environmental conditions and my location, I began experimenting with a few ideas – one of which is the Starshield.
The Starshield
The Starshield is a laptop add-on that can be attached to the backside of the display and provides information about the current temperature, humidity, air pressure and quality, as well as accurate positional data.
Build
The Starshield is built fairly simple and requires (nearly) no soldering. Theoretically all modules can be connected using Sparkfun’s Qwiic. However, the orientation sensor (BNO080) – which is obsolete these days and really bad anyway, so better pick a different one in case you want to build the Starshield yourself – requires two pins to be soldered to the ESP32 in order to function properly. Apart from that, however, everything is relatively plug ’n play and can be fixed in place using the tinkerer’s best friend: Hot glue.
Below you can find a BOM containing all the parts used for the Starshield, with price tags attached to them if known. Many of the parts were in my possession for several years, and I couldn’t find the original prices anymore. Also, if you were to purposefully buy parts for building the Starshield, you’d likely chose newer alternatives – for example the BME688 instead of the BME680, the BNO086 instead of the BNO080, and maybe a different GPS module.
Part | Price (USD) |
---|---|
SparkFun ESP32-C6 Mini-1 | 14.95 |
SparkFun Qwiic MultiPort | 6.50 |
SparkFun Qwiic cable kit | 9.99 |
SparkFun SAM-M8Q | ??.?? |
SparkFun BNO080 | ??.?? |
Adafruit BME680 | ??.?? |
Adafruit SI1145 | ??.?? |
3D print | 23.41 |
starshieldd
The starshieldd
is the Starshield daemon, which communicates with the Arduino
board and serves the data in more usable JSON formats through different HTTP
APIs. Its main API simply outputs all the values as JSON object and is used by
the Waybar script. It’s secondary API implements the geo provider API used by
Firefox and replies with GPS data.
Waybar
I wrote a small script that I run as a custom Waybar module, which queries the
starshieldd
and displays the current environmental readings on my menubar. The
script will work regardless of whether the Starshield is connected or whether
the starshieldd
is running, as it will simply output zero values if either of
that should be the case.
GPS
It is possible to make use of the GPS data provided by the Starshield through
the use of starshieldd
as geo provider. In Firefox/Firefox-based browsers,
visit about:config
and search for geo.provider.network.url
. Change the value
of the setting to http://127.0.0.1:3232/location
. Make sure that geo.enabled
is set to true
. All the other settings don’t matter to much, because the
Starshield daemon won’t care about the clues that Firefox sends, as it solely
returns GPS data from the integrated GPS module.
It is also possible to use Mepo, by modifying its
user pin script so that it makes use of the same geo
provider API that is available to Firefox. Hopefully at some point
Organic Maps will become available through Gentoo portage, at which
point it makes sense to look into how its requesting GPS data and how
starshieldd
can be integrated to provide that data.
Why not use gpsd
?
Because gpsd has proven to be super unreliable during my initial tests when
directly feeding it the NMEA data from this specific GPS module, as well as two
other u-blox modules, with crashes occurring on a regular basis. Besides it
would have greatly increased the complexity of implementing the Starshield, as
well as the starshieldd
, as it’s not easily possible to stream and receive
data alongside of NMEA over a single USB connection.
Sources
You can find the STLs for the case, as well as the source code for Arduino and the Waybar script here. The sources for the daemon (written in Go) can be found here. An example of how I run the daemon can be found in my dotfiles.
Enjoyed this? Support me via Monero, Bitcoin, Lightning, or Ethereum! More info.