mrmonkey09
Posts: 4
Joined: Mon Oct 09, 2017 9:43 pm

Resistor needed to connect raspberry pi to arduino pins?

Mon Oct 30, 2017 3:42 am

Hi, I have some code on an arduino that runs when the GPIO pin on the raspberry pi goes from high to low. It works how it is right now, but I'm worried that the current might be too high and I need to put a resistor in there. Will just a straight wire from the pi to the arduino be fine or should I put in a resistor ( say like 300 Ohms?) I know that the pi can only have 16 mA for each pins.

W. H. Heydt
Posts: 10763
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: Resistor needed to connect raspberry pi to arduino pins?

Mon Oct 30, 2017 4:32 am

Resistors can be used to limit current. Rather more important, as I understand it, Arduinos use 5v logic while the Pi GPIO pins are 3.3v. What you really need is a voltage level shifter as you do NOT want to hit a Pi GPIO pin with 5v.

mrmonkey09
Posts: 4
Joined: Mon Oct 09, 2017 9:43 pm

Re: Resistor needed to connect raspberry pi to arduino pins?

Mon Oct 30, 2017 4:58 am

the Pi GPIO pins should not receive 5 V from the arduino at any point, there is just one input on the arduino and one output on the Pi. Will the arduino pin have enough internal resistance to limit the current ?

drgeoff
Posts: 9744
Joined: Wed Jan 25, 2012 6:39 pm

Re: Resistor needed to connect raspberry pi to arduino pins?

Mon Oct 30, 2017 5:19 am

The issue of damaging a RPI GPIO is when it is exposed to voltages outside the 0 to 3.3 volt range. That can happen when an OUTPUT pin of a 5 volt Arduino is connected to a RPi GPIO*. It does not happen when the Arduino pin is an INPUT and there is no external pull-up resistor to 5 volts. Nevertheless a resistor of say 22 kohm between the Arduino and RPi provides a bit more 'insurance'.

(* an easy interface is a 2.2 kohm resistor between Arduino output and RPi GPIO and a 3.3 kohm resistor between the GPIO and ground.)

User avatar
davidcoton
Posts: 4025
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK

Re: Resistor needed to connect raspberry pi to arduino pins?

Mon Oct 30, 2017 11:01 am

If the Arduino pin is an input and is switching reliably with the Pi's 3V3 logic high, there is no problem in normal use. Logic inputs have high impedance.

There is a potential problem at power-up, when the Arduino could be in an indeterminate state -- which could output 5V at low impedance. A series resistor will prevent that doing short term damage (but is not a cure in the long term).

Note that with a direct connection (no resistor) the Arduino is also at risk at startup if both sides are trying to assert different output voltages. While the GPIOs should start up safely (both sides), the protection is for when the code goes wrong. A voltage divider (say 22K from Arduino to Pi, 33K from Pi to ground) will be safe even if the Arduino code wrongly programs an output on that pin. Those values should not affect the Arduino's input response, since the input impedance will be much higher and the 33K to ground will not overload the Pi. YMMV.
Signature retired

sora03
Posts: 193
Joined: Mon Dec 29, 2014 4:11 pm
Contact: Website

Re: Resistor needed to connect raspberry pi to arduino pins?

Mon Oct 30, 2017 2:18 pm

what signal are you gonna send? i have the same problem but with attiny85. in the end I just wired a 1k resistor to bc 548 and connected the E and C to attiny85 to simulte push button event..
FLOSS enthusiast, Debian user (linux-libre)

Return to “Beginners”