If I were to increase the of the buffer array from 64 to say 512 will this bring any long term problem in the Arduino Uno.

Changing from this:

#ifndef _SS_MAX_RX_BUFF
#define _SS_MAX_RX_BUFF 64 // RX buffer size

to this:

#ifndef _SS_MAX_RX_BUFF
#define _SS_MAX_RX_BUFF 512 // RX buffer size

This is the header file of the software serial.


2 Answers 2


The buffer is in the UNO's limited (2K) RAM; you'd be using 1/4 of it for the input buffer. If your app is small enough and simple enough (limited call depth, specifcally), there may still be enough RAM for your app to run successfully. If you have lots of globals (remember to include libraries when you're considering RAM use), allocate much memory from the heap (with new or malloc()) or have a complex call structure such that funcA() calls funcB() calls funcC() calls ... (etc) so that many functions' stack-frames remain allocated at once - at any point in your program - your program could suffer a stack-collision: the call-stack descends low enough that it can overwrite, or get over-written by, your heap or global data.

Why do you want so large an input buffer? Will data be coming in a high rate or in large bursts, while processing of the data will be infrequent or occur at irregular times? Given the limited RAM in the UNO, running complex programs on one can require something of a balancing act in how you use resources.


i was performing some AT commands with software serial and buffer limitation generated junk value

Other reasons why SoftwareSerial might return bad data are:

  • Using too high a baud rate (9600 baud seems to be about the max);
  • Code that turns the interrupts off too often or for too long;
  • Other devices creating too many interupts (perhaps a built-in timer running at a high rate).

The replies to most devices' AT commands that I know of are short enough to not require a huge receive buffer. Asking for list of WiFi SSIDs from an ESP8266 could generate a large reply but most responses should not overflow a more modest buffer.

  • Thanks for the advice the thing is that i was performing some AT commands with software serial and buffer limitation generated junk value but i think by just editing my code a little a bit i was able to fix this problem but i still a little bit more buffer memory
    – Charles
    May 6, 2018 at 16:26

Most arduino modules have 2k ram. So think about that. Whether you need more buffer or more working space. Keep in mind that other libraries are also using the same ram.

  • I am sending some character over software serial and 64 byte limitation is generating junk values i therefore increased the default to four times for more space to store my buffer
    – Charles
    May 6, 2018 at 16:21
  • @Nolawisolomon maybe you can send the length of the message first, and then send the rest like in http. Thus receiver knows how many bytes it needs to reserve. May 6, 2018 at 17:33
  • @Nolawisolomon - the RX buffer has little to do with transmission, unless you mean that you are transmitting in a blocking fashion and not paying any attention to received data until your lengthy transmission is done. May 6, 2018 at 21:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.