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

Login Timeout + Packet Too Big In Arduino Uno And Hc-05

Blynk Library: v 0.6.1
Os: Android 8.0
Mobile: Huawei Y5
Board: Arduino Uno R3
Bluetooth Module: Hc-05

I am making a Football Playing Robot, i am controlling three servo’s , 1x 180 degree servo used for kicking the ball, 2x 360 degree servo as wheels. The problem are as mentioned in the topic frequent timeouts but sometimes the code does work smoothly, but often there are timeouts and package too big errors.
I believe it is due to alot of code being written in the blynk write (V1). Further detail’s are written in code.

 // Note To Tester
// 1. Read void setup() first before going to code.
// 2. The code is implemented using hc 05 on arduino uno.
// 3. The app used is Blynk , which is available on android, the reason for selection is that joystick and buttons are both present 
// 4. For Testing Only Kicker Servo Is Attached Whose Behaviour Is Monitored, The left and right servo's are only for stub testing and are not attached.
// 5. BLYNK_WRITE() is used to read data from buttons and sensors in blynk app, the paramter is the digital pin assigned to the button/joystick/sensor
// 6. BLYNK_WRITE() programs run parallel with each other
// 7. Errors Occuring Are Login Timeout, Packet too big , disconnecting and reconnecting of hc 05
#define BLYNK_PRINT Serial
#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>
#include <Servo.h>
SoftwareSerial MyBlue(5, 6); // RX | TX 
char auth[]= "9Itekdu3vf_B_3YmNxxHu9G3Bs_1IWs9";
Servo myservoKICKER; //responsible for kicking the ball, can only move 180 degree
Servo myservoLEFTWHEEL;
Servo myservoRIGHTWHEEL; // left and right 360 degree countinuos rotation servo's that act as wheels
int xAxis; //x-axis of joystick
int yAxis; //y-axis of joystick
BLYNK_WRITE(V1) // These are virtual pins which are connected to joystick in the blynk app
{
xAxis =param[0].asInt();
yAxis= param[1].asInt();
Serial.print("X = ");
Serial.print(xAxis);
Serial.print("Y = ");
Serial.println(yAxis);

// The values of x-axis and y-axis of joystick determines how the left and right wheel would move

if (xAxis > 400 && xAxis < 600 && yAxis > 400 && yAxis < 600)
  {
      myservoLEFTWHEEL.detach();
      myservoRIGHTWHEEL.detach();
      myservoKICKER.detach();
  }

  // FORWARDS FAST
  else if (xAxis > 400 && xAxis < 600 && yAxis > 1018 && yAxis <= 1023)
  {
      myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (180);
      myservoRIGHTWHEEL.write (0);
  }

  // BACKWARDS FAST
  else if (xAxis > 400 && xAxis < 600 && yAxis >= 0 && yAxis < 5)
  {
      myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (0);
      myservoRIGHTWHEEL.write (180);
  }

  // LEFT FAST
  else if (xAxis >= 0 && xAxis < 5 && yAxis > 400 && yAxis < 600)
  {
      myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (0);
      myservoRIGHTWHEEL.write (0);
  }

  // RIGHT FAST
  else if (xAxis > 1018 && xAxis <= 1023 && yAxis > 400 && yAxis < 600)
  {
      myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (180);
      myservoRIGHTWHEEL.write (180);
  }

  // FORWARDS MEDIUM
  else if (xAxis > 400 && xAxis < 600 && yAxis > 750 && yAxis < 1018)
  {
      myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (110);
      myservoRIGHTWHEEL.write (70);
  }

  // BACKWARDS MEDIUM
 else if (xAxis > 400 && xAxis < 600 && yAxis > 5 && yAxis < 250)
  {
      myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (70);
      myservoRIGHTWHEEL.write (110);
  }

  // LEFT MEDIUM
  else if (xAxis > 5 && xAxis < 250 && yAxis > 400 && yAxis < 600)
  {
      myservoRIGHTWHEEL.attach(10);

      myservoRIGHTWHEEL.write (70);
  }

  // RIGHT MEDIUM
  else if (xAxis > 750 && xAxis < 1018 && yAxis > 400 && yAxis < 600)
  {
      myservoLEFTWHEEL.attach(9);

      myservoLEFTWHEEL.write (110);
  }

  // FORWARDS SLOW
  else if (xAxis > 400 && xAxis < 600 && yAxis > 600 && yAxis < 750)
  {
      myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (100);
      myservoRIGHTWHEEL.write (80);
  }

  // BACKWARDS SLOW
 else  if (xAxis > 400 && xAxis < 600 && yAxis > 250 && yAxis < 400)
  {
      myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (80);
      myservoRIGHTWHEEL.write (100);
  }

  // LEFT SLOW
  else if (xAxis > 250 && xAxis < 400 && yAxis > 400 && yAxis < 600)
  {
      myservoRIGHTWHEEL.attach(10);

      myservoRIGHTWHEEL.write (80);
  }

  // RIGHT SLOW
 else if (xAxis > 600 && xAxis < 750 && yAxis > 400 && yAxis < 600)
  {
      myservoLEFTWHEEL.attach(9);

      myservoLEFTWHEEL.write (100);
  }      

  //  FORWARDS LEFT FAST
  else if (xAxis >= 0 && xAxis < 5 && yAxis > 1018 && yAxis <= 1023)
  {
      myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (115);
      myservoRIGHTWHEEL.write (0);
  }

  // FORWARDS RIGHT FAST
  else if (xAxis > 1018 && xAxis <= 1023 && yAxis > 1018 && yAxis <= 1023)
  {
      myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (180);
      myservoRIGHTWHEEL.write (65);
  }

  // BACKWARDS LEFT FAST
  else if (xAxis >= 0 && xAxis < 5 && yAxis >= 0 && yAxis < 5)
  {
      myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (65);
      myservoRIGHTWHEEL.write (180);
  }

  // BACKWARDS RIGHT FAST
  else if (xAxis > 1018 && xAxis <= 1023 && yAxis >= 0 && yAxis < 5)
  {
      myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (0);
      myservoRIGHTWHEEL.write (115);
  }

  //  FORWARDS LEFT MEDIUM
 else if (xAxis > 5 && xAxis < 400 && yAxis > 600 && yAxis < 1018)
  {
      myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (105);
      myservoRIGHTWHEEL.write (0);
  }

  // FORWARDS RIGHT MEDIUM
 else if (xAxis > 600 && xAxis < 1018 && yAxis > 600 && yAxis < 1018)
  {
      myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (180);
      myservoRIGHTWHEEL.write (75);
  }

  // BACKWARDS LEFT MEDIUM
  else if (xAxis > 5 && xAxis < 400 && yAxis > 5 && yAxis < 400)
  {
       myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (75);
      myservoRIGHTWHEEL.write (180);
  }

  // BACKWARDS RIGHT MEDIUM
 else if (xAxis > 600 && xAxis < 1018 && yAxis > 5 && yAxis < 400)
  {
      myservoLEFTWHEEL.attach(9);
      myservoRIGHTWHEEL.attach(10);

      myservoLEFTWHEEL.write (0);
      myservoRIGHTWHEEL.write (105);
  }

   }
    BLYNK_WRITE(V2){ // Fast Kicker Button: Responsible to move kicker servo 180 degree at a high speed
    int FastKick= param.asInt(); // Pressing This Button Sends 1 To Fast Kick Variable
    Serial.print(FastKick);
    if(FastKick == 1)
    {
      myservoKICKER.attach(11);
      delay(100);
      myservoKICKER.write (90);
      delay(200);
      myservoKICKER.write (160);
      delay(200);
      myservoKICKER.detach();
     }      

     }

     BLYNK_WRITE(V3) {  // kicker calibration button: used to calibrate kicker servo to exactly 90 degree's
     int KickerCalibration= param.asInt();
     if(KickerCalibration == 1) // Pressing This Button Sends 1 To Kicker Calibration Variable
     {
      myservoKICKER.attach(11);
      delay(100);
      myservoKICKER.write (90);
      delay(200);
      
      }   
      }

      BLYNK_WRITE(V4) { //Used To Calibrate Left And Right Wheels
      int WheelCalibration= param.asInt();
      if(WheelCalibration == 1) // Pressing This Button Sends 1 To Kicker Calibration Variable
       {
      myservoLEFTWHEEL.attach(2);
      myservoRIGHTWHEEL.attach(3);
      delay(100);          
      myservoLEFTWHEEL.write (90);
      myservoRIGHTWHEEL.write (90);
      delay(30000);
      
  }   
  }


     void setup() {
     // put your setup code here, to run once:
        myservoLEFTWHEEL.attach(9);   //1
        myservoRIGHTWHEEL.attach(10);  //2
        myservoKICKER.attach(11);   //3

    // detach servos to avoid jitter on power up
       myservoLEFTWHEEL.detach();
       myservoRIGHTWHEEL.detach();
       myservoKICKER.detach();

       Serial.begin(9600);
       MyBlue.begin(9600); // Default communication rate of the Bluetooth module
       Blynk.begin(MyBlue, auth);
       Serial.println("Waiting for connections...");
       Blynk.syncVirtual(V1);
       Blynk.syncVirtual(V2);
       }

       void loop() {
       Blynk.run();
       }

You might be better using something with a bit more processing power - an ESP32 maybe?

Pete.

i want simple circuitry, esp32 cannot provide 5v supply voltage and so i would need an additional boost/buck converter/voltage regulator to regulate the voltage and supply to the servo seperately.

The point I was making is that the Arduino’s processing power/clock speed, combined with the need to use SoftwareSerial to communicate with the external Bluetooth module (not needed with the ESP32s built-in Bluetooth) probably isn’t capable of handling the processing you’re doing in the BLYNK_WRITE callbacks.
You could test this by using a more powerful processor.

If that solves your problem then you have a choice - use an Arduino and have a system that doesn’t work, or use something faster that does work.

Pete.

Thanks…I’ll see to another alternative.