Connecting to PC via USB, while power supply is ON

All ESP32 boards running MicroPython.
Target audience: MicroPython users with an ESP32 board.
Post Reply
ajocius
Posts: 81
Joined: Mon Feb 19, 2018 6:31 am

Connecting to PC via USB, while power supply is ON

Post by ajocius » Sun Jan 05, 2020 6:47 pm

My ESP32 is running on it's own power supply (via 3,3V power input, not micro USB) and has quite few sensors physically connected. Is it ok to connect ESP32 to PC using USB cable without switching off external power supply? I would like to adjust code without dismantling ESP32 from it's current location.

Is there any other way to replace main.py file on ESP32 (ftp, wifi?)

User avatar
MostlyHarmless
Posts: 147
Joined: Thu Nov 21, 2019 6:25 pm
Location: Pennsylvania, USA

Re: Connecting to PC via USB, while power supply is ON

Post by MostlyHarmless » Sun Jan 05, 2020 7:46 pm

This very much depends on how your power supply is implemented and what protective diodes are in place. I would expect that your regular power supply is based on some type of voltage regulator. Even though they can withstand some back-voltage (which is a common thing when power is cut), there are limits to that.

Check this StackExchange discussion for some insights.

The next question would be "is the USB port properly protected from back-voltage?" As per USB 2.0 spec that is not allowed.


Regards, Jan

User avatar
jimmo
Posts: 1681
Joined: Tue Aug 08, 2017 1:57 am
Location: Sydney, Australia
Contact:

Re: Connecting to PC via USB, while power supply is ON

Post by jimmo » Mon Jan 06, 2020 12:01 am

In addition to the power supply you're using, it also depends on your ESP32 board. (i.e. how the USB 5V->3.3V regulation works and protection diodes on the board).

In general though, it is common for boards to be able to support this, but there are many that don't.
ajocius wrote:
Sun Jan 05, 2020 6:47 pm
Is there any other way to replace main.py file on ESP32 (ftp, wifi?)
FTP: There are a few different implementations of FTP servers for MicroPython.

WiFi: Use WebREPL. This comes with the firmware. See the ESP8266 instructions (same for ESP32) here: https://docs.micropython.org/en/latest/ ... -over-wifi

ajocius
Posts: 81
Joined: Mon Feb 19, 2018 6:31 am

Re: Connecting to PC via USB, while power supply is ON

Post by ajocius » Mon Jan 06, 2020 8:36 am

Great, thank you both! Too many ifs and buts when it comes to power supply, I know too little about protection circuits on my board, but if webrepl solution works, then it is even better :) I have enabled webrepl on my board, but could not see the way to copy over file. I see it now in documentation and will test it out.

Post Reply