ESP32 Serial Communication Delay

Hey everyone,

I ran into an issue working on a project using a Wemos ESP32-S2 Mini and the Serial Port implementation in vvvv.

So basically,

  • the esp acts as a keyboard and sends a keystroke when a physical button is pressed
  • this is registered in vvvv based on the help patch “howto react on key”
  • the keystroke triggers a serial command back to the esp to control an rgb led

The problem is, there is a noticeable delay of about 1 sec and I can’t figure out what’s causing it. I am 98% sure the issue is not with my esp code but rather some nodes blocking behaviour in vvvv that i am not aware of.

Has anyone run into similar issues with ESP32 serial communication? Would really appreciate any insights!

Here are the project files with instructions inside on how to reproduce the setup, in case anybody has an esp laying around and is willing to investigate :)

ESP32 Serial Delay.vl (49.1 KB)
usbKeyboard-esp.zip (8.3 KB)

in your patch you have an iobox after the keyboard node. do you see the delay already here?

i see the up edge of the keypress in realtime and if i longpress, the down edge is also in realtime. If i do a really short press though, i see that the down edge of the keypress is delayed by about a second as well.

so that kinda sounds like it has nothing to do with the serial output, right? as you can see the issue already on the input?

and if you compare this behavior to pressing a key on the actual keyboard of the pc you’d say you notice a difference?

is there a reason you need to go this route via the keyboard input? why not send serial to vvvv from the board?

Big thanks @joreg for jumping on a call and solving this with me!

to close this thread, here is the solution we found:

The problem is that I used a \n string instead of the NewLine node to signal the end of my serial command, which parse to different bytes and therefore got interpreted incorrectly by my esp32 code.

Here is the fixed patch:
esp32 serial delay fix.vl (51.9 KB)