4
\$\begingroup\$

I have been experiencing some trouble with the GPIO outputs of a Raspberry Pi 4 when a certain USB device is connected. The GPIO of the Raspberry Pi works perfectly fine when the USB device is not connected, but once connected, a lot of noise (~2Vpp) is introduced on the GPIO output.

It is not clear to me what is causing this behaviour. Is the Raspberry Pi faulty? Any suggestions on what I can adjust or how to better test this behaviour? The Raspberry Pi and the USB device do not share a common ground, could this be part of the problem? The USB device does have its own power source.

Oscilloscope measurement of GPIO17 and a simple script toggling GPIO 17

Oscilloscope measurement of GPIO17 and a simple script toggling GPIO 17

Schematic overview of the connections, red line is not present Schematic overview of the connections, red line is not present

\$\endgroup\$
4
  • \$\begingroup\$ The red line is essentially the GND and sheild in the USB cable. \$\endgroup\$ Mar 5 at 21:18
  • 1
    \$\begingroup\$ Does it happen if you disconnect the USB cable, and connect the two GNDs together (red line)? Does it happen with other USB devices or just the UBLOX. \$\endgroup\$ Mar 5 at 21:19
  • \$\begingroup\$ USB connection contains ground so the grounds are obviously connected between RPi and UBLOX. What's unclear is how the inverter works, and where have you connected the scope ground clip, and where is the scope mains plug grounded, so you might have ground loops. Update the diagram with all info about inverter and scope. \$\endgroup\$
    – Justme
    Mar 5 at 23:40
  • \$\begingroup\$ What is that inverter for? Since cheap inverters tend to be very noisy, and you have a problem with noise, what happens if you do 12->5v directly without using the inverter? \$\endgroup\$ Mar 6 at 1:25

1 Answer 1

3
\$\begingroup\$

You ask if the RPi is faulty. I would very strongly suggest not.

From your description it looks very much like the inverter/psu combination is giving you a 0V for the RPi which has significant noise relative to your battery 0V. Then, when you connect the USB cable (which is non-isolated) you are effectively coupling the two grounds, and the noise is becoming visible.

Alternatively, you are generating a ground loop when you connect the USB cable, and this coupling magnetic fields from the inverter, causing the same ground noise.

Whether the noise is causing a problem, or just visible on your scope because of where it is grounded, is an interesting question.

I would start by using your scope to probe to the 0V levels (battery and inverter/RPi), with and without the USB connection in place. What this shows should allow you to track down the cause of the noise.

In terms of resolving, there are a couple of suggestions:

  • Power the RPi directly from the battery using a 12V-5V converter, removing the inverter element.
  • Try solidly connecting the two ground via a thick, low impedance ground (as opposed to the USB link)
  • Add a "USB Isolator" on the USB link, to keep the two grounds separated.
\$\endgroup\$
1
  • \$\begingroup\$ Instead of powering the Raspberry Pi from an inverter, I installed a DCDC converter (12V to 5V) between the battery and the Raspberry Pi. This seems to have solved the problem. Thank you for all the good suggestions. \$\endgroup\$
    – RemiFM
    Mar 6 at 13:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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