Wifi PPM (no App Needed)

8,039

39

74

I wanted to control my diy micro indoor quadrocopter with my smart phone but I couldn't find a good solution for this. I had a few ESP8266 wifi modules laying around so I decided to make my own one.

The program starts a wifi access point with a HTML 5 website to control the PPM signal. The PPM signal is generated by interrupt.

Thanks to HTML5 you can control your RC device with any smart phone without any app.

You can also connect to the website with a PC and use a joystick for controlling. At the moment this works only in Firefox.

In this inscrutable I will explain how to set up the ESP8266 and how to configure the receiver in Betaflight.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Parts List

Let's start with the parts list. You just need a few components:

- ESP8266: Any module should work. I use the ESP 12-F module: http://www.watterott.com/de/ESP8266-ESP-12F-WiFi/W...

- a 3,3V USB to Serial converter for uploading the scetch the first time. (After the first upload you can use the OTA update). Use Something like this: https://www.banggood.com/de/RobotDyn-USB-Serial-A...

- a 3,3V voltage regulator: The ESP8266 needs 3,3V. Any voltage above 3,6V will kill the device. It can also drop about 200mA peak current. If you don´t have a strong enough 3,3V supply at your RC model you need an additional voltage regulator. I use this step down regulator with a 3,9K Ohm resistor: http://www.produktinfo.conrad.com/datenblaetter/15...

- a PC with Arduino IDE: https://www.arduino.cc/en/Main/Software

- ESP8266 support for Arduino IDE. Follow these instructions: https://learn.sparkfun.com/tutorials/esp8266-thing...

- Websocket library for Arduino: https://github.com/Links2004/arduinoWebSockets

- Maybe a 3,3V/5V level shifter if your PPM decoder doesn´t support 3,3V inputs. For most quadcopter flight controllers you don´t need this.

- The WifiPPM scetch: Download file below or https://goo.gl/Qj5Gwb

- A smart phone or a PC with a joystick and Firefox

Step 2: Set Up the Electronics and Upload the Program

The first thing to do is to set the power connections to the ESP8266. You can see the wiring in the picture. Make the following connections:

RST, EN and VCC to 3,3V

GPIO15 and GND to GND

Put a small capacitor between VCC and GND (about 100 nF)

TXD to RXD of your USB2Serial device

RXD to TXD of your USB2Serial device

Put GPIO0 to GND while powerup to enter the flash mode.

After you have installed the Arduino IDE, the ESP8266 support and the websocket library open the sketch. Hold GIO0 to GND while powering up the ESP8266 to enter the flash mode. Now you can upload the sketch.

After you have uploaded the sketch, the controller will reset. You should find a WIFI Access Point named WifiPPM. If this is OK you can power down the chip and disconnect the TXD, RXD and GPIO0 wires. In the future you can update the program over OTA. To do so connect to the Access Point and go to "192.168.1.4/update" in your web browser.

Step 3: Website

Now you can connect GPIO5 to the PPM input of your flight controller or whatever you use to decode the PPM signal.

After powering up the module you can connect to the Access Point "WifiPPM". There is no password. Open the address 192.168.4.1 in your browser.

You will see the site of the first picture. On a touch device you can control the sticks with your touch screen.

If you open the site with a PC you must use Firefox. As soon as you connect a joystick, the site will change to the one you can see at the second picture. You can control the sticks with your joystick.

In the next step I will explain how to set up Betaflight, because I use it. If you use some other controller you have to go on yourself from now on.

Step 4: Setting Up Betaflight

I use the WifiPPM controller for my quadcopter with Betaflight. I explain now how to set it up.

- Connect your flight controller to the PC

- open Betaflight

- connect to the flight controller

- go to Receiver tab

- type RTAE1234 into the channel map field

- change the "Stick Low Threshold" to 1020, the "Stick Center" to 1500 and the "Stick High Threshold" to 1980

- save the changes

- open the wifiPPM website with your mobile phone and test if the adjustment is OK

Thats it. You are done. Now you can fly with your mobile phone without any additional app.

Remote Control Contest 2017

Participated in the
Remote Control Contest 2017

3 People Made This Project!

Recommendations

  • Made with Math Contest

    Made with Math Contest
  • Multi-Discipline Contest

    Multi-Discipline Contest
  • Robotics Contest

    Robotics Contest

74 Discussions

None
soxprpr

Question 5 weeks ago

Hello Andi,
Is there anywhere to add sensor like DHT22 temperature sensor, and display the value on the webpage by using Asyncserver.
Thank you.

1 answer
None
Andi23456soxprpr

Reply 4 weeks ago

You can add any sensor to the source code. Send the sensor readings via websocket and change the webpage to display the readings. Put the sensor readings in a unique string and send it with the function "webSocket.broadcastTXT(StringToSend)". The function to handle the incoming message in the index.html.c is "connection.onmessage = function (e){}" (Line 147).

None
amanjaiswal210

Question 3 months ago

i am making a quadcopter using arduino nano, mpu6050 and nodemcu as a ppm receiver with multiwii gui .I uncomment all the necessary line. when i connected to wifippm and open the firefox and move the joystic but nothing showing in the multiwii gui. please help

1 answer
None
Andi23456amanjaiswal210

Answer 3 months ago

Hello. Can you connect to the WifiPPM Access point? Is the nodemcu running allright? If you have an oscilloscope you can check the signal at GPIO5 and GPIO4. Check if the timing is alright. Is CPU_MHZ in your WifiPPM sketch similar to the adjustment of your esp8266
nodemcu? You can set/check the clock speed in "Tools->CPU Frequency"
in Arduino IDE. You also need a good power supply. Have a look at the answers of the comment of Nazzz. He had the problem that nodeMCU always restarted because of too weak 3,3V power.

None
Nazzz

9 months ago

Hello Andi,

I am trying to build an arduino quadcopter using arduino nano flashed with multiwii firmware with mpu6050 connected and esp8266 nodemcu as reciever with ppm signal. I have followed you article wifi ppm (No app needed) and connected the gpio 5 of esp to the pin D2 of the arduino nano and also uncommented the following lines in multiwii config.h file.
#define QUADX
#define NANOWII
#define SERIAL_SUM_PPM ROLL,PITCH,THROTTLE,YAW,AUX1,AUX2,AUX3,AUX4,8,9,10,11

But I am not getting any results, motors are not rotating also the changes are showing in multiwii config gui. I feel the esp is not communicating with arduino. But I have checked the signal at esp gpio pin 5 I am getting the signals i am not getting where i am missing. Kindly help me with this.

Thank You

15 replies
None
Andi23456Nazzz

Reply 9 months ago

Hello,
can you connect to the Access Point of WIFIPPM? Is the website working? If yes, do you have an oscilloscope? Then you can check the signals at GPIO5. If you don't have an oscilloscope you can measure the frequency on GPIO4 and GPIO5. If the signal is OK, it is some problem of the MultiWii controller or software, but I never used it myself, so I can't help you with that. Which voltage is the Arduino working with? Maybe the 3,3 Volt output level of the ESP is too low for the Arduino.

None
NazzzAndi23456

Reply 9 months ago

Hello,

Thank you for your response, yes i have connected to the access point in my mobile and site is working also i have checked the signal at GPIO5, signal is also fine but when i gave the signal to the arduino pin D2 am not getting the results in terms of motor rotation. Does arduino nano flased with multiwii code accepts the ppm in and processes the signal or do i need to use extra hardware or need to change in multiwii code.

If i need to uncomment some lines in multiwii code can you please guide me which are those. I am using quad-x with esp8266 nodemcu with the wifi ppm code flased in esp.

Has anyone flyied the quad using arduino nano with esp using wifi ppm and multiwii code. can you please give me some idea about it.

Does your wifi ppm code provided above works with multiwii code?

Thank You

None
Andi23456Nazzz

Reply 9 months ago

Are you sure the timings are alright. Is the #define CPU_MHZ in your WifiPPM sketch similar to the adjustment of your esp8266 nodemcu? You can set/check the clock speed in "Tools->CPU Frequency" in Arduino IDE.
If you have defined only 80MHz in WifiPPM and your controller is running on 160 MHz your signals would have double speed and it would not work. The same the other way around.

None
NazzzAndi23456

Reply 9 months ago

Hey finally got it working, thank for your support. But I am facing another issue in esp8266, at start i have uploaded the wifippm code in esp and it is showing the access point, but every time when i remove the power and power it again or if I reset it, it is not showing me the access point. Every time I am uploading the code. Can you suggest me on this what will be the issue.

None
amanjaiswal210Nazzz

Reply 3 months ago

please help when i am moving the joystic in mozilla firefox there is nothing happening in multwii gui. how can i fix it . please help

None
Andi23456Nazzz

Reply 9 months ago

That sounds like you did not disconnect the programming pin (GPIO0) from ground before restarting the chip.

None
NazzzAndi23456

Reply 9 months ago

Yes i have not disconnected programming pin (GPIO0) from ground before restarting the chip. Now i have removed it is working fine.

But wifi access point is not stable it is getting restarted again and again. Can you tell me what will be the reason for getting restarted.

None
Andi23456Nazzz

Reply 9 months ago

That usually happens if you your power source is too small. You need 3,3 Volt with at least 200mA, better more.

None
NazzzAndi23456

Reply 9 months ago

I am giving common power constant 5v from BEC to the esp arduino and mpu6050.
Do i need to give 3.3v only to the esp or 5v will do better?

None
Andi23456Nazzz

Reply 9 months ago

The ESP chip runs with 3,3V. So there must be some voltage regulator at the arduino board.
Can you try a stable 3,3V power supply directly to the chip? Maybe that's better.
Is your 5V power supply strong/stable enough?
A capacitor at your power supply could also help.
There are many esp8266 forums. And many other people have this problem. Google is your friend :)

None
NazzzAndi23456

Reply 9 months ago

Thank you Andi for your support it really helps me alot, and i have used separate 3.3v for esp now its working fine.

None
NazzzNazzz

Reply 8 months ago

Hey Andi,

I was setting up new esp quadcopter so i have used wifippm code provided in your post, but now I am getting the controls different means on right hand side am getting thorttle and yaw, and on left hand side am getting roll and pitch. But when initially i had used your code i was getting the correct controls that is on right side roll and pitch, and o left side throttle and yaw without any changes in the code.

But now I am getting it opposite, kindly help me with this.

Thank You

None
Andi23456Nazzz

Reply 8 months ago

Which flight controller software are you useing? You need to adjust the
channel mappings. In Betaflight/Cleanflight they are in the Receiver
Tab. The mappings need to be adjusted to RTAE1234. There should be some
channel mapping setting in any other flight controller, too.
You can
also change the channel mappings in the index.html.c. To do this change
the last two parameters of "drawstick(...)" function to the desired
channels everytime when it's called.
The function call of drawstick is: drawstick(context, x, y, ppm0, ppm1);
context: the canvas context to which you want to draw
x and y: the positions of the stick
ppm0 and ppm1: ppm channels.

None
NazzzAndi23456

Reply 8 months ago

Thank you for your reply, am using multiwii config for the calibration. But before when i had used wifippm code i did not do any changes in the code for channel setting, by default it had come correct. But now it is not coming same as before.

What shall I change in this function to make it to work in mode 2,

function draw_stick(context,x,y,ppm0,ppm1)
{
context.clearRect(0, 0, context.canvas.width, context.canvas.height);

context.beginPath();
context.arc(x,y,window.innerWidth/100*2,0,2*Math.PI);
if(wsconnect)
context.fillStyle = 'green';
else
context.fillStyle = 'red';
context.fill();
context.lineWidth = 5;
context.strokeStyle = '#003300';
context.stroke();

ppm[ppm0] = parseInt(1000+((1000/context.canvas.width)*x))
ppm[ppm1] = parseInt(2000-((1000/context.canvas.height)*y))
}

There were any updates in wifippm code from last 15 days??

None
NazzzNazzz

Reply 8 months ago

As per your suggestion in last post, I have tested by changing the last two default parameters of draw_stick(context, x, y, ppm0, ppm1);

Changed to draw_stick(context, x, y, ppm1, ppm0);

But the only changes i got is throttle is in 'y' axis and yaw is in 'x' axis but the position is still on right side.

I wanted it to be left side 'y' axis i throttle and 'x' axis is yaw, and right side 'y' axis is pitch 'x' axis is roll.