phentux
Posts: 7
Joined: Sun Feb 09, 2014 11:29 pm

Trouble with GPIO

Mon Apr 28, 2014 1:50 am

Hi everyone, i have a triuble with the output of the GPIO. I want to use a relay with the output, i supose the A is not enough because the relay turns on with 3V, the V of the output. Now my question is, how can i do for turn on the relay?

I tryed with the Darlington NPN configuration with the 2N2222

Image

But nothing happen. Please, help.

PS: I know about the existance of the relay card:

Image

But i cant use it. Really, thank you.

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Trouble with GPIO

Mon Apr 28, 2014 1:57 am

Hi,
phentux wrote:But i cant use it.
Connect together GND of RasPi and GND of the relays' power supply.


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

phentux
Posts: 7
Joined: Sun Feb 09, 2014 11:29 pm

Re: Trouble with GPIO

Mon Apr 28, 2014 2:13 am

FLYFISH TECHNOLOGIES wrote:Hi,
phentux wrote:But i cant use it.
Connect together GND of RasPi and GND of the relays' power supply.


Best wishes, Ivan Zilic.
Hello Ivan, well, if i dont do that will never work, but my question is about what kind of transistor should i use for this, and what configuration. Thanks.

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Trouble with GPIO

Mon Apr 28, 2014 2:19 am

Hi,
phentux wrote:my question is about what kind of transistor should i use for this, and what configuration.
What is required current to fire the relay ?


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

User avatar
Richard-TX
Posts: 1549
Joined: Tue May 28, 2013 3:24 pm
Location: North Texas

Re: Trouble with GPIO

Mon Apr 28, 2014 2:48 am

You dont need a transistor to fire the relay. What is really needed is to fully turn on the opto-isolator. Thos Siansmart relays are not the best designed boards around. If you really want to use a transistor, I would use a 2N7000.
Richard
Doing Unix since 1985.
The 9-25-2013 image of Wheezy can be found at:
http://downloads.raspberrypi.org/raspbian/images/raspbian-2013-09-27/2013-09-25-wheezy-raspbian.zip

phentux
Posts: 7
Joined: Sun Feb 09, 2014 11:29 pm

Re: Trouble with GPIO

Mon Apr 28, 2014 2:50 am

I really dont know, i dont have a multimeter, but with the current of the 5V output of the RPi is enough. So, I can use a transistor to amplify the current, but i dont know how.

Tarcas
Posts: 741
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: Trouble with GPIO

Mon Apr 28, 2014 3:17 am

You really don't need a transistor in the circuit. I have a 4-relay board similar to that and it works on 3.3v to the IN pins.

I must confess I'm not entirely sure what that IC between the Pi and the Relay board is for. Is that a buffer? A transistor array? Sorry... I didn't use anything there.

Connect the 5v to JD-VCC on the board, not VCC.
Connect 3.3v from the Pi to VCC on the board. (This is compared against the 3.3v on the IN pins. If you're using a 5v GPIO, you would jumper 5v between both the VCC and JD-VCC rails.)
Connect your GPIO pins
And of course the ground from Pi to ground on the board.

This setup worked for me.

phentux
Posts: 7
Joined: Sun Feb 09, 2014 11:29 pm

Re: Trouble with GPIO

Mon Apr 28, 2014 3:35 am

Tarcas wrote:You really don't need a transistor in the circuit. I have a 4-relay board similar to that and it works on 3.3v to the IN pins.

I must confess I'm not entirely sure what that IC between the Pi and the Relay board is for. Is that a buffer? A transistor array? Sorry... I didn't use anything there.

Connect the 5v to JD-VCC on the board, not VCC.
Connect 3.3v from the Pi to VCC on the board. (This is compared against the 3.3v on the IN pins. If you're using a 5v GPIO, you would jumper 5v between both the VCC and JD-VCC rails.)
Connect your GPIO pins
And of course the ground from Pi to ground on the board.

This setup worked for me.
Thanks Tarcas, but i dont have the relay board, so i cant use it. I need the transistor.

User avatar
FLYFISH TECHNOLOGIES
Posts: 1750
Joined: Thu Oct 03, 2013 7:48 am
Location: Ljubljana, Slovenia
Contact: Website

Re: Trouble with GPIO

Mon Apr 28, 2014 3:44 am

HI,
phentux wrote:I need the transistor.
I like when people take life in a simple way... As said, to answer you about proper transistor, we need to know the current trough the relay. Optionally, post the relay label/type/model.

Without this information I could only write: NPN transistor + 1k ohm base resistor + protection diode like 1N4001.


Best wishes, Ivan Zilic.
Running out of GPIO pins and/or need to read analog values?
Solution: http://www.flyfish-tech.com/FF32

phentux
Posts: 7
Joined: Sun Feb 09, 2014 11:29 pm

Re: Trouble with GPIO

Mon Apr 28, 2014 4:02 am

FLYFISH TECHNOLOGIES wrote:HI,
phentux wrote:I need the transistor.
I like when people take life in a simple way... As said, to answer you about proper transistor, we need to know the current trough the relay. Optionally, post the relay label/type/model.

Without this information I could only write: NPN transistor + 1k ohm base resistor + protection diode like 1N4001.


Best wishes, Ivan Zilic.
This is it!!! thank you man!!!

Tarcas
Posts: 741
Joined: Thu Jan 09, 2014 5:38 am
Location: USA

Re: Trouble with GPIO

Mon Apr 28, 2014 4:23 am

How to use relays and relay boards with the Pi This video should show you how to wire up your relay, without the extra components being included on the board.

Return to “Beginners”