Blynk disconnects often

im new to blynk

while using servo ,my connection often gets lost and connects after a while and it repeats

#include <Servo.h> 

// You could use a spare Hardware Serial on boards that have it (like Mega)
#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX

#include <BlynkSimpleStream.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "token";
BlynkTimer timer;
Servo myservo;
int mot_min = 90;   //min servo angle  (set yours)
int mot_max = 180; //Max servo angle   (set yours)
int pir;
int activated =0;

/* HC-SR501 Motion Detector */
int relayInput= 7; 
int LightsON = 8;
int pirValue; // Place to store read PIR Value
int pirSensor=2;

void setup()
  Blynk.begin(Serial, auth);
  pinMode(relayInput, OUTPUT);
    pinMode(LightsON, OUTPUT);
  pinMode(pirSensor, INPUT);
  digitalWrite(relayInput, LOW);
 // myservo.write(mot_min);  

  activated = 0;
  activated = 2;


void myTimerEvent1()
 if(activated !=2 && pir==1)
    int sensorValue = digitalRead(pirSensor);
    if(sensorValue == 1)
  if(activated ==2)
   int sensorValue = digitalRead(pirSensor);
   if(sensorValue == 1)

void loop()

How are you powering your servo? If from a pin on the device , then you are probably causing brownouts, and thus disconnection.

Google proper ways of hooking up servos.

i cant find anything new other than powering from the pin

can you suggest me some

Seriously?? :face_with_raised_eyebrow:

no improvement sir

And when left alone (no V3 write events) it disconnects too? How do you handle V3 events in app? (A slider? , a step widget?)


Then be sure to have turned on send on release option in APP.
Two possible cases came into my mind:

  1. a server flooding (hence the qustion about value change handling),
  2. a timer related issues (as servo uses PWM).

But I have not met such problems, so my points are only theoretical.

it would be nice to post a serial debug…