Want to make an RC plane with the help of node mcu

I want to make an RC plane with node mcu (ESP8266Wifi), 1 ESC and 1 brushless motor instead of arduino. I am using mobile application (Blynk app) to control the plane instead of remote controller and reciever. i am done with the wiring and took code from internet. But I think code isnt working well. I am attaching my code here. Please help me with it. And if any one having ready code for this please feel free to share.

/*

  • RoboRemoEasySketch by Laurens Korste from boktorrobotica.nl
  • Modify this sketch and upload it to a ESP8266 divice sush as NodeMCU, Wemos D1, Wemos D1 MINI, ESP12 etc..
  • You can uses all ASSII characters so more then 200 different actions.
  • Whith this sketch it is not possible to sent numbers bigger then 9 or strings (words) unless you modify the sketch.
  • If you want to sent strings of big numbers, look for another sketch for example on roboremo.com
  • This is a WiFiServer. From divice setting choice RoboRemo as WiFi-connection. If you like you can add a password
  • If sketch uploaded, start the Arduino serial monitor where you can read the IP-adres then:
  • From the RoboRemo-app choice menu => connect => Internet (TCP) => other (if not exist) => fillin IP-adres
    */
    #include <ESP8266WiFi.h>
    #include <WiFiClient.h>

// config:
const char *ssid = "RoboRemo"; // You have to connect your phone to this Access Point
const char *pw = ""; // and this is the password
IPAddress ip(192, 168, 0, 1); // Part1 of the RoboRemo connection
IPAddress netmask(255, 255, 255, 0);
const int port = 1234; // Part2 of the RoboRemo connection => part 1+2 together => 192.168.0.1:1234

WiFiServer server(port);
WiFiClient client;

void setup() {
//declare here the IO pins. Add more if necessary.

pinMode(BUILTIN_LED,OUTPUT); // builtin LED declaration Wemos MINI same as 2

for(int i=0; i<5;i++){ //builtin led flashes 5 times so you can control the operation
digitalWrite(BUILTIN_LED,HIGH);
delay(100);
digitalWrite(BUILTIN_LED,LOW);
delay(100);
}

Serial.begin(115200);

WiFi.softAPConfig(ip, ip, netmask); // configure ip address for softAP
WiFi.softAP(ssid, pw); // configure ssid and password for softAP

server.begin(); // start TCP server

Serial.println("ESP8266 RC receiver 1.1 powered by RoboRemo");
Serial.println((String)"SSID: " + ssid + " PASS: " + pw);
Serial.println((String)"RoboRemo app must connect to " + ip.toString() + ":" + port);
}

void loop() {
// continu lokong for client
if(!client.connected()) {
client = server.available();
return;
}

// If client connected
if(client.available()) {
Serial.println("connect client with code:"); //mesage to (Arduino) serial monitor
char c = (char)client.read(); // read char from client (RoboRemo app)
Serial.println(c);
//If Roboremo send 'A' then BUILTIN_LED on, with "1" off.
//RoboRemo can generate this characters with a button => "set press action" of "set release action".
if ( c=='A'){
digitalWrite(BUILTIN_LED,HIGH);
}
if (c=='1') {
digitalWrite(BUILTIN_LED,LOW);
}
}
}

Thanks.

You are probably right.

But help us out by telling us:

What does it do, or not do, that it shouldn’t, or should?

a7

1 Like

basically it should turn left and right using servo motors also speed of bldc motors should be controlled by me
most importanatly it should be controlled by mobile application because i dont want to use remote controllers.

hi macro-controller,
welcome to the forum.
I'm sorry to have to say this but IMHO trying to control an RC-plane with Blynk is a bad idea.
Blynk has some limitations about how fast and how often you can send data over Blynk.

A RC-plane needs a permanent and extra-reliably remote-connection to be safe.
If you send commands to Blynk too fast Blynk will disconnect and then your plane will crash. Re-connecting will need at least some seconds which is way to long to catch up and rescue your RC-plane again.

I know how much fun RC-flying can be because I'm doing it myself. But experimenting in this way with a plane carries a high danger of fails and frustration. If you still insist on trying it I recommend changing to an RC-car. If the connection fails the car will stop or bump into an obstacle. As long as the car is not too fast and / or the car is robust the collision with anything will not cause any damage.

If you have no experience RC-flying yet and your main goal is flying RC at low cost I recommend buying a used RC-plane from a private person manufactured from Horizon hobby with SAFE S)ensor A)ssisted F)light E)nvelope.

Depending on at how much wind you want to fly you could buy

low blowing wind: 0 to 10 mph Sport Cub S 2 BNF Basic with SAFE Timber UMX
or a XK A800 4CH 780mm 3D6G electric RC-sailplane

medium wind 10 to 20 mph Mini Apprentice or Conscendo

strong wind: 10 to 40 mph Apprentice S15E

I want to emphasise: a used RC-plane. Used the cost will be 2/3 or half of new.

Without a stabilisation-system like SAFE you will have a hard time learning to fly in general and with a system trying to control a RC-plane from a smartphone it will be ultra-hard.

You can find videos where people built RC-remote-controlsystems for RC-flying based on nRF24 tranceivers which are very cheap but range is pretty limited. and those systems don't have the same reliability than a "professional" RC-System.

If your main goal is having fun using you smartphone to control something I recommend an RC-car or anything that does not move because fails won't cause any damage.

I enjoy giving support in all directions. So if you write more about what your goals are:

  • learning to program on an interesting fun making project

  • low-cost RC-flying

I can make suggestions.

best regards Stefan

2 Likes

Yes thank u for your suggestion i will surely work on this in future but currently i am working on this RC plane and i am done with the wiring stuff so i want to complete it first with mobile application as many people are unable to do this.
So if u can help with the code it would again be a great help.
Thank You.

Given the apparent risks of using a mobile and blynk for an RC aeroplane application that would appear to be a good thing.

@srnet: Not sure what you mean by "that"

So what you want to say is
Given the apparent risks of using a mobile and blynk for an RC aeroplane application

"completing it first with mobile application as many people are unable to do this"

would appear to be a good thing.

?

turning left / right by rudder or by ailerons or both?
regardless of which controlsurfaces (rudder/aileron) you use elevator is nescessary too.
It is not enough to change rpm of the propeller to control flying height.

As soon as you turn rudder or aileron or both the nose will turn down a bit and to compensate on nose turning down requires elevator.

Those very tiny remote-control airplanes that don't have controlsurfaces at all use differential thrust through two motors to turn left /right and increase / decrease rpm to gain or loose height.

Do you already have an airframe ? If yes post a picture.
best regards Stefan

I want to control it with rudder only

So according to you which method is preferable? Using servos or using elevators ?

Thanks for reply.

Am not done with it yet but was planning to control ruddders using servos and hence wanted the code accordingly.

all three are control-surfaces that are usually push/pulled by RC-servos
image

Rudder-only control with a less than reliable control system is best used on an airplane designed for free-flight without any control input. A lot of the early experiments with radio control involved a similar situation.

Have you considered that many people have been unable to do that because it simply does not work reliably?

You still haven’t said what is actually wrong with the code you are working on.

We understand your vague description, you want code to fly an airplane.

To help you, it’s going to take a bit more Effort on your part.

But I am with everyone else here. Slow your roll, there may be good reasons why no one Blynks an r/c airplane.

But if we have to get your code working so you can see how dumb an idea it is as a practical matter, you are going to have to meet us more than halfway.

What understanding of the code you found somewhere do you have? Again

What does it do, or not do, that it shouldn’t, or should?

a7