Erratic behaviour of my motors - Bluetooth communication

Hello everyone,

I have a strange issue when i use blynk via bluetooth to control my 3 brushless motors.

Indeed, their behaviour is erratic : they seem to respond to my command (or not) but they also can move on their own for a short period of time (100 ms) and then stop.

I must say I’m confused about where the problem is. I have tested the motors and they work just fine when i command them with the serial monitor, without blynk.

Is something interfering ? Am I doing something wrong ?
Here is the code i use with blynk :

#define BLYNK_PRINT Serial

#include <SoftwareSerial.h>
SoftwareSerial SwSerial(2, 3); 

#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>
#include <Servo.h>

char auth[] = "5fb61e3536ef41b389202c0c232e62e1";

SoftwareSerial SerialBLE(2, 3);

Servo left_servo;
Servo middle_servo;
Servo right_servo;

int left_value = 90;
int middle_value = 90;
int right_value = 90;

BLYNK_WRITE(V0) 
{
  left_value = param.asInt();
  left_servo.write(left_value);
  Serial.println(left_value);
} 
BLYNK_WRITE(V1) 
{
  middle_value = param.asInt();
  middle_servo.write(middle_value);
  Serial.println(middle_value);
} 
BLYNK_WRITE(V2) 
{
  right_value = param.asInt();
  right_servo.write(right_value);
  Serial.println(right_value);
} 

void setup()
{
  left_servo.attach(9);
  middle_servo.attach(10);
  right_servo.attach(11);
  delay(15);

  left_servo.write(90); //for calibration
  middle_servo.write(90);
  right_servo.write(90);
  delay(15);

  Serial.begin(9600);
  
  SerialBLE.begin(9600);
  Blynk.begin(SerialBLE, auth);

  Serial.println("Waiting for connections...");
}

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

I’m using Arduino UNO and HC06 for bluetooth communication with my android phone.
I have the latest version of Blynk (the one from a few days ago).

If you could help me with that, i have tried all sorts of modifications but I couldn’t solve the problem.
Thank you very much !

Hello again,

I have carried on my investigation and found something interesting.
I have decided to connect only my 3 motors and to unplug my bluetooth card (therefore it’s not responsible for the issues).
Then I use a minimal code :

#define BLYNK_PRINT Serial

#include <SoftwareSerial.h>
SoftwareSerial SwSerial(2, 3);

#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>
#include <Servo.h>

char auth[] = "5fb61e3536ef41b389202c0c232e62e1";

SoftwareSerial SerialBLE(2, 3);

Servo left_servo;
Servo middle_servo;
Servo right_servo;

void setup()
{
  left_servo.attach(9);
  middle_servo.attach(10);
  right_servo.attach(11);
  delay(15);

  left_servo.write(90); //for calibration (90 = neutral position)
  middle_servo.write(90);
  right_servo.write(90);
  delay(10000); //the motors are quiet up to this point

  Serial.println("Connection...");

  Serial.begin(9600);

  SerialBLE.begin(9600);
  Blynk.begin(SerialBLE, auth); //IT IS WHERE ALL STARTS !
}

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

Guess what?
The motors are quiet up to the Blynk.begin() function. Since this point, they start doing weird things and more specifically, they move each quickly (100 ms) each time a “connecting…” message is displayed on the serial monitor. How is it possible that Blynk is making my motors move ?
My motors are connected on the 9,10,11 pins and the bluetooth (which is unplugged) is supposed to be connected to the 2,3 pins.
Is my arduino responsible for this weird behaviour ?
I’m even more confused…
Thanks for your help,

Search this forum for keywords like Servo and Jitter

Thanks for the quick reply,

I have tried to attach() and detach() my motors each time they receive a new value, but the result is that they don’t move anymore. It’s probably because i’m using a brushless motor and not a real servo, so if i unplug them they will stop spinning (which is not what i want).
Also, i have changed the used pins for my motors to 3,5 and 6 instead of 9, 10 and 11.
I’m reading the related posts, but is there another way to avoid this issue ?
Thanks !