1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

M5Stackで複数のntrip casterの設定を切り替え出来る装置を作る

Last updated at Posted at 2020-11-12

目標

RTK基地局が調子悪い時に切り替えたい

UI作ればいい

わかってるよそりゃ・・。けど大変。

力技で解決する

LovyanLauncher
https://raspberrypi.mongonta.com/howto-start-m5stack-m5burner-lovyanlauncher/
SDカードに基地局の設定を変えたbinファイルを置き、LovyanLancherで書き換える。

ソース

M5Stackのセットアップ

ntrip client for arduino

zipでダウンロードして、arduinoに入れてください。
https://github.com/GLAY-AK2/NTRIP-client-for-Arduino

ソース
/*
 *  NTRIP client for Arduino Ver. 1.0.0 
 *  NTRIPClient Sample
 *  Request Source Table (Source Table is basestation list in NTRIP Caster)
 *  Request Reference Data 
 * 
 * 
 */
//#include <ESP8266WiFi.h>  //Need for ESP8266
# include <WiFi.h>           //Need for ESP32 
# include "NTRIPClient.h"

//M5stack
# include <M5Stack.h>
# include <M5StackUpdater.h>

const char* ssid     = "your_ssid";
const char* password = "your_password";

char* host = "ntrip caster host";
int httpPort = 2101; //port 2101 is default port of NTRIP caster
char* mntpnt = "ntrip caster's mountpoint";
char* user   = "ntrip caster's client user";
char* passwd = "ntrip caster's client password";
NTRIPClient ntrip_c;

void setup() {
  M5.begin();
  Wire.begin();
  if(digitalRead(BUTTON_A_PIN) == 0) {
    Serial.println("Will Load menu binary");
    updateFromFS(SD);
    ESP.restart();
  }  
  // put your setup code here, to run once:
  Serial.begin(115200);
  delay(10);
  Serial.print("Connecting to ");
  Serial.println(ssid);
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("WiFi connected");
  Serial.println("IP address: ");
  Serial.println(WiFi.localIP());
  
  Serial.println("Requesting SourceTable.");
  if(ntrip_c.reqSrcTbl(host,httpPort)){
    char buffer[512];
    delay(5);
    while(ntrip_c.available()){
      ntrip_c.readLine(buffer,sizeof(buffer));
      Serial.print(buffer); 
    }
  }
  else{
    Serial.println("SourceTable request error");
  }
  Serial.print("Requesting SourceTable is OK\n");
  ntrip_c.stop(); //Need to call "stop" function for next request.
  
  Serial.println("Requesting MountPoint's Raw data");
  if(!ntrip_c.reqRaw(host,httpPort,mntpnt,user,passwd)){
    delay(15000);
    ESP.restart();
  }
  Serial.println("Requesting MountPoint is OK");

  
}

void loop() {
  // put your main code here, to run repeatedly:
  while(ntrip_c.available()) {
        char ch = ntrip_c.read();        
        Serial.print(ch);
        
  }
}

電気的なこと

Trimble等のGPS装置にRTCM3を流す場合、M5Stackから出てくる信号をRS232に変換する必要があります。
https://www.amazon.co.jp/dp/B00OPTOKI0/

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?