# Can a raspberry sink 5V

I'm using a raspberry pi to program an atmega328p. During my tests I was using 3.3V to power the avr and it was pretty straightforward, whenever a program is about to be written I pulled low pin 1 (reset) as per the specification and went to town.

Now the real deal is running on 5V and thus it's pin 1 is also kept high with 5V.

simulate this circuit – Schematic created using CircuitLab

Pretty much anywhere you look you will find that feeding 5V into a GPIO is not a good idea, however with a 10k resistor that's about 0.5mA which should not be a problem?

Alternatively if I had to use a transistor, I'm guessing I'd have to go with a PNP type which would also sink the 5V so I don't really know how that would work out.

I'm still just a noob here, please don't be harsh, and thank you for your time!

• raspberrypi.stackexchange.com/questions/84640/… Feb 4, 2021 at 16:52
• sink (and source) refers to current, not voltage .... pull down and pull up refers to voltage Feb 4, 2021 at 17:52

No, this is outside of the pi's electrical specs.

Use an NPN transistor (with base resistor) or better and more simply N-FET, either configured as an inverting "low side switch" to pull down the ATmega's reset line, in response to a positive output from the PI GPIO.

Also make sure you're performing appropriate level conversion on any UART or other signals between the pi and ATmega.

• But how would I go about if I use the default avrdude configuration in which the reset pin geta pulled low. That wouldn't work with an npn transistor and a pnp would still have to sink more than 3.3V? Feb 4, 2021 at 17:44
• Change the software, perhaps adding an "invert reset" as a commandline/config file option, done right it's probably worth a pull request (assuming avrdude actually knows about linux GPIO's and isn't just using a helper program). Or if you're unwilling to do that, put in an inverter (IC or another transistor) between the GPIO and the transistor, or use a non-inverting buffer with suitable specs to output 5v logic while accepting 3v3 logic. Feb 4, 2021 at 18:59
• I've got some of those cheap 3 to 5 volt logic level converters but I'm not sure how that would work with pulling the high side low... Feb 4, 2021 at 19:19
• The ones with the FET in the middle and the pull-up resistor on each side would probably work if you get the high/low voltage sides properly oriented, since for the reset line you're basically doing what they do which is switching low or letting a pull-up hold it high. At moderate baud rates (and/or adding lower value pull-ups) the other channels would also work for serial UART. Feb 4, 2021 at 20:15

No, the Raspberry Pi IO pins are NOT 5V tolerant. Limit the input to 3.3V.

There are many ways to do this, but the easiest way would be using a 74HCT14 and chaining two for the proper logic. I would use the 5V rail in the Pi for this to power it. I would also put a 100 ohm resistor in series from the Pi's GPIO pin to the 74HCT14 just for protection in case the 74HCT14 fails.