# Raspberry PI powering a peripheral device while accessing it via USB causing PI brownout/short-circuit

My current project utilises a Raspberry PI (3B+ or 4B) to communicate and control an external peripheral device.

The Raspberry PI also has a UPS (PiJuice) attached, including a Li-Ion battery (and therefore ~3.7v).

Background

This peripheral device, was not designed or made by me, and is current limited in the device's circuitry preventing the device to be wholly powered via the USB cable. It was never designed to be used the way I am using it. It is instead, meant to be powered via a stand alone power source (AA batteries). USB was only meant to program the device, then be disconnected.

The device which requires ~4.2v-5v and pulling around 40mA to correctly operate within tolerances, contains a microcontroller (3.3V) and microSD card. When the voltage drops (AA batteries), other components on the device stop working, due to their own (less forgiving) tolerances. As mentioned above, when the device is connected solely via USB, the same component circuitry also stops working, as it doesn't receive sufficient power.

The device has my custom firmware, enabling access to the microSD filesystem via a MSD protocol.
The PI gpio is used to control the device's CLK, RST and another interrupt pin, externally signalled via jumpers, which switch the device between its normal mode, to MSD mode.

So in summary, the PI is connected to the device via both GPIO pins and a USB cable to access the USB MSD and interact with the USB HID, when the mode permits.

Side Note 1: Until I've come up with a working solution, I added a simple arduino style 5v relay, to disconnect the AA battery when not in use and conserve power, but this needs to go also.
Side Note 2 The device is highly sensitive to noise, as it records ultrasonic audio. The PI USB has been found to introduce noise in the ultrasonic recordings, so I added python code on the PI to control the USB hub power, which disconnects the USB power when the device is recording (not in MSD mode). This removes much of the the noise in recordings.

So far all this works, but it isn't nearly pretty or a long term workable solution.

Problem

I'm trying to remove the need for the additional power source for the peripheral device, as it causes big headaches when the AA batteries go flat. I have a battery right there, already in the PiJuice.

Connecting the 5V pin on the Pi to the VCC of the peripheral device causes the PI to turn off every time, whenever the USB port is also connected.

I can successfully power the device (no AA batteries), via the 5V pin on the PI whenever the USB is not connected.

Any suggestions how to power my peripheral device, and get rid of those pesky AA batteries?

tl-dr

Generally, when a peripheral device needs supplementary power and a USB connection as well, how should a PI connect to it?

• How much amp can your UPS provide at 5V? Drawing an extra 40mA shouldn't be a problem that the PI goes down. – Swedgin Mar 23 '20 at 8:59
• Want to thank @Swedgin for your reply. I haven't forgotten this question, but am forced to sidetrack before coming back and confirm your replies. – Victor Romeo Apr 1 '20 at 0:28