I am looking at programming a ATMEGA328/Arduino Uno over the SPi pins and Adafruit has a tutorial on how to do it - > https://learn.adafruit.com/program-an-avr-or-arduino-using-raspberry-pi-gpio-pins?view=all

However they do not mention if the SPI pins on the RPI is 5V tolerant and they also don't mention anything about using level shifters.

It seems like they are running the Chip on 5V and connecting the pins directly.

  • 4
    None of the Pins are 5 volt tolerant. Commented Dec 4, 2015 at 18:22

3 Answers 3


ALL the Pi GPIO are 3V3. NONE of them are tolerant of voltages outside the range 0 to 3.3V.


The only pin which feeds into the Pi will be that connected to MISO (Master In Slave Out). The simplest thing to do is use a voltage divider on that line to cut the ADC 5V output to a Pi safe 3V3. A voltage divider is typically a pair of resistors.

For an example see https://learn.sparkfun.com/tutorials/voltage-dividers/

  • Voltage dividers are good only for low speeds. For higher SPI speeds use a level shifter Commented Aug 30, 2020 at 17:37

I have experimented with interfacing between the PI GPIO lines and 5V HC logic. I have tried it both with the PI as an input and as an output, and experimented quite carefully.

Configured as outputs, the GPIO lines pretty strongly drive to 3.3V or 0V via the internal MOSFETS. Into a 10K load to ground or to 3.3V, there's not much voltage delta from the supply lines. However as soon as the GPIO is configured as an input (which is the default state) it becomes high impedance. If you connect this to 5V through a 47K resistor, then in practice I have measured the voltage at the GPIO pin at only a little lower than 5V. However I have not damaged the IO pin even though I have done this many times experimenting. 47K limits the input current that could flow into the PI from the 5V rail significantly.

The strange thing though is that when you google on the web for R-Pi GPIO equivalent internal circuit, there are clearly two diodes, which are normally reverse biased, one to ground and the other to 3.3V. This is a common input protection scheme and certainly helps prevent damage from impulse current from static discharges.

I found this strange in the light of the scenario described above where connecting the GPIO line via 47K to 5V (or even 10K), still gives at least 4.7V on the GPIO pin. The current is not high. I would have expected the internal diodes to clamp this to just a little above 3.3V. Indeed adding an external Schottky diode from the GPIO pin to 3.3V cuts this voltage down to about 3.5V.

As soon as code configures the pin as an output with logic 1, the 4.7V on the pin drops to 3.3V.

In summary, the equivalent schematic of the GPIO implies that the pins are tolerant to 5V as long as the current is small. However in practice, I would recommend driving the pins from 5V logic via at least 10K resistor and also connect an external Schottky diode from the pin to 3.3V to prevent the input pin's voltage rising much above the PI's supply rail.

However, to dig deeper, I did an additional experiment and measured the actual input current that flows into a GPIO pin configured as an input (without pull up or down resistors) when it is connected to 5V through a 47k resistor. Varying the input voltage (increasing from 0-5V) gives an unmeasurably small current (essentially zero) until the voltage rises above 3.3V. At this point the input current increases but it is still only 3.9uA from a 5V source via the series resistor.

I then tried it with a 10K series resistor and the current from the 5V source into the GPIO input pin was still only about 4.9uA. I tried some other resistor values and got the following results:

4K7 - 5.4uA
10K - 4.9uA
47K - 3.9uA
100K - 2.8uA

In light of this, it seems there is some current limiting going on, since choice of the resistor is not much changing the input current from a 5V source. I personally now think that provided you drive the inputs from a fairly high impedance source, such as one with a series resistor larger than 10K, you are unlikely to damage the GPIO inputs from connecting it to a 5V system.

I have no proof that there was no damage, other than the PI still seems to be working fine, however the currents involved seem too small to be worrisome.

All the experiments were done on a Pi-zero running Raspberian and used pin 12 on the GPIO header.


Late addition: be carefull with the reset pin. The atmega328P has a 60kohm internal pull up resistor on the reset pin... This might not damage the RPi but... well...

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.