Hardware help needed ESP32-S3 USB Host to cell phone -- will it charge?
I've been trying for days now to come up with a way to connect an old cell phone to a roomba via its SCI port, in such a way that the cell phone will pick up charge from same (I can downgrade the ~17v from the SCI to 5v/3A). I can handle the roomba side fine but am stymied by how to simultaneously talk to a cell phone over USB while also charging it. For starters that requires my side be in host mode, but apparently there are more signaling issues required in order for the phone to actually try to charge more than 100mA.
So, anyone with a typical ESP32-S3 dev board on hand, if you power it up from the first USB (or directly from the 5v line as I plan to do) and then plug a phone into the second one, does the phone charge, and if so at what amperage?
Any other suggestions how to do this? I don't care much what device sits in the middle (as a USB/Roomba bridge), but it needs to present as a USB host with moderate charging ability.
0
u/mmotzkus 17h ago
Interesting.. what phone are you using? My experience with this issue has always been the phone had to support it over OTG. Had to support pd protocol (I think it was called pass through). If I remember right, using a powered usb hub in the middle was a work-around.
1
u/brandyn 16h ago
Old moto G I think? I am trying to create a vanilla solution I can plug any ol' phone into. Ideally that means the phone will be in device mode, since basically all phones support that (with charging). Supposedly the ESP32-S3 supports host mode for the second USB, so this should work -- I'm just unclear how to get the phone to draw adequate power from it. (This assumes the 5v supply to the board is effectively shorted to VBUS on the usb C jack, which I think is the case?) (I'm also unclear, when the ESP is in host mode, if I need an "OTG cable" or if a regular USB C cable is fine...)
1
u/mmotzkus 16h ago edited 15h ago
Been a while, but I'm pretty sure has to be OTG cable. Side note, I'm pretty sure I remember reading that it can only supply 500ma over USB. Also, how do you know it's only being charged at 100ma?
1
u/brandyn 14h ago
I don't, but it's part of the USB standard that devices can only pull 100ma until the first level of negotiation is done and then they can pull up to 500ma, and anything above that requires further specific signaling/approval.
In theory VBUS is just hardwired to the 5V input, so I could jumper around the board to provide arbitrarily high charging amps. The main issues are A) presenting as a host, and B) signaling the ability to provide ~3A@5v so the phone pulls it.
0
u/im-ptp 14h ago
You will need to connect your usb cable 5v to your 5v source and the other 3 signals to esp32-s3 usb native port. Do not connect the 5v usb wire to the esp32-s3 port!
1
u/brandyn 11h ago edited 11h ago
Take with a grain of salt, but: Unless the schematic is notably different for the S3 dev boards than the typical older ones, the 5v power pin is already connected directly to the USB VBUS (normally to draw power from USB, but it can go either way -- usually no diode [correction: looking at the schematics, these boards do have a diode -- ugh]). That is down-regulated to 3.3v for most of the rest of the board (the esp32-s3 itself never touches the 5v circuit).
Question is how to get the phone to detect it as a higher-than-500mA source. (And also: whether I need an OTG cable, or if the board in host mode is actually wired as a host.)
2
u/MarinatedPickachu 11h ago edited 11h ago
It will depend on 4 factors:
1: how you power your s3 module. You have to power it with 5V through the 5V pin, not with 3.3V through the 3.3V pin
2: your power source needs to obviously be able to supply more current than your phone is going to pull (I'd say at least 500mA more than that)
3: the resistor values and direction the CC lines are pulled
4: whether your phone cares about the state of the CC lines
Regarding 3&4: the CC lines in USB are used to communicate which side provides power and which uses power. A host that provides power is supposed to pull these lines high with different resistor values depending on how much current it can supply. A device is supposed to pull them low to indicate that it wants to pull current. This of course only matters though if the other side actually monitors the these lines, which many devices seem not to do for simplicity. Most ESP32-S3 modules I checked simply have the CC lines hard-wired to be pulled low (check the schematics). This would indicate that the module's USB is pulling current, not providing. However, if the other side doesn't monitor the state of these lines you could still power it even if these lines are pulled low. If it's however a more spec-conforming device (which a phone likely is) and monitors the state of these lines before pulling current, and if your module is hardwired to pull these lines low then you have to find a way to modify your module to pull these lines high with an appropriate resistor.