[SOLVED] Need help for rc plane flight controller

Hi Guys.

I have developed an esp8266/nodemcu flight controller for RC Planes. Everything is working fine. But I need to incorporate a logic that when ever WiFi gets disconnected I want all the gpio’s to go low(don’t want my plane to fly away). Please if someone can share a code snippet and suggest where to include that so that as soon my plane is disconnected from my phone(acting as transmitter) my plane stops and glides down.
I will soon share my project which is otherwise tested and is working amazingly!

Hi,
I think I would use the Blynk.connected() function for this purpose, you can find more details here:

http://docs.blynk.cc/#blynk-firmware-connection-management

And I’d add a Label showing the Wi-Fi signal to be able to notice the range available. It’s really easy and useful.

Ok will look into it. But does anyone have a sample code in which they are switching relay or led etc based on wifi connection and with minimum delay?. That will be very helpful.

Hi,

I can provide some pieces of code from one of my projects:

I check every 10000ms for connection using SimpleTimer library.

Hope that helps,

Andreas

#include <BlynkSimpleEsp8266.h>
#include "SimpleTimer.h"

SimpleTimer     CheckConnectionTimer;
int             CheckConnectionId;


void CheckConnectionProc()
{
  if (!Blynk.connected()) {
    if(Blynk.connect()) {
      Serial.println("Reconnected");
      BLYNK_LOG("Reconnected");
    } else {
      Serial.println("Not Reconnected");
      BLYNK_LOG("Not reconnected");
    }
  }
}

void setup()
{
  Serial.begin(115200);

  CheckConnectionId = CheckConnectionTimer.setInterval(10000L, CheckConnectionProc);
}


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

Thanks @vactirio looks like this can help!

You should check out one of the ESP-32 boards that have an external antenna connection for better range.
I’m hoping you are testing this in an unpopulated area, so as to avoid stray signals/congestion and avoid hitting anyone!
Be cool if this works though and has decent range!

Or one of the tried and tested ESP8266’s that have external antenna connections i.e. the WeMos D1 Mini Pro.

Check out the new ESP32 dev boards. They have a stronger WIFI frequency and also 2 cores.

Even attached a GSM module and you could fly well out of range.

@Costa, @Tropicexposure Yes I have kept an eye on them. But waiting for there price to come down. About range let me say i am getting way better result than expected. I have tested it a big football ground and there was’t any issue that’s why still stuck with it, I will move to other board in future surely but not for range issue. my target is to come up with affordable and easy to fly RC plane for everyone

@vactirio implemented this code and its working!:blush:

Check out diymall on ebay they got ESP-32 for less than $20.00
What size plane are you putting this on?

Hi @ather86. Glad the code helped you.
Please give me a hint.
Both RC plane and RC control are connected on the internet or do you use a local Blynk Server?

@vactirio
yes for now both are connected to internet. Though I am working not multiple schematics like

  1. Using phone as controller(Tx) and esp as RX(obvious) and both connected to internet wifi.(So far no issues in this setup). If I found more than usual delays then can setup a local blynk server

2 Other beign using the ESP wifi only(without internet & Blynk) just connect to esp wifi and fly. This will enable users to fly in remote areas with no internet connectivity.

Hope this help…plz feel free to ask any thing else…

Hi @ather86 ,
Very interesting project.
Maybe You could use directional antennas (like yagi) for longer range, but You must always point the antenna into the RC Plane.
Btw, if the left joystick widget could work like mode 2 transmitter (Y-axis free to move, X-axis always centered) it would be awesome.
Looking forward for your code, while busy slicing foamboard with FIiteTest plans :slight_smile:

@trogalko
As told earlier range is not at all a issue for now in my testing(but in worst case there is a provision to aldd 2.4Ghz radio control chip too)
Since the plan is to keep it simple and cheap will not take any changes unless its mandatory.
I am using two joysticks widgets in blynk. One for throttle and other for rudder(X axis) and (Y axis) for Elevators. I think that’s nearest to Mode2.
Will post the code, there is still scope of refinement where ppl like u can pitch in as my coding skill doesn’t match my electronics skill.

HI Could you please share the RC plane code.

Guys please help me. i am not able to write perfect code for rc plane.
i have 4 servos and 1 brushless motor on board. 2 for allerons and 2 for elevators.
and on remote their are 2 joysticks for 4 servos . 1 potentometer for brushless motor.
and connection is like that.
nano is connected to node mcu on remote and same on plane.
please help me. None of my all codes are perfectly working.