1
\$\begingroup\$

I am working on a project where I have to communicate between an Android phone and a microcontroller through USB and continuously charge the phone. I have very limited experience with USB and would like some advice in my PCB design process.

The Android device has a type USB-C connector and is using USB 2.0 specification. The device will charge passively the vast majority of the time and I have no critical time constraints so the most simple solution that is robust is my goal.

My questions/considerations are the following:

I have been considering using STM32F446xC/E, the datasheet (page 36) says "For OTG/Host modes, a power switch is needed in case bus-powered devices are connected" Is it possible to use a usb-c to micro usb-b cable and design the pcb/mcu as a host like the application note from the same datasheet? enter image description here

Alternatively, if there is a problem with the solution that I do not realize, do I have to design it according to the dual mode like this ?

enter image description here

I have not started the design yet so I am flexible in my solution, if you have any other suggestion I would very much like to hear them!

\$\endgroup\$
0
\$\begingroup\$

If you want your MCU communicating with your android phone, the most common approach will be to use the MCU in a Device mode. Otherwise your phone (as a Device connected to a Host – a PC or MCU) will typically act as a storage device or a camera, you choose it on your phone when it is attached to a Host.

MCU's Device mode, on the other hand, is the same as connecting your MCU to a computer (via virtual COM-port over USB) like arduino does. You can communicate with your phone the same way, if the phone has USB OTG support. Which most of modern android phones does (check the phone specifications). If it doesn't, consider using bluetooth. If it does, all you need is a simple OTG Y cable like this one (except a USB-C version): USB OTG Y Cable Here is a video example.

It does exactly what you need: charging your phone while phone is communicating with an external USB device. It's also a good idea to make sure your phone (even if it does support USB OTG) is working with your MCU correctly – OS version, driver compatibility, etc. A dev board is handy for prototyping. You can test it with an Android app like Serial USB Terminal.

In any case, if you want to permanently attach your phone to a charger for a long period of time (to act as a touch screen of sort), you should consider powering your phone directly with [3.3V - 4.2V] from a filtered and stabilised buck converter or even a linear regulator, thus replacing the battery away. Because a lithium cell will degrade in this mode fast. About 3 to 12 month, depending on its quality (if new). Degraded lithium battery (esp. left unattended) could swell, overheat, explode, damage your phone and even cause fire.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.