Building own 4gntrip modem

Hi,

I need some arduino coding help. Maybe someone here can point me the right direction.

I have added base64 library but still got error that base64Encoder not declared.

Got this so far:

#include <SoftwareSerial.h>
#include "base64.h"

SoftwareSerial SIM7000E(2, 3); // RX, TX
const char* mountPoint = "Allesbeste";
const char* ntripUsername = "info@raycorp.nl";
const char* ntripPassword = "";
void setup() {
  Serial.begin(9600);
  SIM7000E.begin(9600);

  delay(2000);
  sendATCommand("AT"); // Test AT command
  sendATCommand("AT+CGATT=1"); // Attach to GPRS service
  sendATCommand("AT+CGDCONT=1,\"IP\",\"public.m2m\""); // Set APN

  // Enable NTP time synchronization (optional)
  sendATCommand("AT+CNTPCID=1");
  sendATCommand("AT+CNTP=\"pool.ntp.org\"");

  // Connect to GPRS network
  sendATCommand("AT+CGACT=1,1");
  delay(2000);
  
  // Open TCP/IP connection to NTRIP server
  sendATCommand("AT+CIPSTART=\"TCP\",\"www.rtk2go.com\",2101");
  delay(2000);
  String credentials = String(ntripUsername) + ":" + String(ntripPassword);
   String base64Credentials = base64::encode(credentials);
  // Send NTRIP request headers
  sendATCommand("AT+CIPSEND");
  delay(1000);
  SIM7000E.println("GET /Allesbeste HTTP/1.0");
  SIM7000E.println("User-Agent: NTRIP Client");
  SIM7000E.println("Authorization: Basic " + base64Credentials)
  SIM7000E.println("Ntrip-Version: Ntrip/2.0");
  SIM7000E.println("Connection: close");
  SIM7000E.write(0x1A);
  delay(1000);
  
  // Read and process the NTRIP response
  while (SIM7000E.available()) {
    Serial.write(SIM7000E.read());
  }
}

void loop() {

todo- get GGA data send true and read
}

void sendATCommand(String command) {
  SIM7000E.println(command);
  delay(500);
  while (SIM7000E.available()) {
    Serial.write(SIM7000E.read());
  }
}

I have un directory the library and used #include “base64”; But still no joy

A few observations:

If you copy the code into Arduino, it will not compile, as it is missing proper punctuation. Consider uploading the .ino file you are using

You did not list the exact error it is giving, including line numbers, tracebacks, etc.

Also see Error from base64.h file - Programming Questions - Arduino Forum

Also, indicate which base64 library in particular you’re trying. Did you examine the code from the accompanying Examples ?

edit: having looked, the doyjorin base64_encode library uses base64::encode

This is the one i use. And if i leave out the

SIM7000E.println("Authorization Basic line

It will compile and upload just fine.

But gives a base64 encoder not declared error. When i use that line

That’s exactly the line that has improper punctuation (syntax error). If I add a semicolon at the end, it works fine for me. Again, if you would have uploaded the .ino file, and copy-pasted the compilation error, it would have been a lot easier for us to tell you what the problem is.

1 Like

Ahh like that sorry… will upload the .lno

@theGtknerd

Hi below the .ino file.

I think the base64encode works now…but i think it does not encode the right way. If i encode my username online it looks different then whaymt comes out on .ino encode

When i connect to RTK2GO it auto download the Sourcetable. Long file :slight_smile:

Maybe there is a way to check if connection is good to send data?

Hope some can help a bit :slight_smile: No hurry’s

Ntrip_Test.ino (3,3 KB)

Not to answer your encoding question, but you need a space after Basic here:

SIM7000E.print("Authorization: Basic" + base64Credentials);

Will give it a shot. Thnx

Have you maybe had time to check the .ino file?

I checked it just now, and it compiles for me, but I have no way of checking if the code is actually good, since I don’t have your hardware and software setup.

Well when i use Get/sourcetable i can download source table… so that works.

Just trying to find out how it would accept a gga string. And to see if i am logged in under the right credentials.

When i send gga it says no carrier.

But got a weekend to figure some out.:crazy_face:

Still no luck.

I can connect to server but when try to send gga it say no carrier.

Think i gonna dig into aio and see if i can see a anwser there.

I don’t know this program, but the symptom is like when I forget to type in a valid mail in Agio

It connects to rtk2go or anyother caster and i can download mountpoints list. So could be my credential headers are not correct. But dont get message wrong username or password.

But i keep trying. :crazy_face:

did something work out for you?

Not yet, to much projects going on haha. Will get back to it in a few weeks