Hey all I am wondering if my code below can be modified in order for the Arduino to send more than 300 chars to a HM-10 bluetooth 4.0 le module?

#include <SoftwareSerial.h>

SoftwareSerial bluetooth(8,9); // RX, TX
String btString;
String comString;
int isVS;

void setup() {
  // Open serial communications and wait for port to open:
  while (!Serial) {;}

  Serial.println("PC Side Connected");

  while (!bluetooth) {;}

  bluetooth.println("Bluetooth Side Connected");

void loop() { 
  if (Serial.available() > 0) {
    //The IDE Sends and the phone receives
    comString = Serial.readString();

    //Check to see if this request is coming from Visual Studio
    isVS = comString.indexOf("_VS");

    if (isVS > -1) {
      //Is coming from Visual Studio so display it over serial port      
    } else {
      //Not coming from VS so send it to the bluetooth phone

  if (bluetooth.available() > 0) {
    //The phone sends and the IDE receives
    btString = bluetooth.readStringUntil('\n');

As in my code above, I've already tried to add the #define SERIAL_BUFFER_SIZE 512 to the top to give the software serial more buffers but that does not allow me to send more than ~310 chars.

So sending this string:

{MAC:'00-14-22-01-23-45',settings:{rgb:true,quotes:true,sleep:false,timeFrame:{on:'05:30:00',off:'22:30:00'},reset:false,weatherZip:'57104',userInfo:{left:'John Rambo',right:'T100'}},wifiInfo:{Name:'ItBurnsWhenIP',Pwd:'AwHk6gKnsMdxw3boWWAhus5NNCV304YQb/2287QqzH0WnS5W59vCzzW2pR8kgHI79hAUglQOCcBiEKiNWRBQ3oyvyJ0/fDfM1aKa9gfoy3kGHA=='}}

works just fine but if i send out a little more information:

{MAC:'00-14-22-01-23-45',settings:{rgb:true,quotes:true,sleep:false,timeFrame:{on:'05:30:00',off:'22:30:00'},reset:false,weatherZip:'57104',userInfo:{left:'JohnRambo',right:'T100'}},wifiInfo:{Name:'ItBurnsWhenIP',Pwd:'AwHk6gKnsMdxw3boWWAhus5NNCV304YQb/2287QqzH0WnS5W59vCzzW2pR8kgHI79hAUglQOCcBiEKiNWRBQ3oyvyJ0/fDfM1aKa9gfoy3kGHA==','testing out some more strings'}}

It shows everything but the gs'}} at the end on the iphone.

How would i go about fixing this so i can send much more than this?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.