Electronic – How to force variable voltage fast charging power bank to output a certain voltage

battery-chargingdc motorpower supplyraspberry piusb

I am trying to power up my raspberry pi 3 with a Xiaomi 10000mAh fast charging power bank through the L298N motor controller. The motor controller can receive from 7 to 35V, and it has a 5v output, which I use to power my pi through the 5V pin. I also use a USB 2.0 to TTL UART Module 6Pin Serial Converter (https://www.aliexpress.com/item/CP2102-USB-2-0-to-TTL-UART-Module-6Pin-Serial-Converter-STC-Replace-FT232-Module/32534146426.html).

I read a bit about fast charging and how they control the voltage, and this is how the charger decides what voltage to output using the d+ and d- pin:
http://4.bp.blogspot.com/-nMZFNxoTcA0/VHX8GRZCLFI/AAAAAAAAAXA/VCn0OxdThAM/s1600/USBVoltage.jpg

The first problem is that the usb converter doesn't have the D+ and D-, but I believe it should be the RXD and TXD pin. I want my power bank to output 9V to the motor controller so I tried plugging a 3.3V to the 0.6V to the RXD and TXD (tried both way) but it doesn't change the output voltage. The second problem is that if I just plug the power bank to the motor controller, which it will automatically output 5V, it doesn't turn on the Pi.

I am new to these kinds of stuff so any suggestion on how to do this will be really helpful. Thank you.

Best Answer

Let me first to sort out your project architecture.

  1. You want to use a powerbank that has QC capability.
  2. You want to use a L298N motor controller board as a secondary power supply, to convert input (9V preferrable) into 5 V, to power your Raspberry Pi controller board.
  3. You are using USB-to-UART converter to get Rx/Tx interface (apparently to control the motor controller), from RPi USB port. Not sure why you are going through the extra bridge while Rpi has its own native UART.

So, you want to connect the Powerbank to L298N, and force PB to output 9 V, then the L298M will do whatever it is supposed to do, including 5 V power conversion to your RPi. In this configuration USB (nor Rx/TX) has nothing to do with the powerbank.

To get 9 V out of QC2.0 powerbank, you would need to make a special board between the PowerBank and L298N board emulating a Qualcomm QuickCharge capable device. This board must have a USB receptacle with D+ and D-, and it should provide QuickCharge handshake to the PowerBank. Keep in mind that the QC will not only sense certain combination of DC voltages on D+ and D- as your reference picture shows (it would be too easy to accidentally invoke higher voltages), but there should be some preliminary signaling on D+D- wires, with certain timing. The details of QC protocol are not publicly disclosed, but you can search for ICs that provide the QC functionality, they will have some practical details on what a QC needs.

EXAMPLE (from TPS61088 datasheet and CHY100 datasheet)

  1. A method to Enter QC2.0 According the description in the CHY100 datasheet, the processes to enter QC2.0 are:

− Apply a voltage between 0.325 V and 2 V to D+ for at least 1.25 seconds

− Discharge the D- voltage below 0.325 V for at least 1ms while keep the D+ voltage above 0.325 V

− Apply the voltage levels in Table 3 to set the output voltage. (must keep the D+ voltage above 0.325 V)

Good luck.