ESPcopter SDK
1.2.2 (Beta)
07.04.2021

Contents
Frequently Asked Questions: ..................................................................................................... 41- ) General Review ................................................................................................................... 61.1-) Internal Features of the ESPcopter: ............................................................................... 61.2-) ESPcopter Assembly Sequence: .................................................................................... 61.3-) ESPcopter Switch and Button ........................................................................................ 71.4-) How to Charge the ESPcopter: ...................................................................................... 71.5-) Pinout and Propeller and Motor Directions ..................................................................... 81.6-) ESPcopter Control Methods: .......................................................................................... 91.7-) ESPcopter Default Wifi Information: ............................................................................... 92-) ESPcopter Development modules: ....................................................................................... 92.1-) Optic Flow Module: ........................................................................................................ 92.1.1-) Optical Flow Module Connection: ...........................................................................102.1-) Multi-Ranger Module: ....................................................................................................102.3-) Other Modules:..............................................................................................................112.3.1-) ESPcopter Neopixel Module: ..................................................................................112.3.2-) ESPcopter Buzzer Module: .....................................................................................112.3.3-) ESPcopter Temperature Pressure and Humidity module: .......................................113-) ESPcopter Control Application (RemoteXY): .......................................................................123.1-) Connection: ...................................................................................................................123.1-) Control Review: .............................................................................................................134- ) ESPcopter Web Interface: ..................................................................................................144.1-) Block Programming with Web Interface: ........................................................................154.2-) Web Interface Control Controller: ..................................................................................164.2.1-) Control Review: ......................................................................................................164.3-) Web Interface Settings: .................................................................................................174.5-) Web Interface Information: ............................................................................................185.4-) Downloading the ESPcopter library: ..............................................................................225.5-) Spiffs Memory Updater Installation: ...............................................................................235.5.1-) What is Spiffs Memory? ..........................................................................................235.5.1-) Install Spiffs Memory Uploader? .............................................................................236-) Update Software: .................................................................................................................236.1-) Update Main Software: ..............................................................................................236.2-) Update Spiffs Memory: ..................................................................................................257-) ESPcopter Arduino Special Commands: ..............................................................................277.1-) ESPcopter Control functions: ........................................................................................277.2-) ESPcopter Control Table: ..............................................................................................277.3-) ESPcopter Global Set Functions Definitions: .................................................................287.3-) ESPcopter Global Get Functions Definitions: ................................................................287.4-) Autonomous Flight Commands: ....................................................................................297.5-) Altitude Hold Module: ....................................................................................................297.6-) Buzzer Module: .............................................................................................................297.7-) Neopixel Module: ..........................................................................................................307.8 -) Optical Flow Module: ....................................................................................................307.9-) Multi-Distance Module: ..................................................................................................307.10 -) Other Commands .......................................................................................................31

Frequently Asked Questions:
1. How can I open the ESPcotper?
You can open ESPcopter with switch that is on the rear side of Board
2. How to connect ESPcopter to my computer or Smart Phone?
You can connect via wifi connection. Wifi name: “ESPcopter” Password: “123456789”
3. How to charge ESPcopter?
The ESPcopter will charge when connected to the micro-usb. The switch on theESPcopter must be in the off position to charge. Red Light indicates that ESPcopter
currently charging
4.

Where is the font direction of ESPcopter?

Green led indicates font direction of ESPcopter
5. How to fly my ESPcopter with Smart phone or Computer?
After Wi-Fi connection, you can fly ESPcopter with phone app that is RemoteXY. Anotheroption to the fly ESPcopter is web site program. You can reach web site program withsearching 192.168.4.1 on your web browser.

For other questions and comments you can send an e-mail:espcopter@gmail.com
Have any questions? For more information, visit our community site at
http://espcopter.com/community/ or ask us in our Facebook group (Link below)!
Like and Follow us:
Instagram: https://www.instagram.com/espcopter/
Facebook: https://www.facebook.com/espcopter/
Website: http://espcopter.com/
Twitter: https://twitter.com/ESPcopter1- ) General Review1.1-) Internal Features of the ESPcopter:1.2-) ESPcopter Assembly Sequence:1.3-) ESPcopter Switch and Button
The button is used to reset ESPcopter MCU
The switch is used to open and close ESPcopter1.4-) How to Charge the ESPcopter:
The ESPcopter will charge when connected to the micro-usb. The switch on theESPcopter must be in the off position to charge. Red Light indicates that ESPcoptercurrently charging

1.5-) Pinout and Propeller and Motor Directions
When installing in accordance with the letters on the propellers, the motors mustbe fitted according to the cable colors.
Engine positions:
Left Front: B - Red, Blue

Right Front: A - Black, White

Left Rear: A – Black, White

Right Rear: B – Red, Blue

1.6-) ESPcopter Control Methods:1.7-) ESPcopter Default Wifi Information:
SSİD: ESPcopter
Pass: 123456789

2-) ESPcopter Development modules:
2.1-) Optic Flow Module:
Optic flow module understands the drone’s movement via processing the imagesof the ground. In this way drone can stay in the same location or it can moveautonomously.

2.1.1-) Optical Flow Module Connection:

Note: Module direction is important. It should be connected as picture.

2.1-) Multi-Ranger Module:
There are 4 laser sensors on drone. Those sensors can understand the distance
up to 1 meter. With the help of this you can make anti-collision system, hand control
system, autonomous flight system etc.

2.3-) Other Modules:

2.3.1-) ESPcopter Neopixel Module:
There are 12 NeoPixels in this circular card. It can connect to the ESPcopter's top
input pins. You can use the NeoPixel module to make various light shows while flying withthe ESPcopter.
2.3.2-) ESPcopter Buzzer Module:
There is one buzzer in the buzzer module. It can connect to the ESPcopter's top
input pins. You can play music through the Buzzer module when you are not flying, andyou can hear the warning sounds when you fly.
2.3.3-) ESPcopter Temperature Pressure and Humidity module:This module has one BEM280 sensor. It can connect to the ESPcopter's top input
pins. You can use this module to record weather data while flying or you can send thesedata to your phone or computer over the internet in your IoT project.

3-) ESPcopter Control Application (RemoteXY):3.1-) Connection:
After installing the RemoteXY application on your phone, turn ESPcopter on andconnect your phone and ESPcopter via wifi network.
After you make the connection, open RemoteXY and do following steps.

After making the connection, the screen below will open automatically.

After the first connection. There will be ESPcopte box in RemoteXY app. You can connect
ESPcopter by cliking this box.

3.1-) Control Review:

Joysticks:4- ) ESPcopter Web Interface:Thanks to the ESPcopter website, you can control the ESPcopter from your phone
tablet and computer without any application installation and program it wirelessly thanks
to the blocks. Follow the following steps to control the ESPcopter with the Web Interface.
1. Login to the site by typing http://192.168.4.1 into the Chrome web browser
Search bar.
2. The ESPcopter website will open automatically.

With this web interface;You can open the block programming interface
You can open the web control interfaceYou can change some drone settings such as Wi-Fi password in settings section.

4.1-) Block Programming with Web Interface:
You can open the web blockly control interface by clicking the blockly icon fromthe web interface

You can code ESPcopter wirelessly with Blocks
Simple Flight Code:

Led Control Code:

Motor Control Code:4.2-) Web Interface Control Controller:
You can open the web control by clicking on the remote control icon from the webinterface

4.2.1-) Control Review:
Joysticks Review:

Buttons:

4.3-) Web Interface Settings:
You can open your settings page by clicking the setting icon from the web interface:

You can change the ESPcopter wifi name and password via the settings page.

4.5-) Web Interface Information:
You can open your information page by clicking the information icon from the webinterface:5-) Software:5.1-) Arduino Installation:
Download and install the latest version from the Arduino web site:
https://www.arduino.cc/en/Main/Software5.2-) Driver Installation:
The following driver is required for the ESPcopter to be recognized by the computer.
Download and install the appropriate driver version for your OS.

https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcpdrivers5.3-) ESP8266 Library
To begin, we’ll need to update the board manager with a custom URL. Open upArduino, then go to the Preferences (File> Preferences). Then, towards the bottom of thewindow, copy thisURL into the “Additional Board Manager URLs” text box:
http://arduino.esp8266.com/stable/package_esp8266com_index.json

Hit OK. Then navigate to the Board Manager by going to Tools > Boards > Boards
Manager. There should be a couple new entries in addition to the standard Arduino
boards. Look for esp8266. Click on that entry, then select Install. You need to install latest
version of esp8266 library.

The download process can take up to 10 minutes depending on your internet speed. Afterthe download is done, select NodeMCU 1.0 from the Tools tab and follow the othersettings.

5.4-) Downloading the ESPcopter library:
Before downloading the code from the website, you must use the contacts page torequest source code. See the following site: http://espcopter.com/code-release/

After downloading, remove the zip file twice and put the file (ESPcopter ”(Files>Arduino> Library) into the file. In the Examples section you will see the sample codes ofthe ESPcopter.
Open the following example program:

5.5-) Spiffs Memory Updater Installation:
5.5.1-) What is Spiffs Memory?
Flash File System (SPIFFS) is a SPI Flash (64kBytes to 3Mbyte) In this flash
memory ESP stores the program. This filing system can be used to store infrequently
changing data such as; web pages, configurations, sensor calibration data etc.

5.5.1-) Install Spiffs Memory Uploader?
Download the tool: https://github.com/esp8266/arduino-esp8266fsplugin/releases/download/0.5.0/ESP8266FS-0.5.0.zipIn your Arduino sketchbook directory, create tools directory if it doesn’t exist yet.

Unpack the tool into tools directory (the path will look
like <home_dir>/Arduino/tools/ESP8266FS/tool/esp8266fs.jar ) If upgrading,overwrite the existing JAR file with the newer version.

Restart Arduino IDE.

6-) Update Software:6.1-) Update Main Software:To update the code, the drone must be turned on and connected to the computer
via USB cable. Open the ESPcopter code from the ESPcopter Library in theExamples section.

Make the necessary settings from the Tools section.

Upload the code by clicking the Upload button.

6.2-) Update Spiffs Memory:

Make sure you have selected a board, port, and closed Serial Monitor.

If your board requires you to press a button (or other action) to enter bootload modefor flashing a sketch, do that now.

Select Tools > ESP8266 Sketch Data Upload. This should start uploading the files
into ESP8266 flash file system. When done, IDE status bar willdisplay SPIFFS Image Uploaded message.

After updating the main software and spiffs memory, updating software is completed.

7-) ESPcopter Arduino Special Commands:7.1-) ESPcopter Control functions:
The LEDs and motors on the ESPcopter can be controlled using the functions found in
this list.
Function
esp.redLed_Digital(boolean);esp.blueLed_Digital(boolean);esp.greenLed_Digital(boolean);Input ange
0 - 1 or FALSE - TRUE
0 - 1 or FALSE - TRUE
0 - 1 or FALSE - TRUE

setMotorSpeedFL(int);

0 - 255

setMotorSpeedFR(int);

0 - 255

setMotorSpeedRL(int);

0 - 255

setMotorSpeedRR(int);

0 - 255

Description
Controls Red LED on/off
Controls Blue LED on/off
Controls Green LED
on/offOperates front leftengine at desired power.
The front right operates
the engine at the desired
power.
Operates the rear leftengine at the desiredpower.
The rear right operates
the engine at the desiredpower.

7.2-) ESPcopter Control Table:
The control method of the ESPcopter can be changed using the definitions in this list.
Only one definition should be activated from this list.

Function#define STANDALONE

DescriptionStandard operations#define REMOTE_XY_OWN

Make your Own
RemoteXY app
No wiffi, You need towrite code forcommunication#define FREECONTROL

Control Device
Web app –RemoteXY Remote
Phone - Tablet
İt might be anyting7.3-) ESPcopter Global Set Functions Definitions:
Function
setTrimRoll(int);
setTrimPitch(int);
setTrimYaw(int);
setArmControl(boolean);
setFlyMode_1(boolean);

setFlyMode_2(boolean);

setFlyMode_3(boolean);landing(boolean);setMotorMax(int);

Description
Trim on the X-axis.
Trim on the Y-axis.
Trim on the Z-axis
Set Motor arm or unarm
Set Yaw-axis stabilization enable
or un-enable with magnetometer
sensor
Set auto altitude hold mode
enable or un-enable with opticalflow module
Set Optical flow stable mode
enable or un-enable with opticalflow module
False it to force drone to land
Set maximum motor power

Value Range-500 - 500-500 - 500-500 - 500
false - true
false - true

false - true

false - true

false - true
600-900

7.3-) ESPcopter Global Get Functions Definitions:
getRX_throttle();getRX_roll();
getRX_pitch();getRX_yaw();
getMpuAccelX();
getMpuAccelY()
getMpuAccelZ()
getMpuGyroX();
getMpuGyroY();
getMpuGyroZ();
getMpuTemp();
getMpuAttitudeX();
getMpuAttitudeY();
getMpuAttitudeZ();
getMpuRateX();
getMpuRateY();
getSfVersion();Get Motor throttle value
Get roll remote value
Get pitch remote value
Get yaw remote value
Get accelerometer X-axis.
Get accelerometer Y-axis
Get accelerometer Z-axis
Get gyro X-axis
Get gyro Y-axis
Get gyro Z-axisGet IMU Temperature
Get Filtered X-axis data
Get Filtered Y-axis data
Get Filtered Z-axis data
Get Filtered Z-axis data
Get Filtered Z-axis data
Get currernt software
version0 – (motorMax)-100 : + 100-100 : + 100-100 : + 100

7.4-) Autonomous Flight Commands:
FunctiontakeOff(Y, T);goforward(T);goBack(T);goLeft(T);goRight(T);turnRight(D);turnLeft(D);delay_(T);Land();

Description
When the command line
runs, the drone
automatically takes off.
The drone moves forward
during the duration.
During the T Time thedrone moves back.
The drone moves to theleft during the duration.
The drone moves rightthrough the time.
D rotates right up to its
own angle in angle.
The angle of D turns tothe left in its own frame
It allows you to wait
before executing the next
command
In autonomous flightmode, this must be at theend of the commands.

Value Range
Y: 200 - 1000 Height
T: Flight time
T: Flight time
T: Flight time
T: Flight time
T: Flight time
D: Rotation angle
D: Rotation angle
T: Standby time7.5-) Altitude Hold Module:Function
setVl5310xControl(boolean);
setTargetOto(int);
getOtoMeasure();Description
vl5310x module on-off

Value Range
False - true

Set target altitude
Get altitude data

250 - 1000
0- 1200

Description
0 - 1 or FALSE - TRUE

Value range
On- Off buzzer

7.6-) Buzzer Module:
Functionesp.buzzer();

7.7-) Neopixel Module:
Function
ESPrainbow();
ESPsetPixel (x,r,g,b);

ESPpixelShow();

Description
Makes an automatic
rainbow effectSet each led separately.
After setting pixels call

Value range
X= 1 – 12R(Red)= 0 - 255
G(Green)= 0 - 255
B(Blue)= 0 - 255

Applies the changes
made with7.8 -) Optical Flow Module:
Function
SetOptPoint_X(int)

SetOptPoint_Y(int)

getOptData_X()
getOptData_X()

Description
Sets the speed of Drone
using the optic flow
sensor. If this value isequal to zero, the drone
remains stationary in thex-axis. Positive moves
right, Negative moves left
Sets the speed of Drone
using the optic flow
sensor. If this value isequal to zero, the drone
stops at the y axis.
Positive goes forward,
Negative- goes backGet optical flow sensor xdata
Get optical flow sensor ydata7.9-) Multi-Distance Module:

Value range-15 - +15

-15 - +15

Relative to the drone
current speed
Relative to the drone
current speed

Function#define HandControl#define AntiCollision

Distance_Y_1();
Distance_Y_0();
Distance_X_1();
Distance_X_0();

Description
Manual control or collision
prevention system
Must choose one or theother
Y (+) axis distance data
Y (-) axis distance data
X (+) axis distance data
X (-) axis distance data

Value range

50-1000
50-1000
50-100050-1000

7.10 -) Other Commands
All other common Arduino and ESP8266 commands can be used in the library except
for the following which will interfere with drone operation.
delay();
analogWrite();Tone();