How to activate linux USB port even though the USB 5V pin is not used?

I can connect my ESP32-S3-DevKitC to my PC via USB cable - which provides 5V power as well as access to the ESP32’s serial log via minicom on the PC. :white_check_mark:

In production the power will be provided direct to the ESP32’s 5V pin - and this works well, excepting that the log is though wi-fi to HA’s ESPHome Device Builder LOG. :white_check_mark:

Since November 21 the log shows Wi-Fi Signal measurements of -128dB and after a few days loosing contact with the ESP32 totally. :frowning_face:

I initially attributed to the -128 readings to an ESPHome update and/or my wi-fi update_interval may be longer than my deep-sleep awake time … but I moved the ESP32 back to my workbench to check … and got the same wi-fi behaviour. As expected, the ESP32’s log shows unexpected wi-fi disconnections … but of course cannot say why.

So I now want to access the serial log to see what is happening on the ESP32 when it is not connecting to wi-fi - but I want to power the ESP32 from the ESP32’s 5V pin in case that is a factor.

My PC doesn’t have an old-fashioned RS-232 serial port; and my understanding is that my linux PC only recognises that the PC’s USB port even exists when it is connected and powered … so is there a way to trick the PC into activating the USB even though the 5V pin is not connected to the ESP32 ?

I often use usb-cable where +5V wire is cut.

Get a new-fangled USB to serial converter. It will always be powered and connected to your PC. Connect the RX and TX lines from the converter to your esp32’s RX and TX lines (like people still have to do for ones that don’t have them built-in).

Make sure you get one for 3V3 levels or do appropriate level conversions.

I would also suggest connecting the GND’s of the ESP32 board and the converter.

Interesting. My results for anyone in future who is researching the same issue…

When using a standard USB cable to the ESP32’s USB socket, my linux PC only detects the existence of /dev/ttyACM0 when the ESP32 is powered on … which gets awkward when testing deep_sleep.

Way back when Raspberry Pi was new I got one of those USB-to-serial converters. I have lost it, and looking to purchase another newer model (as @neel-m suggested) discovered my local supplier has a dozen models available ! How to decide which is “best” for now and possible future use ?

Since I have a USB cable with dupont connectors, I tried it as @Karosm suggested, expecting linux to ignore it. Connecting to the ESP32’s GND, TX and RX, and connecting ESP32’s 5V power I found that linux now shows a /dev/ttyUSB1 device.

Thank you all. I now have a log which will hopefully show what was happening on the ESP32 when it is not connected to wi-fi.

Why would any OS ignore it?

It sounds like the board is using an USB host running on the ESP32, which will disappear when the ESP32 is powered down.

When using a USB-to-serial dongle, it’s the chip on the dongle that communicates with the Linux PC, and that chip will always be on.

Reasonable question … back in the old days, the serial ports existed in DOS even when not connected to anything.

Maybe it’s the Plug and Play feature of USB doing the connection/disconnection, so the OS can dynamically adjust which driver type to connect the USB port to ?

It also seems reasonable to build in a USB Host into the ESP32 with the USB-C socket.

Did you make it yourself or did it come that way?

Or, is it something like this: USB to TTL Serial Cable - Debug / Console Cable for Raspberry Pi : ID 954 : Adafruit Industries, Unique & fun DIY electronics and kits

The latter is a USB to Serial converter, which is what I suggested getting.

Some microcontrollers have the ability to do USB CDC without the help of external chips.

Here is some information on that for the s3 and c3 variants

https://docs.espressif.com/projects/arduino-esp32/en/latest/tutorials/cdc_dfu_flash.html

Likely the device will appear and disappear as power does. This is why I suggested the external converter. But it sounds like what you have is working for you.

I did buy one of those blue ones years ago for my Raspberry Pi 1 (before I discovered ssh), but I have lost it. I have since bought a variety of adaptor cables (I don’t trust my soldering to make up cables on demand), and this one looks the same but a long black shield, so yes there’s a good chance that it’s a USB-serial converter.


Curiously minicom has no trouble to receive log from /dev/ttyUSB1 … but esphone run cannot receive serial data - despite the RX LED on the DevkitC module flashing furiously during the …

Copied firmware to /home/don/ESPHome/.esphome/build/greenhouse/.pioenvs/greenhouse/firmware.ota.bin
======================================================= [SUCCESS] Took 20.40 seconds =======================================================
INFO Successfully compiled program.
esptool v5.1.0
Serial port /dev/ttyUSB1:
Connecting......................................
ERROR Running command failed: Failed to connect to ESP32-S3: No serial data received.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
ERROR Please try running esptool --before default-reset --after hard-reset --baud 115200 --port /dev/ttyUSB1 --chip esp32s3 write-flash -z --flash-size detect 0x10000 /home/don/ESPHome/.esphome/build/greenhouse/.pioenvs/greenhouse/firmware.bin 0x0 /home/don/ESPHome/.esphome/build/greenhouse/.pioenvs/greenhouse/bootloader.bin 0x8000 /home/don/ESPHome/.esphome/build/greenhouse/.pioenvs/greenhouse/partitions.bin 0x9000 /home/don/ESPHome/.esphome/build/greenhouse/.pioenvs/greenhouse/ota_data_initial.bin locally.
INFO Upload with baud rate 115200 failed. Trying again with baud rate 115200.
esptool v5.1.0
Serial port /dev/ttyUSB1:
Connecting......................................
ERROR Running command failed: Failed to connect to ESP32-S3: No serial data received.
For troubleshooting steps visit: https://docs.espressif.com/projects/esptool/en/latest/troubleshooting.html
ERROR Please try running esptool --before default-reset --after hard-reset --baud 115200 --port /dev/ttyUSB1 --chip esp32s3 write-flash -z --flash-size detect 0x10000 /home/don/ESPHome/.esphome/build/greenhouse/.pioenvs/greenhouse/firmware.bin 0x0 /home/don/ESPHome/.esphome/build/greenhouse/.pioenvs/greenhouse/bootloader.bin 0x8000 /home/don/ESPHome/.esphome/build/greenhouse/.pioenvs/greenhouse/partitions.bin 0x9000 /home/don/ESPHome/.esphome/build/greenhouse/.pioenvs/greenhouse/ota_data_initial.bin locally.
WARNING Failed to upload to ['/dev/ttyUSB1']
(ESPHome) don@ponder-mint:~/ESPHome$ 

Never mind. It’s better to update firmware over Wi-fi from the HA ESPHome Device Builder, while leaving minicom connected to the serial port.