ESP32 communication via USB UART

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
renataa_l
Posts: 2
Joined: Wed Jun 15, 2022 11:38 am

ESP32 communication via USB UART

Post by renataa_l » Wed Jun 15, 2022 11:51 am

Hello!
As one of my first projects, I'm trying to establish UART communication between my ESP32 and my PC via USB, specifically having ESP send a string to PC. However, the only thing I'm viewing is strings that are printed, not written in UART's functions. I'm using pyserial to check the COM port, as well as Hercules software. Can somebody help me?

Image

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP32 communication via USB UART

Post by Roberthh » Wed Jun 15, 2022 12:06 pm

The interface attached to the USB port is not registered as an UART. You can send strings using print() or sys.stdout.write(). or sys.stderr.write().

renataa_l
Posts: 2
Joined: Wed Jun 15, 2022 11:38 am

Re: ESP32 communication via USB UART

Post by renataa_l » Thu Jun 30, 2022 8:13 am

Thank you! By the way, how can I do it the other way around: send a string from PC to ESP32?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ESP32 communication via USB UART

Post by Roberthh » Thu Jun 30, 2022 8:30 am

That depends on your programming environment and operating system. You have to write data to the serial port, which is registered as interface to the ESP32. With Windows, this is a COMx port. With linux , its a /dev/tty_USBx device, with OS X, a /dev/tty_xxxx device. xxxx for varying numbers or names.

Post Reply