No description
  • C++ 91.5%
  • C 8%
  • HTML 0.3%
  • Python 0.2%
Find a file
2026-08-04 16:27:49 +02:00
doc Updated control, remmoved the rotary button code and doc 2026-02-02 16:00:12 +01:00
kat-remote Moved x8r stuff to RCInput, but holds a lot of temp stuff 2026-07-26 17:14:38 +02:00
LICENSE Add new file 2026-01-05 18:49:15 +01:00
README.md README.md bijwerken 2026-08-04 16:27:49 +02:00

README

Introduction

This my attempt to create an EPS32 controller in between a Frsky transmitter <-> Receiver <-ESP32-> Peripherals.

It uses a local version of SBUS and SPort to make it work.

Configuration

Configuration files

Please create a mydata directory and copy the files in the data directory to mydata and change them there, why, there are passwords in the config.json file and you don't want these in any git repository!

Also the mydata directory is referenced in the platformio.ini as the data directory to upload to your ESP32, please do not change the index.html unless you know what you are doing. If you reference other files in the index.html you have to add code in main.c to represent those files. At the time of writing, if any issues are raised if referenced files are not working, or you want to add additional files, these are closes without comments.

Configuration file: config.json

Below is an example 'config.json', this file is in the 'data' directory, please create a 'mydata' directory and copy the example files to that

{
    "fastboot": true,
    "loglevel": "debug",
    "hostname": "rem32",
    "wifiSSID": "my ssid",
    "wifiPassword": "my ssid password",
    "OTAPassword": "my OTA password",
    "displaySeconds": false,
    "fallbackWifiSSID" : "<ssid>",
    "fallbackWifiPassword" : "<password>",
    "AP" : true,
    "APWifiSSID" : "rem32",
    "APWifiPassword" : "rem32ChangeMe"
}

Most of the values are self explanatory, but some need an explanation.

fastboot

This value can be true or false and if true the ESP will boot without showing some configurations.

loglevel

The values in the list goes from top to bottom, so if the log level is "info" all messages from "info" are shown, so "debug" messages are not shown.

This value can be:

  • "debug" the lowest level, only for debugging can produce a lot of messages;
  • "info" the default if none is given, just showing you stuff;
  • "warning" ok, not that fun, but we will manage;
  • "error" not good, but it will try to use defaults, nothing guaranteed;
  • "fatal" unrecoverable, stranger things are going to happen if not corrected.

displaySeconds

True or false, if true it shows the second from boot.

Show seconds also in the log file, so we can correlate things, for now I want to use it to see if the ESC's arm

AP

If true it will start in access point mode, probably at address 192.168.4.1, and only if it could not connect to the normal WiFi and/or the fallback WiFi.

Configuration file: outputs.json

Web pages

These are only available when the ESP has configured SSID's and is connected to a WiFi network, or in AP mode.

otapassword is the password for uploading a outputs.json

If you connect to the ESP with a browser the output of the upload is given in the return page.

If you use something like curl:

curl -F "pwd=<otapassword>" -F "data=@outputs.json" http://<esp ip address| hostname>/upload/outputs

The it should return 200 OK if everything went ok, otherwise a 40x.

Supported hardware

An INA226 is used instead of the ESP32 ADC because the ESP32 one in unstable

  • INA226 for measurements
    • high current and battery voltage
    • actuator current
  • PCA9685 for motor control PWM at 50Hz!
  • i2c oled display 128x64
  • motor driver drv8871
  • neopixel
  • joystick buttons: up, down, left, right and press
  • accelerometer mpu 6050
  • add wifi connection for configuring
    • connect to wifi
    • have a fallback wifi
    • have AP mode as last resort

Joystick pins: gpio23, gpio4, gpio13, gpio14 and gpio15 (can change when the pcb layout is better that way)

Map rc inputs

rc input to servo

The measured input from the transmitter is 172 to 1888

    // pulse is in microSeconds, 20 000 is the full pulse in 50 Hz
    pwm.setPWM(8, 0, pulse * 4096 / 20000);

display and keys

The oled display is an SSD1306 display, any I2C one will do, as long as it is 128x64.

For the 5 way joystick, this one is used:

5 way joystick

Just 5 switches to ground.

ina226

Change the addresses of both of them, the power INA226 has address 0x44 (A0=gnd , A1=Vss) and the actuator INA226 has address 0x41 (A0=Vss , A1=gnd)

resistor value for 15A/16A

For the ina226 to measure up to 16A the resistor value needs to be 0.005 Ohm and 1.34 W. Two 0.010 Ohm resistors parallel will do the trick (both dissipate half the power). Just stack them on top if you are using a ready made module.

drv8871

Table 1. H-Bridge Control

IN1 IN2 OUT1 OUT2 DESCRIPTION
0 0 High-Z High-Z Coast; H-bridge disabled to High-Z (sleep entered after 1 ms)
0 1 L H Reverse (Current OUT2 → OUT1)
1 0 H L Forward (Current OUT1 → OUT2)
1 1 L L Brake; low-side slow decay

The inputs can be set to static voltages for 100% duty cycle drive, or they can be pulse-width modulated (PWM)

    // switch 'pwm' off
    pwm.setPWM(i, 0, 0);
    // switch 'pwm' on
    pwm.setPWM(i, 0, 4095);

Used Libraries

SPORT is a copy of: https://github.com/RealTadango/FrSky

More SPort example code https://github.com/schwabe/naza_butler/blob/master/libraries/FrSkySportTelemetry/FrSkySportSensorFcs.cpp

SBUS is a copy of https://github.com/TheDIYGuy999/SBUS

SoftwareSerial is needed by SPORT and is a copy of https://www.arduino.cc/reference/en/libraries/espsoftwareserial/ Version 1.16.1

TODO's

If an item is completely done, the item should be documented above.

circuit/breadboard

  • Add a diode/mosfet between the +5v of the esp board and the BEC; the ESP32 32 pin has a schottky diode between the Vin and V+ (USB)
  • add a neopixel on board with a different v+ (for now pin 27, and stupid simple test code)

programming

  • map rc channels to outputs

  • define outputs:

    • servo/motor esc
    • on/off
    • direct motor pwm
    • neopixel
  • outputs:

    • PCA9685 channel
    • ESP32 pin
  • enable voltage and current sensor

  • failsafe

  • ?accelerometer sensor?

  • ?feedback for actuators?

  • uploaded configuration

    • validate
    • place on SPIFFS
    • reload configuration
  • add onboard neopixel as number one, this one has a different v+, the rest (off board) has a regular + 5V

  • config screens

    • outputs
      • add, change, delete
      • subscreen for:
        • type
        • reverse
        • safe value
        • pin(s)
        • name (generated?)
  • inputs

    • add, change, delete
    • subscreen for:
      • type
      • channel(s)
      • type
      • offset
      • leftright, left and right or output
  • channels, show min, max and current.

  • short left or right, switch between min, current and max

  • log left or right, reset the min and max values.

  • how to handle/control/program the neopixel

  • how to handle/configure servo

  • how to handle/configure actuator

  • configure blinkers