BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Timeout sending multiple parameters


#1

I would like to send a huge amount of parameters to a virtual PIN on my local Blynk server…
Something like this format…

[“357”,“262”,“462”,“447”,“457”,“355”,“355”,“290”,“257”,“240”,“457”,“352”,“255”,“407”,“330”,“265”,“465”,“445”,“442”,“362”,“355”,“295”,“245”,“235”,“455”,“370”,“277”,“372”,“267”,“275”,“472”,“435”,“412”,“387”,“357”,“307”,“220”,“225”,“442”,“412”,“297”,“337”,“195”,“287”,“485”,“425”,“375”,“415”,“360”,“320”,“192”,“207”,“427”,“467”,“320”]

The above works fine, but if I crank up the number of parameters my arduino resets…
Should I use another format if I am dealing with a huge amount of parameters and split them within my arduino code?
Or do I need to have some delay for the parameters to prevent the timeout?


#2

You can try using delay(50) after every third virtual write, works on ESP platforms when using multiple consecutive virtual writes. But as far as I can understand, this problem was related (and still is) to ESP core, not Blynk itself. Don’t know if/how it reflects Arduino platform though.


#3

Actually I found out that the board resets anyways if I send a massive amount of parameters…

It works fine like this
http://192.xxx.xxx.xx:xxxx/xxx/update/V25?value=442&value=357&value=262&value=462&value=447&value=457&value=355&value=355&value=290&value=257&value=240&value=457&value=352&value=255&value=407&value=330&value=265&value=465&value=445&value=442&value=362&value=355&value=295&value=245&value=235&value=455&value=370&value=277&value=372&value=267&value=275&value=472&value=435&value=412&value=387&value=357&value=307&value=220&value=225&value=442&value=412&value=297&value=337&value=195&value=287&value=485&value=425&value=375&value=415&value=360&value=320&value=192&value=207&value=427&value=467&value=320

But if I am trying to send more parameters at once the board resets…Is there any way to increase the buffer size?


#4

Could I probably use the Terminal Widget to store my data?

Set Widget Property via GET
GEThttp://blynk-cloud.com/auth_token/update/pin?property=value

What types of property does the widget have?

edit

I can sent the values to my terminal widget like this

http://192.xxx.xxx.xx:xxxx/xxx/update/V25?input=442&value=357&value=262&value=462&value=447&value=457&value=355&value=355&value=290&value=257&value=240&value=457&value=352&value=255&value=407&value=330&value=265&value=465&value=445&value=442&value=362&value=355&value=295&value=245&value=235&value=455&value=370&value=277&value=372&value=267&value=275&value=472&value=435&value=412&value=387&value=357&value=307&value=220&value=225&value=442&value=412&value=297&value=337&value=195&value=287&value=485&value=425&value=375&value=415&value=360&value=320&value=192&value=207&value=427&value=467&value=320

So I will try to increase the buffer size of the Terminal Widget I guess!

Where would I find terminal.strings.pool.size


#5

Seems like this is too much for your Arduino. Do you use Arduino Http Client for sending Http request? Please show your code.


#6

I manually send the request thru my browser…ultimately I will use another application to send the request!


#7

Also after the Arduino blanks out I can see the variables stored on the server…


#8

Yes. But you wrote that

So you send this from Arduino?


#9

Sorry if I explained my problem weirdly…
I am sending multiple parameters thru my browser…like this

http://192.xxx.xxx.xx:xxxx/xxx/update/V25?input=442&value=357&value=262&value=462&value= etc etc

This works up to a certain number of parameters, if I am sending for example 70 parameters like this thru my browser, the arduino drops out and resets!


#10

I am just cleaning up my code a bit and will post it!!


#11

So you try to read this values on Arduino am I right? If so - please show how you try to achive that.


#12
/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest
  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.
    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Social networks:            http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app
  Blynk library is licensed under MIT license
  This example code is in public domain.
 *************************************************************
  This example shows how to use Arduino Ethernet shield (W5100)
  to connect your project to Blynk.
  NOTE: Pins 10, 11, 12 and 13 are reserved for Ethernet module.
        DON'T use them in your sketch directly!
  WARNING: If you have an SD card, you may need to disable it
        by setting pin 4 to HIGH. Read more here:
        https://www.arduino.cc/en/Main/ArduinoEthernetShield
  Feel free to apply it to any other example. It's simple!
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial


#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
#include <Wire.h>
#include <Adafruit_PWMServoDriver.h>

// called this way, it uses the default address 0x40
Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver();
// you can also call it with a different address you want
//Adafruit_PWMServoDriver pwm = Adafruit_PWMServoDriver(0x41);

// Depending on your servo make, the pulse width min and max may vary, you 
// want these to be as small/large as possible without hitting the hard stop
// for max range. You'll have to tweak them as necessary to match the servos you
// have!
//#define SERVOMIN  150 // this is the 'minimum' pulse length count (out of 4096)
//#define SERVOMAX  600 // this is the 'maximum' pulse length count (out of 4096)

#include <Adafruit_NeoPixel.h>

#define PIN            8 // GPIO pin
#define NUMPIXELS      12 // Number of pixels in strip
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "xxx";

//variable to pull the servos to the ground
int servo_detach;

#define SERVONUM  14 // number of servos
#define W5100_CS  10
#define SDCARD_CS 4

const int timerInMillies = 20;
const int ServoPositions = (294);

void setup()
{
  // Debug console
  Serial.begin(9600);

  pinMode(SDCARD_CS, OUTPUT);
  digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card

  Blynk.begin(auth, IPAddress(192,168,178,20), 8442);

  pwm.begin();
  pixels.begin();
  
  pwm.setPWMFreq(60);  // Analog servos run at ~60 Hz updates
  //pwm.setPWMFreq(40);  // Analog servos run at ~40 Hz updates

  yield();
}

// you can use this function if you'd like to set the pulse length in seconds
// e.g. setServoPulse(0, 0.001) is a ~1 millisecond pulse width. its not precise!
void setServoPulse(uint8_t n, double pulse) {
  double pulselength;

  pulselength = 1000000;   // 1,000,000 us per second
  pulselength /= 60;   // 60 Hz
  //pulselength /= 40;   // 40 Hz
  Serial.print(pulselength); Serial.println(" us per period"); 
  pulselength /= 4096;  // 12 bits of resolution
  Serial.print(pulselength); Serial.println(" us per bit"); 
  pulse *= 1000;
  pulse /= pulselength;
  Serial.println(pulse);
  pwm.setPWM(n, 0, pulse);
}

 BLYNK_WRITE(V20) // Widget WRITEs to Virtual Pin V20
{   
int R = param[0].asInt();
int G = param[1].asInt();
int B = param[2].asInt();
  Serial.println(R);
  Serial.println(G);
  Serial.println(B);

  //Serial.println("ParameterChanged");

for(int i=0;i<NUMPIXELS;i++){
    pixels.setPixelColor(i, pixels.Color(R,G,B)); // Moderately bright green color.
    pixels.show(); // This sends the updated pixel color to the hardware.
}
}

BLYNK_WRITE(V21)
{
  servo_detach = ((param.asInt()));
  }

///////////////////////////////////////////////////
BLYNK_WRITE(V25)
{ 
    for(int angleIndex = 0; angleIndex < ServoPositions; angleIndex++){
    int angle = param[(angleIndex)].asInt();
    for(int i=0;i<SERVONUM;i++){
    pwm.setPWM(i, 0, ((angle)));} 
  Serial.println("angleIndex");
  Serial.println(angleIndex);
  Serial.println("angle");
  Serial.println(angle);
  }
}

void wait(){
  delay(timerInMillies);
}

void waitLong(){
  delay(5*timerInMillies);
}
void waitReallyLong(){
  delay(500*timerInMillies);
}

///////////////////////////////////////////////////

void loop(){
    Blynk.run();
    
    //detach servos
    if (servo_detach == 1) { 
    for(int i=0;i<15;i++){
      pwm.setPWM(i, 0, 0);
    }
    }
}

#13

I was trying to use Virtual Pin 21 to collect the parameters being send thru the browser…
I can send exactly 63 different parameters thru my browser, if I am sending more parameters thru my browser, the Arduino resets!


#15

I think you are waiting too long using delays with Blynk. Please read documentation regarding simple timer or blynk timer.


#16

I do not use the wait(); waitLong(); or waitReallyLong(); functions…I should have cleaned them up, sorry I was in a rush cleaning my sketch! They were for some other testing purposes!!


#17

The funny thing is, the Arduino also drops out if I just send those parameters to an unused virtual port…
Any Ideas why this is the case? After rebooting all the data is stored in the Virtual Port on the server like it should be, strange!!
My workaround would be to send the data in smaller packages to the Terminal, to prevent the reset!
Any other ideas?


#18

OK, I can store the values in the terminal widget…but the sketch only reads the first 50 parameters that I sent!

Is there any way to access all the parameters stored in the terminal widget?
I would like to send the data in packs of 50 each to the terminal widget to prevent the Arduino reseting, and read them out later! :slight_smile:


#19

For some magical reason that I do not understand it works now…well that is a good thing I guess!! :smile: