augx3
Posts: 13
Joined: Tue Dec 10, 2019 11:49 am

How many gpio input can i trigger from 3v3?

Sat Jan 04, 2020 10:50 pm

hello,

i have 8 buttons,i take a cable connected from the 3v3 and connect this to each button to one of his 2 pin,the other pin of the button is attached to a resistor of 100 ohm ,then to a gpio in input

obv i have then 8 buttons and 8 gpios, they works,my question is,can i actually safely use the 3v3 pin to alimentate all 8 gpios with 100 ohm reistor each one without damaging the pi?

Thanks in advance.

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

Re: How many gpio input can i trigger from 3v3?

Sat Jan 04, 2020 11:27 pm

Yes

The resistor does not limit the current in normal use, because the input is high impedance (except you will need to activate the pull down resistor on each input). The series resistor is to protect the Pi against accidentally programming the pin as an output, setting it low, then pressing the button. The value should really be 1K to limit this fault current to 3.3mA.
Signature retired

boyoh
Posts: 1468
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: How many gpio input can i trigger from 3v3?

Sat Jan 04, 2020 11:40 pm

augx3 wrote:
Sat Jan 04, 2020 10:50 pm
hello,

i have 8 buttons,i take a cable connected from the 3v3 and connect this to each button to one of his 2 pin,the other pin of the button is attached to a resistor of 100 ohm ,then to a gpio in input

obv i have then 8 buttons and 8 gpios, they works,my question is,can i actually safely use the 3v3 pin to alimentate all 8 gpios with 100 ohm reistor each one without damaging the pi?

Thanks in advance.
Before you go any further with this project
Post a circuit drawing of what you want to do
The forum can then point you in the right
Direction GPIO In Puts have to be set to
A working impedance, Do you want it to
Except a active 1 high or a active 0 low

Regards BoyOh
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

augx3
Posts: 13
Joined: Tue Dec 10, 2019 11:49 am

Re: How many gpio input can i trigger from 3v3?

Fri Jan 10, 2020 8:36 am

boyoh wrote:
Sat Jan 04, 2020 11:40 pm
augx3 wrote:
Sat Jan 04, 2020 10:50 pm
hello,

i have 8 buttons,i take a cable connected from the 3v3 and connect this to each button to one of his 2 pin,the other pin of the button is attached to a resistor of 100 ohm ,then to a gpio in input

obv i have then 8 buttons and 8 gpios, they works,my question is,can i actually safely use the 3v3 pin to alimentate all 8 gpios with 100 ohm reistor each one without damaging the pi?

Thanks in advance.
Before you go any further with this project
Post a circuit drawing of what you want to do
The forum can then point you in the right
Direction GPIO In Puts have to be set to
A working impedance, Do you want it to
Except a active 1 high or a active 0 low

Regards BoyOh
hello boyoh,i will post the image of what i wanna do so u can see my intentions

ofc by pushing buttons the gpio will output 0 or 1 to the shield relay.

ty for ur interest.
Attachments
scheme.PNG
scheme.PNG (39.02 KiB) Viewed 334 times

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: How many gpio input can i trigger from 3v3?

Fri Jan 10, 2020 11:39 am

So all the resistor is doing is providing a safe current limiter in the event that you set one of the button inputs to an output and set it low while the button is pressed, without the resistor if you did this a high current would flow damaging your pi.

You should be using a 1K resistor as the current limiter to keep any fault current as small as possible, this will have no affect on the inputs as there is virtually no current flowing on a input , a single input will probably be consuming less than a micro amp.

You could use all 26 gpio pins as inputs and use the 3.3v pin for a pull up without any problem.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

augx3
Posts: 13
Joined: Tue Dec 10, 2019 11:49 am

Re: How many gpio input can i trigger from 3v3?

Wed Jan 15, 2020 3:04 am

pcmanbob wrote:
Fri Jan 10, 2020 11:39 am
So all the resistor is doing is providing a safe current limiter in the event that you set one of the button inputs to an output and set it low while the button is pressed, without the resistor if you did this a high current would flow damaging your pi.

You should be using a 1K resistor as the current limiter to keep any fault current as small as possible, this will have no affect on the inputs as there is virtually no current flowing on a input , a single input will probably be consuming less than a micro amp.

You could use all 26 gpio pins as inputs and use the 3.3v pin for a pull up without any problem.
hi pcmanbob,

So if i understand right my scheme will safely work,by putting a 1k resistor after 3v3 and before all pushbuttons,then just connect those to each gpio.

Do i have something special to do on the software side expect the typical sketch that sets pushbuttons gpios to input and the 4 gpios to the relay shield in output?

Doing this the pushbuttons gpios shouldnt drain much mA as you stated,but will the shield relay in addition ask for too much mA ?

It shouldnt but i might be missing something.

My shield relay
https://www.elegoo.com/product/elegoo-8 ... tocoupler/

Datasheets(note my case is the 8way):
https://elegoo.com/tutorial/Elegoo%20DC ... 8.8.11.zip

Thanks in advance.

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: How many gpio input can i trigger from 3v3?

Wed Jan 15, 2020 10:11 am

augx3 wrote:
Wed Jan 15, 2020 3:04 am


So if i understand right my scheme will safely work,by putting a 1k resistor after 3v3 and before all pushbuttons,then just connect those to each gpio.
yes

Do i have something special to do on the software side expect the typical sketch that sets pushbuttons gpios to input and the 4 gpios to the relay shield in output?
yes , if you don't know how to use the pi gpio I suggest to follow the physical computing guide and learn how to use it.

https://projects.raspberrypi.org/en/pro ... -computing

Doing this the pushbuttons gpios shouldnt drain much mA as you stated,but will the shield relay in addition ask for too much mA ?

It shouldnt but i might be missing something.
No the relay card should not draw to much current , but it may not work properly with the pi 3.3v gpio as you have ordered a 5v relay board,
you will probably need to have a separate power supply to power the relay board if you are using 8 or 16 relays .

explanation of why 5v relay boards don't work with pi

https://www.raspberrypi.org/forums/view ... 8#p1225448
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

augx3
Posts: 13
Joined: Tue Dec 10, 2019 11:49 am

Re: How many gpio input can i trigger from 3v3?

Wed Jan 15, 2020 12:17 pm

pcmanbob wrote:
Wed Jan 15, 2020 10:11 am
augx3 wrote:
Wed Jan 15, 2020 3:04 am


So if i understand right my scheme will safely work,by putting a 1k resistor after 3v3 and before all pushbuttons,then just connect those to each gpio.
yes

Do i have something special to do on the software side expect the typical sketch that sets pushbuttons gpios to input and the 4 gpios to the relay shield in output?
yes , if you don't know how to use the pi gpio I suggest to follow the physical computing guide and learn how to use it.

https://projects.raspberrypi.org/en/pro ... -computing

Doing this the pushbuttons gpios shouldnt drain much mA as you stated,but will the shield relay in addition ask for too much mA ?

It shouldnt but i might be missing something.
No the relay card should not draw to much current , but it may not work properly with the pi 3.3v gpio as you have ordered a 5v relay board,
you will probably need to have a separate power supply to power the relay board if you are using 8 or 16 relays .

explanation of why 5v relay boards don't work with pi

https://www.raspberrypi.org/forums/view ... 8#p1225448
Dear pcmanbob,

I actually tested the circuit based on your statements and it worked fine so far.

Now i only need 4 to 5 relays so can i plug em to pi?
P.s i actually opened ur links and read a thing or two and i will surely study it for further projects but rn im on a rush so can you just say me of with 4 or 5 relays somethin can go wrong?

I found out there are few relative problems.

Gpio 5 and 6 which i use for buttons are input 1 and they wont work if connect those to 3v3,do u know how to set them input 0 in nodejs or just default state at boot on the pi?

I also noticed that if i boot the pi with all circuit connected the relays will be kind of powered by the IN gpios that are going to be set as output once i start the program,can this cause faults or is not a big deal?

Ty in advance

pcmanbob
Posts: 9298
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: How many gpio input can i trigger from 3v3?

Wed Jan 15, 2020 12:45 pm

augx3 wrote:
Wed Jan 15, 2020 12:17 pm


Now i only need 4 to 5 relays so can i plug em to pi?
P.s i actually opened ur links and read a thing or two and i will surely study it for further projects but rn im on a rush so can you just say me of with 4 or 5 relays somethin can go wrong?
if you switch a number of relays at once it can cause a sudden voltage dip on the 5v supply , if this is take from the 5v pin on the pi gpio header , you might find your pi will do a sudden reboot.
Gpio 5 and 6 which i use for buttons are input 1 and they wont work if connect those to 3v3,do u know how to set them input 0 in nodejs or just default state at boot on the pi?
sorry no I don't use nodejs
I also noticed that if i boot the pi with all circuit connected the relays will be kind of powered by the IN gpios that are going to be set as output once i start the program,can this cause faults or is not a big deal?
It sounds like you relay board is active low, and is using the gpio as a ground as explained in the link I posted, so you are grounding a 5v circuit via the gpio not good in the long term for your pi.

I would suggest using an interface circuit between the pi gpio and the relay board , you can use a simple ULN2803A between the pi and the relay board, that way the 5v will be connected a an actual ground .

it will also make you relay board active high , so a high output will turn the relay on.

Here is an example of such a ULN2803A in use

Image
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Return to “Beginners”