Do you remember Windows Phone? Do you remember continuum? Do you remember Microsoft Display Dock?
This tiny extension turned your phone into a almost full funcional desktop with HDMI and USB Interfaces
the Display Dock works with Android on low level - USB devices are accessable aaaaand: the phone is charging while being connected to the USB devices. My application is a long running data collecting and uploading and it just works
Yes - its the Serial OTG extension which works super nice
my project is to read smart energy meters with IR receivers. the phone is connected (via display dock) to an USB-UART adapter with all control lines available
by active DTR or RTS i can switch between two receivers. IR detector(s) go to the Rx line. readouts are performed every 10s - and its intended to run 24/7
but the trick with the display dock is universal for all projects that connect hardware to USB and need to charge the phone as well - and display dock is 5€ these days