Files
roro9stack/site/content/dev/milestones/h1.md
T
twislaandClaude Opus 5.5 544bd726df
CI / build (pull_request) Successful in 2m20s
Site / build (pull_request) Successful in 10s
GNSS App: a Compass, with Places to be led back to and a level
Tab goes on from the Sky to a third view (issue #16): a rose that turns
with the device, the heading, where north came from and how long ago,
the sun on the rose, and a level. m marks where you stand as a Place,
t picks one as the target: an arrowhead on the rose, its distance and
bearing. The sensor's directions were checked by hand on the device.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0162FokPdvY2KsS4NBfwyWPk
2026-10-11 17:01:57 +02:00

4.2 KiB

+++ title = "On-board hardware" description = "The hardware the device already carries and nothing used yet (the motion sensor, the infrared LED, the microphone and speaker) each gets something useful to do." weight = 110

[extra] docs = true source = "docs/milestones/H1.md" tag = "H1" +++ Status: in progress. Built, not released yet: the Compass (issue #16). Not started: the IR Remote (#15), the Audio App (#14).

Goal: the hardware the device already carries and nothing used yet (the motion sensor, the infrared LED, the microphone and speaker) each gets something useful to do.

The Compass (issue #16)

The device has a GNSS receiver and a motion sensor (a BMI270: an accelerometer and a gyroscope) but no magnetometer: standing still, nothing in it knows where north is. The receiver gives the direction of travel while walking; the gyroscope measures turns, but not from where.

Decisions (design round 2026-10-10)

# Decision
Q267 A third view of the GNSS App, after Position and Sky, not an App of its own: Tab goes round the three.
Q268 North comes from outside, and the gyroscope holds it. Walking at 3 km/h or more, each course the receiver reports pulls the heading 30 % of the way to it. Standing, the gyroscope follows the turns, and the screen says how long ago north was last given.
Q269 The sun gives north too: s with the top of the device aimed at the sun sets the heading to the sun's azimuth, worked out from the time and the position. The sun is drawn on the rose, as something to check north against.
Q270 The heading is where the top of the device points. The turn that counts is the one around the vertical, which the accelerometer gives: it works however the device is held. Walking, the device is taken to point the way you walk.
Q271 Places: m marks where you stand, under a name; t picks one as the target. The rose then carries an arrowhead to it, with its distance and bearing. Targets from Tracks, typed coordinates or Gemini links are for later.
Q272 Places are GPX waypoints in /gnss/places.gpx on the SD card, 50 at most: a map program opens the file, and waypoints made by one are read here. The whole file is written at each change.
Q273 A level from the accelerometer, next to the readouts: the heading is only as good as the device is flat when aiming at the sun.
Q274 Not now: a magnetometer on the Grove port (and so declination), a faster GNSS rate, sunrise and sunset, an estimated time of arrival.

As built

  • lib/gnss/src/compass.{h,cpp}, host-tested (13 tests): HeadingFilter (the turn around "up" from the gyroscope, the course and the sun as references, the gyroscope's offset learnt while the device lies still), sunPosition (the Astronomical Almanac's low-precision formulas), bearingDegrees, cardinal, formatDistance.
  • lib/gnss/src/places.{h,cpp}, host-tested (5 tests): the Places as GPX waypoints, read and written.
  • The GNSS App reads the sensor 100 times a second while it is in front, in any of its views, and forgets north when it is left: the turns made meanwhile were not followed. The Compass is drawn again when the heading moves by a degree or the level moves, at most 20 times a second.
  • imu on the consoles prints what the sensor reads.

Checked on the device (2026-10-11)

  • The sensor answers as a BMI270 through M5Unified, and reads about 0.5 degrees a second on one axis lying still.
  • Turning the device clockwise makes the heading go up, and the level's bubble goes to the edge that is lifted: the sensor's axes are as the code took them.
  • Not checked yet: north from the course while walking, north from the sun against a real compass, and how far the heading drifts in the hand.

What the sensor's offset costs

A gyroscope reads a little even when nothing turns (up to about 0.5 degrees a second for this one), which would turn the rose by itself. The filter takes what the sensor reads while it has been still for a second (under 2 degrees a second on all axes) as that offset. In the hand the device is rarely that still: lay it down for a few seconds first. After 3 minutes without north the screen shows the age of the heading in the warning colour.