Can you do this without changing the SoftwareSerial buffer size?

My tutorial Arduino Serial I/O for the Real World covers this buffer problem in detail, including a GPS parsing example.
Your problem may not just be the size of your SoftwareSerial buffer, but that you are printing debug statements that block the loop from reading the SoftwareSerial buffer before it fills up.

Two simple things to do to start with
i) increase your baud rate for Serial, i.e. Serial.begin(115200)
ii) reduce your baud rate for SoftwareSerial, i.e. sf.begin(4800);

If this does not work check the other fixes detailed in the tutorial, including adding your one extra input buffer and timing your loop to see just how slow you are running.

Although I think Strings are often convenient. The Serial find( ) and readStringUntil( ) can be tricky to get running correctly. The Serial.setTimeout( ) that these use defaults to 1sec which in your case is too long.
Try
Serial.setTimeout(50);
but that still may not solve the issues
My tutorial Arduino Software Solutions has various sketches for reading from Serial, with their pros and cons.

If you are worried about RAM usage don't blindly follow the serial input basics tutorial as it allocates char[ ]s the same size as the expected input for every field parsed out. Very safe but in your case will uses a lot of RAM.
Replace its strcpy calls with the safer strlcpy method once you reduce the result char[ ]'s, to keep the code safe from buffer overflows.
This sketch strlcpy_strlcat.ino shows you how to use strlcpy

1 Like