M5Stack CoreS3 SE と GR-M02U で位置情報を取得する
前回作った環境で、実際に位置情報を取得するコードを動かしてみた。前回も使用した felis/USB_Host_Shield_2.0 に含まれている pl2303_tinygps を動かせばいけるかと思いきや、それでは位置情報を得られずトラブルシューティングが必要だった。
試行錯誤の結果を PlatformIO で動くようにしたのがこちら。
https://github.com/mono0x/pl2303_tinygpsplus
pio run -t uploadpio device monitor
--- Terminal on /dev/cu.usbmodem1101 | 9600 8-N-1--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time--- More details at https://bit.ly/pio-monitor-filters--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
Acquired Data-------------Location: xx.xxxxxx,xxx.xxxxxxDate/Time: 2025-08-26 13:14:43.40Altitude: x.xxmCourse: 0.00degSpeed: 0.07km/hSatellites: 9HDOP: 1.41Chars: 10236 Sentences: 100 Failed checksum: 0-------------
具体的には、TinyGPS だと動かなくて、TinyGPS を改造するか TinyGPS++ に移行する必要があった。というのも、TinyGPS は NMEA データのうちの Talker ID が GP であるもののみサポートしていたのに対して、GR-M02U では GN で出力していたため。GN は複数衛星混在の情報であることを示しているようで、GR-M02U は衛星ごとに Talker ID を使い分けることはないようだ。TinyGPS++ では、Talker ID のサポートが拡大されていて問題なかった。