1
\$\begingroup\$

I would like to measure that voltage of a floating GPIO on a Raspberry Pi 3. When I use a multi meter or an oscilloscope it looks like the pin is pulled to ground and shows 0.

Another way of asking the question is, 'How can I determine if a GPIO pin is floating using an oscilloscope or multi-meter?"

How can I use an oscilloscope to measure the voltage of a floating GPIO pin on a Raspberry Pi?

\$\endgroup\$

5 Answers 5

4
\$\begingroup\$

One simple way is to measure the voltage to ground and then measure it to Vdd (which is 3.3V on the Raspberry Pi SOC).

Since most voltmeters have something like 10M input resistance you've effectively got a resistor across the meter input.

schematic

simulate this circuit – Schematic created using CircuitLab

If the meter reads about zero both ways then it is relatively high impedance (if there was 10nA leakage it would read 0.1 Volt). Leakage in the high impedance state is typically very loosely specified but it is normally extremely low at room temperature, so this method does work.


If it reads non-zero but both voltages add up to Vdd then it is probably fighting another output or is being switched at a high frequency (an oscilloscope will tell you the difference). This is the 4th combination of measurements, the first two are obviously high and low.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ I wish I could upvote twice... This is the correct answer. \$\endgroup\$
    – DrSheldon
    Commented Sep 9, 2018 at 19:17
2
\$\begingroup\$
How to measure voltage of a floating GPIO (Raspberry Pi)

The most practical answer is "You don't".

A floating CMOS input is very high impedance. That is usually 10s of MΩ at least, often 100s of MΩ in reasonable humidity with clean boards.

Your question then really comes down to "How do I measure a voltage with a few 100 MΩ impedance?". Again, the realistic answer for someone that has to ask here is "You don't".

Typical voltmeters and oscilloscopes with 10x probes have 10 MΩ input impedance. It should be obvious that connecting 10 MΩ to a 100 MΩ source is going to drastically change the source voltage.

There is specialized equipment and specialized techniques that can measure voltages at such high impedances, but these are not easily accessible to amateurs.

Then there is the question of what the purpose is? After all, it's floating, so can pick up any random voltage for unpredictable reasons. What information would you get out of knowing what the voltage is at one particular time? Your whole question therefore makes little sense.

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

With "floating" I think you meant the Z mode (high impedance) of a tri-state pin.

This is difficult to measure, since if you touch it, it stops being high impedance
Ideally you need a SMU (source measure unit), a fancy power supply, to measure the leakage current of the GPIO.

With those numbers you can calculate the expected "floating voltage".

enter image description here (image source)

Since a SMU is expensive equipment, few people have access to this high end equipment.
Broadcom has measured these numbers in their characterization, and these are published in the datasheet of the BCM2837B.

However, it's is generally recommended to avoid the high impedance mode on any gpio, except analog. Either use external pull-up/down resistors, or enable the internal weak pull resistor when you're able to.
"Floating" pins can cause sporadic issues in the field when the pins are used by hardware or code.
Pins that are not in use are sometimes left "floating" to save energy, but on an RPI3 this is insignificant.

\$\endgroup\$
1
\$\begingroup\$

Assumptions for the purposes of this answer. Nothing is connected to the pin (open circuit). You have set the pin to float in the code. You want to check if the code has actually set the pin floating.

How can I determine if a GPIO pin is floating using an oscilloscope or multi-meter?

To check if the GPIO pin is floating, attempt to pull the pin up to the logic voltage supply (or down to ground) using a resistor. If the voltage follows the pull, then the pin is floating. If the voltage stays low when you try to pull it high (or stays high when you try to pull it low) then the pin isn't floating.

I'd start with a 10kΩ for the pull resistance.
Be aware that the microprocessor may have its own internal pull resistors that are controlled by software.

\$\endgroup\$
1
\$\begingroup\$

You can try to measure the voltage by any means you have. But consider that there is no such thing as truly floating.

Modern GPIO pads on MCUs have many dozens of semiconductor structures attached to it, in buffer, output (disabled) buffer, ESD structures, etc., and every structure (diode, transistor/switch) would have certain leakage (conductance), which can be in both directions, to Vcc rail, or ground. So the sum of leakages is hardly predictable. Manufacturers only guarantee that the leakage won't exceed, say, +-1 uA, which comes to about 3 MOhms and above. So you would need a voltmeter/probe with 100 MOhms input impedance, but the measurement won't make much sense due to the above considerations. When you try to use a 20-K DMM or even 1 MOhm scope probe, the instrument input impedance will drag the pin down and you will read zeros.

Many MCU vendors have "weak pulls" to create definite voltages on unconfigured pins during power-up sequence, to avoid uncertainties.

For some details on GPIO leakages see this answer.

The simplest way to determine is a GPIO pin is "floating" is to put a 10-MOhm standard scope probe on it, and touch the pin with finger. If you see 50-60 Hz rail-to-rail waveform, the pin is floating.

\$\endgroup\$

Your Answer

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

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