/esp8266-ppm-tx

Control a drone over Wi-Fi

Primary LanguageCCreative Commons Zero v1.0 UniversalCC0-1.0

esp8266-ppm-rx

Use an ESP8266 module as a receiver for your drone!

This firmware has two main features: UDP-to-PPM for remote control, and a serial bridge for telemetry.

WARNING: This is not very good code and was just a fun exercise. This firmware will certainly have fatal bugs in it! I can't guarantee the safety of you and whatever you use this on. Be careful!

Configuration

  • Add wifi_config.h to the main project directory with your WiFi details:
#define SSID "your_network_ssid"
#define PASSWD "your_network_password"
  • Check out src/fw_config.h for some configuration options.
  • PPM timing details are in src/ppm.c You probably don't need to change them, but they're there.

Building

  1. Build esp-open-sdk at commit e8d757b with STANDALONE=y (which is the default).
  2. Go into the esp8266-ppm-rx directory and make.

Flashing

  1. Edit ESPTOOL_PORT and optionally the other ESPTOOL_* variables in the Makefile as required. If you're using esptool v1.x (as is bundled with esp-open-sdk at that commit), comment or remove the line ESPTOOL_FLAGS ?= --before no_reset --after soft_reset.
  2. Make sure your ESP8266 module is connected via serial and is in flash mode, then make flash.

How to use

PPM

By default, the firmware listens on UDP port 5620 for PPM channel data. Each channel's value is represented by two bytes (16 bits) big endian, so a PPM update is a single packet of N_CHANNELS * 2 bytes, with channel one's value being the first two bytes, channel two the next two bytes, and so on.

By default, PPM is output on GPIO2/TX1. This is adjustable in src/ppm.c (find PPM_GPIO).

Failsafe

For safety, there is a failsafe. If there hasn't been a UDP channel update message in 500 milliseconds, the firmware stops transmitting PPM, indicating a loss of signal (timeout is configurable, see FAILSAFE_TIMEOUT_US in src/fw_config.h).

Serial bridge

By default, the firmware listens on TCP port 5621. The connection is just a completely transparent serial bridge at 115200 baud. I use this for remote telemetry.

License

Released into the public domain via CC0 (see COPYING for the license text) EXCEPT for:

  • Files in src/driver, these are from the Espressif NONOS SDK (although slightly modified).
  • blank.bin and esp_init_data_default.bin, also from the Espressif NONOS SDK.

Check the licenses for these files before using them. The source files mostly have their license at the top.