本文へ移動

猫と草花の写真帖

m5-grayline: A Grayline Map for M5Stack, Flashable from Your Browser

この記事の日本語版はこちら: 日本語版

M5Stack showing the grayline world map, next to an FT-991 transceiver and a wattmeter

I have built and released m5-grayline, a firmware that turns an M5Stack Basic into a small grayline map for your desk. It draws day, night, twilight and the grayline on a world map, and you can install it straight from Chrome or Edge on your computer.

Why a grayline map on the desk

As most hams know, the grayline is the band of twilight that separates day from night. Along this band, D-layer absorption fades while the F layer still reflects, so signals on the HF bands, especially the low bands, can travel unusually far. When both ends of a path sit on the grayline, it is a good time to chase DX.

This is JE6HIB, operating from Japan. In DX hunting and in contests, the grayline sometimes gives me a contact far beyond what I expected, so I do not want to miss that window. I wanted to see where the grayline is at a glance, without opening a computer. A palm-sized M5Stack fits next to the radio without taking up space.

The palm-sized M5Stack held between the fingers

What it shows

Photo-style world map with local time and UTC on the M5Stack screen

The map uses an equirectangular projection centered on your longitude and is redrawn every minute. There are four views, switched with the buttons. The screenshots below were taken from the device at about the same time.

Photo style (default). The day side shows NASA Blue Marble and the night side shows city lights from NASA Earth at Night, blended smoothly across twilight.

Twilight zones (button B). Day, civil, nautical and astronomical twilight, and night are shaded in steps, which makes the width of the grayline easy to read.

Maidenhead grid and Moon overlay (long press B, which cycles through grid and grid + Moon). Use the grid to locate the other station, or check the Moon’s position for EME.

Info screen (button C). Twilight, sunrise, sunset and solar noon times for your location, the Sun’s altitude and azimuth, the Moon phase and more.

Here is a short video of switching the views with the buttons.

Features

  • Seasonal accuracy: The Sun’s position is calculated with the NOAA method (based on Meeus), so the grayline changes shape between the solstices just as it does in reality.
  • Accurate time: The clock is synchronized over Wi-Fi with NTP. Local time and UTC are shown side by side.
  • Your sunrise and sunset: A countdown to your next sunrise or sunset. Polar night and midnight sun are handled.
  • Automatic location: Your latitude and longitude come from the settings file on the microSD card, or from GeoIP (ipinfo.io), or default to Tokyo.
  • Made to stay on: The screen dims at night and on battery, and Wi-Fi is turned on only to sync the clock.
  • Battery status: Shows the battery level and whether USB power is connected.

What you need

  • M5Stack Basic V2.6 (other models are not tested)
  • A microSD card for the settings file
  • 2.4 GHz Wi-Fi
  • A computer and a USB Type-C cable for installing

Get started in three steps

  1. Install: Open the Web Flasher in Chrome or Edge on your computer, connect the M5Stack over USB, and press the install button. No development tools are needed. Some operating systems need a driver for the CH9102 USB-serial chip.
  2. Configure: Insert a microSD card and start the device. It creates the settings file /grayline/config.json. Put the card in your computer and enter your Wi-Fi SSID and password. Adding your latitude and longitude makes the sunrise and sunset times exact.
  3. Run: Put the card back and power on. After the clock is synchronized, the map appears.

The user manual covers all settings and how to install with esptool or PlatformIO.

Buttons

ButtonPressAction
AShortResync the clock with NTP
BShortSwitch between photo style and twilight zones
BLongToggle the Maidenhead grid and Moon
CShortSwitch between the map and the info screen

When the screen is dimmed, a button press only brightens it for a while (30 seconds by default). Press again once it is bright.

Source code and credits

The source code is available on GitHub under the MIT License. The solar calculations are covered by unit tests that run on a PC, and improvements are welcome.

The map imagery comes from NASA Blue Marble and Earth at Night, and the coastlines from Natural Earth. Imagery courtesy of NASA. Made with Natural Earth.

What’s next

If I find the time, I may write a little about how it was made.

Bug reports and ideas are welcome on GitHub Issues or in the comments below. 73 de JE6HIB.

Links

アマチュア無線の記事

すべて見る (9)

コメント

コメントを書く