walterwoj
Posts: 28
Joined: Fri Mar 15, 2019 10:46 pm

Pi + Relay + LED require resistor?

Sat Mar 30, 2019 2:05 pm

I have a 8 channel relay that I am going to control with my pi. I was planning on running a jumper directly from the pi to the relay and put the to pin to a high state to activate the relay. I would also like to tap into the jumper to run a status led (blue 12v) to ground. Will this work? Do I need a pulldown resistor on the LED? Anything else I'm missing?

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

Re: Pi + Relay + LED require resistor?

Sat Mar 30, 2019 2:16 pm

I assume you are talking about a relay board and not just a relay on its own, most but not all relay boards are active low so you have to apply a low signal to the In pin on the relay board to turn on the relay. I suggest you test yours before connecting it to the pi.

There is no way to power a 12v LED directly from the pi because it has no 12v supply on board.
You would require a 12v supply to power the LED and a transistor circuit to interface the gpio to the 12v LED circuit.

Finally if the LED is rated to operate from 12v it probably already has a current limiting resistor.

edit.

A word of warning never connect any voltage greater than 3.3v to a gpio pin or you will destroy you pi.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

walterwoj
Posts: 28
Joined: Fri Mar 15, 2019 10:46 pm

Re: Pi + Relay + LED require resistor?

Sun Mar 31, 2019 7:35 pm

1.) You are right, my relay board is active low (weird to my thinking)
2.) They are 12 volt LEDs but they do light on 5 volts (tested) and 3 volts (also tested)

FYI: I have the relay board externally powered so it is not drawing all the power it needs from the PI

So here are my 2 questions:
1.) can I use a pull up resistor to power the LED?

IE splice my wire from the pi to the relay board and put the LED to +/VCC through a resistor. Will this work or is there another easy way to put an LED in to light up when the relay is active?

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

Re: Pi + Relay + LED require resistor?

Sun Mar 31, 2019 10:55 pm

walterwoj wrote:
Sun Mar 31, 2019 7:35 pm
here are my 2 questions:
1.) can I use a pull up resistor to power the LED?

IE splice my wire from the pi to the relay board and put the LED to +/VCC through a resistor. Will this work or is there another easy way to put an LED in to light up when the relay is active?
1) Yes, but you MUST only use 3V3 -- NOT 5V, NOT 12V. Use an LED without a resistor, not a blue one, and calculate the approximatre resistor value for the right current, allowing for the Vf of the LED.

2) The second question seems to be AWOL.
Signature retired

walterwoj
Posts: 28
Joined: Fri Mar 15, 2019 10:46 pm

Re: Pi + Relay + LED require resistor?

Mon Apr 01, 2019 1:10 am

Oops! you got me! Apparently I asked the same question twice! :mrgreen:

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

Re: Pi + Relay + LED require resistor?

Mon Apr 01, 2019 7:42 am

They are 12 volt LEDs but they do light on 5 volts (tested) and 3 volts (also tested)
If you have already tested them on 5V and 3V without a current limiting resistor and they have not just burnt out then as I said they probably already have a current limiting resistor.

so you would just need to connect them between 3.3v pin and the gpio pin to make them light up on gpio pin going low, but connecting both the LED and the relay board to one gpio pin my be to much for the pin to cope with, maximum supply or sink current 16mA per gpio pin & 50mA total for all active gpio pins

Also your relay board will probably be using 5v for the control circuit if it is active low, which I would never recommend connecting directly to the pi gpio.

explanation of 5v relay control circuit viewtopic.php?f=91&t=83372&p=1225448#p1225448
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Return to “Beginners”