How can i control quadcopter with blynk and nodemcu esp8266?

i am facing many errors while writing code for nodemcu on arduino ide i need help! i want to make drone reciver with nodemcu esp8266 and blynk app transmitter.

Posting your whole sketch might help.

Okay.

#define BLYNK_PRINT Serial
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>
#define BLYNK_AUTH_TOKEN "2T-Iv5jVEBwrvW7zfwLkFnXnyspPSD3W" //Enter your blynk auth token

char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "--0----";//Enter your WIFI name
char pass[] = "---------";//Enter your WIFI password

Servo motor1;
Servo motor2;
Servo motor3;
Servo motor4;


int motor1Speed = 0; // Speed of motor 1
int motor2Speed = 0; // Speed of motor 2
int motor3Speed = 0; // Speed of motor 3
int motor4Speed = 0; // Speed of motor 4

void setup() {
  motor1.attach(D0);
  motor2.attach(D1);
  motor3.attach(D2);
  motor4.attach(D4);
  Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
}

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

BLYNK_WRITE(V1) {
    motor1Speed = param[0].asInt();
    motor1Speed = map(motor1Speed, 0, 1023, 1000, 2000);
    motor1.writeMicroseconds(motor1Speed);
}

BLYNK_WRITE(V2) {
    motor2Speed = param[0].asInt();
    motor2Speed = map(motor2Speed, 0, 1023, 1000, 2000);
    motor2.writeMicroseconds(motor2Speed);
}

BLYNK_WRITE(V3) {
    motor3Speed = param[0].asInt();
    motor3Speed = map(motor3Speed, 0, 1023, 1000, 2000);
    motor3.writeMicroseconds(motor3Speed);
}

BLYNK_WRITE(V4) {
    motor4Speed = param[0].asInt();
    motor4Speed = map(motor4Speed, 0, 1023, 1000, 2000);
    motor4.writeMicroseconds(motor4Speed);
}

blynk-cloud.com” is the old blynk server. The new blynk server is"blynk.cloud".
Also, there’s no need to specify a server, just add the

#define BLYNK_TEMPLATE_ID           "TMPLxxxxxx"
#define BLYNK_DEVICE_NAME           "Device"
#define BLYNK_AUTH_TOKEN            "YourAuthToken"

At the top of your sketch and use

Blynk.begin(auth, ssid, pass);

Instead.

1 Like

Are you aware that the Blynk app doesn’t talk directly to the NodeMCU?
The NodeMCU needs to connect to a WiFi signal so that it can talk to the Blynk server, and the phone running the Blynk also needs to talk to the Blynk server - either via WiFi or a mobile data network.

This means that your quadcopter needs to be in range of an internet connected WiFi network at all times.

Pete.

yes i know .
can you help me with it

Do as @John93 has said.

Pete.

tried it but not working

Do you have the latest version of the blynk library installed (1.1.0)?

let me check.

Post your full code, and the serial monitor output when you run that code.

Pete.

#define BLYNK_PRINT Serial
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>
#define BLYNK_AUTH_TOKEN "2T-Iv5jVEBwrvW7zfwLkFnXnyspPSD3W" //Enter your blynk auth token

char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "--0----";//Enter your WIFI name
char pass[] = "---------";//Enter your WIFI password

Servo motor1;
Servo motor2;
Servo motor3;
Servo motor4;


int motor1Speed = 0; // Speed of motor 1
int motor2Speed = 0; // Speed of motor 2
int motor3Speed = 0; // Speed of motor 3
int motor4Speed = 0; // Speed of motor 4

void setup() {
  motor1.attach(D0);
  motor2.attach(D1);
  motor3.attach(D2);
  motor4.attach(D4);
  Blynk.begin(auth, ssid, pass);
}

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

BLYNK_WRITE(V1) {
    motor1Speed = param[0].asInt();
    motor1Speed = map(motor1Speed, 0, 1023, 1000, 2000);
    motor1.writeMicroseconds(motor1Speed);
}

BLYNK_WRITE(V2) {
    motor2Speed = param[0].asInt();
    motor2Speed = map(motor2Speed, 0, 1023, 1000, 2000);
    motor2.writeMicroseconds(motor2Speed);
}

BLYNK_WRITE(V3) {
    motor3Speed = param[0].asInt();
    motor3Speed = map(motor3Speed, 0, 1023, 1000, 2000);
    motor3.writeMicroseconds(motor3Speed);
}

BLYNK_WRITE(V4) {
    motor4Speed = param[0].asInt();
    motor4Speed = map(motor4Speed, 0, 1023, 1000, 2000);
    motor4.writeMicroseconds(motor4Speed);
}

This is the full code and it is showing and the serial monitor is showing following-
��l���l$�H<XO�Y:z6b���H�l�h��lb<l�42h$��2dN

You should add this to the beginning of your void setup…

Serial.begin(74880);

and set your serial monitor to 74880 baud.

Pete.

now it si showing

        /___/ v1.1.0 on ESP8266

 #StandWithUkraine    https://bit.ly/swua


[9825] Connecting to blynk-cloud.com:80
[15843] Connecting to blynk-cloud.com:80
[21845] Connecting to blynk-cloud.com:80
[27850] Connecting to blynk-cloud.com:80
[33856] Connecting to blynk-cloud.com:80

Okay, well the code that you posted in post #12 doesn’t have the changes that @John93 told you to make in post #4 and which you said you’d tried.

Pete.

it is showing same thing!

#define BLYNK_PRINT Serial
#include <BlynkSimpleEsp8266.h>
#include <Servo.h>

#define BLYNK_TEMPLATE_ID "TMPLWeZBiMUM"
#define BLYNK_DEVICE_NAME "UR Drone"
#define BLYNK_AUTH_TOKEN "2T-Iv5jVEBwrvW7zfwLkFnXnyspPSD3W"

char auth[] = BLYNK_AUTH_TOKEN;
char ssid[] = "realme 5i";//Enter your WIFI name
char pass[] = "sambhavjain";//Enter your WIFI password

Servo motor1;
Servo motor2;
Servo motor3;
Servo motor4;


int motor1Speed = 0; // Speed of motor 1
int motor2Speed = 0; // Speed of motor 2
int motor3Speed = 0; // Speed of motor 3
int motor4Speed = 0; // Speed of motor 4

void setup() {
Serial.begin(74880);  
  motor1.attach(D0);
  motor2.attach(D1);
  motor3.attach(D2);
  motor4.attach(D4);
  Blynk.begin(auth, ssid, pass);
}

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

BLYNK_WRITE(V0) {
    motor1Speed = param[0].asInt();
    motor1Speed = map(motor1Speed, 0, 1023, 1000, 2000);
    motor1.writeMicroseconds(motor1Speed);
}

BLYNK_WRITE(V1) {
    motor2Speed = param[0].asInt();
    motor2Speed = map(motor2Speed, 0, 1023, 1000, 2000);
    motor2.writeMicroseconds(motor2Speed);
}

BLYNK_WRITE(V2) {
    motor3Speed = param[0].asInt();
    motor3Speed = map(motor3Speed, 0, 1023, 1000, 2000);
    motor3.writeMicroseconds(motor3Speed);
}

BLYNK_WRITE(V3) {
    motor4Speed = param[0].asInt();
    motor4Speed = map(motor4Speed, 0, 1023, 1000, 2000);
    motor4.writeMicroseconds(motor4Speed);
}

That’s because @John93 told you to…

but you chose to add these three lines of code further down your sketch instead.

Pete.