Simple ESP Telemetry Serial Bridges

Hi Yuri,

Struggling to build/configure your ESP Serial Bridge code. I am very new to code but have been around RC rovers for a number of years.

I am mechanically minded and can build most things, but coding is where I fall down and Google hasnt been too much help in this instance.

I am using ESP32 Wroom 32 for my project, I dont suppose you have an example Serial_Bridge code thats filled in so that I can set my own parameter requirements please.

Thanks

I don’t know what you’re asking for. The examples are what exist on GitHub.

What I’m looking for is to able to see a completed example with all parameters filled in. This way I am able to understand and learn what is needed to make the code work.

There aren’t any blanks. It should build as-is. The only things to potentially change are in config.h.

I understand how to configure config.h but I am receiving many many errors (too many to display here) with the serial_bridge.ino when attempting to load to the ESP32.

Here are the first few lines

C:\Users\DuncanMcfarlane\Documents\Arduino\libraries\ESP-Serial-Bridge-master\ESP-Serial-Bridge\ESP-Serial-Bridge.ino:57:21: error: ‘NUM_COM’ was not declared in this scope
HardwareSerial* COM[NUM_COM] = {&Serial, &Serial_one, &Serial_two};
^~~~~~~
C:\Users\DuncanMcfarlane\Documents\Arduino\libraries\ESP-Serial-Bridge-master\ESP-Serial-Bridge\ESP-Serial-Bridge.ino:78:14: error: ‘NUM_COM’ was not declared in this scope
uint8_t buf1[NUM_COM][BUFFERSIZE];
^~~~~~~
C:\Users\DuncanMcfarlane\Documents\Arduino\libraries\ESP-Serial-Bridge-master\ESP-Serial-Bridge\ESP-Serial-Bridge.ino:78:23: error: ‘BUFFERSIZE’ was not declared in this scope
uint8_t buf1[NUM_COM][BUFFERSIZE];
^~~~~~~~~~
C:\Users\DuncanMcfarlane\Documents\Arduino\libraries\ESP-Serial-Bridge-master\ESP-Serial-Bridge\ESP-Serial-Bridge.ino:78:23: note: suggested alternative: ‘BUFSIZ’
uint8_t buf1[NUM_COM][BUFFERSIZE];
^~~~~~~~~~
BUFSIZ
C:\Users\DuncanMcfarlane\Documents\Arduino\libraries\ESP-Serial-Bridge-master\ESP-Serial-Bridge\ESP-Serial-Bridge.ino:79:14: error: ‘NUM_COM’ was not declared in this scope
uint8_t buf2[NUM_COM][BUFFERSIZE];
^~~~~~~
C:\Users\DuncanMcfarlane\Documents\Arduino\libraries\ESP-Serial-Bridge-master\ESP-Serial-Bridge\ESP-Serial-Bridge.ino:79:23: error: ‘BUFFERSIZE’ was not declared in this scope
uint8_t buf2[NUM_COM][BUFFERSIZE];
^~~~~~~~~~
C:\Users\DuncanMcfarlane\Documents\Arduino\libraries\ESP-Serial-Bridge-master\ESP-Serial-Bridge\ESP-Serial-Bridge.ino:79:23: note: suggested alternative: ‘BUFSIZ’
uint8_t buf2[NUM_COM][BUFFERSIZE];
^~~~~~~~~~
BUFSIZ
C:\Users\DuncanMcfarlane\Documents\Arduino\libraries\ESP-Serial-Bridge-master\ESP-Serial-Bridge\ESP-Serial-Bridge.ino:82:13: error: ‘NUM_COM’ was not declared in this scope
uint16_t i1[NUM_COM] = {0, 0, 0};
^~~~~~~
C:\Users\DuncanMcfarlane\Documents\Arduino\libraries\ESP-Serial-Bridge-master\ESP-Serial-Bridge\ESP-Serial-Bridge.ino:83:13: error: ‘NUM_COM’ was not declared in this scope
uint16_t i2[NUM_COM] = {0, 0, 0};
^~~~~~~
C:\Users\DuncanMcfarlane\Documents\Arduino\libraries\ESP-Serial-Bridge-master\ESP-Serial-Bridge\ESP-Serial-Bridge.ino:89:15: error: ‘BUFFERSIZE’ was not declared in this scope
uint8_t BTbuf[BUFFERSIZE];
^~~~~~~~~~
C:\Users\DuncanMcfarlane\Documents\Arduino\libraries\ESP-Serial-Bridge-master\ESP-Serial-Bridge\ESP-Serial-Bridge.ino:89:15: note: suggested alternative: ‘BUFSIZ’
uint8_t BTbuf[BUFFERSIZE];

There’s a problem with your development environment. It appears that config.h doesn’t even exist as far as the compiler knows. Or you have removed lines that need to exist.

Please help me out here, as said this is not my forte.
To load onto an esp the three files need to be loaded from the same window once config.h has been adapted?

Yuri – this looks like it will do a good job of feeding Mavlink to an antenna tracker. In my case I would like it to act in STA mode and connect to an ESP32 running Mav2PassThru in the back of my Radiomaster Tx16S with Dragonlink. It would then feed Mavlink through UART to the tracker. Since ESP32s come in so many flavors I assume I can assign whatever Digital pins are available on the ESP32 I am using.

@Yuri_Rage Is your wifi serial link project split into two Arduino sketches with separate config.h files for STA and AP modes and shared libraries.

Trying to deploy this to PlatformIO and I am wondering if I do this as two projects, one for AP and one for STA. I have only ever worked with a one-to-one relationship between the .ino and main.ccp files in the two environments. A quick look at the code suggests they are not standalone. Do you know how I move this over to PlatformIO?

Make two separate projects for PlatformIO. I strongly prefer PlatformIO as well, but I know many prefer the simplicity of the Arduino IDE, so I try to make things compatible with that, since it’s easier to import from Arduino into PlatformIO than the other way around.

So why do you have to choose STA or AP config.h as I was thinking you had this set up as separate projects with common libraries? There is also a lof of IF conditions for both modes but that config.h is only for AP mode is it not? It’s not seemingly called from the client files. Sorry if I am being dense.

You change config.h for each instance you want, based on desired behavior. The config.h files are unique to each sketch, otherwise, I’d have made them common.

AP mode creates its own network (you’ll only want one of these, if any, and the client sketch assumes STA mode).
STA mode connects to an existing network.

What’s your use case?

My use case is to take Mavlink telemetry wirelessly from my an ESP32 running MAV2P and feed it to my antenna tracker via UART. So I assume i am just using the client sketch and its config.h.

So I guess my confusion is why does the config file i linked to above have an AP mode and an STA mode option? Why not just an AP mode option?

Why would you always want to create a wifi network if one already exists in your location? My most frequent use case is to connect to an existing network with STA mode.

For your use case, use the client sketch to target the transmitting ESP32 over the network protocol of choice. Use the config.h file included in that directory.

Can I phrase my question more precisely – sorry that I am not getting it yet.

Is config.h for an ‘Air’ side setup either in STA or AP? Mavlink will be made available through TCP/UDP.

Is client_config.h a ‘Ground’ side when Mavlink will be consumed from another wifi network?

All depends on the use case. If you are sending info to the ESP32 from another device, you use the master sketch, which can be configured in AP or STA mode.

If you want to connect the ESP32 to a specific TCP IP or UDP port, you use the client sketch and connect it to the network on which the target device resides.

If am only using client_config.h and its associated sketch I see no way to define the pins that I want to use for my UARTS? Is that not also an important consideration when you are in a client set-up in STA mode?

Umm…lines 28 and 29…

I blanked those! Was looking for three UARTS. I think I get it now.

Why only one hardware UART for the wireless client sketch? (I only need one though)

Many thanks for your patience.

My assumption is that you’re only receiving from one network port, so only relaying to one hardware port. It’s easily modified to repeat the data on any of the hardware UARTs if you need to do so.

The original code was forked from another repo where the use case was one to many or many to one, so I kept that functionality intact. The client was a quick mod to provide some additional flexibility, but I guess I didn’t provide ALL the flexibility.