Wiring a CPC1708J relay to a raspberry pi to control a 0.25 amp fan problems

Riskinit

Joined Jan 28, 2022
65
SOLUTION: RELAY WIRING ISSUE

Good morning,

I have this circuit shown in the attached picture.

The Raspberry Pi is model b+ v1.2. The pinout can be found here.
The Relay is this CPC1708J.
The fan is a small brushless DC fan that takes 5v and 0.25 amps.

The Raspberry Pi pins can only output 0.16 amps at 3.3v so I need a relay to control when the fan actually turns on and supply the full 0.25 amps at 5v.

My problem is I turn on the Raspberry Pi pin 40 and the fan does not turn on. I test the voltage before and after the resistor and I am getting 3.3v on either side when pin 40 is turned on. I thought I could drop the voltage by using a resistor of approximately 210 R.

V = I * R

I need a 2.1 voltage drop for this particular relay which takes 10 mA.

2.1 / 0.01 A = 210 R

I put in a 217 R resistor which should drop the voltage slightly lower but I thought it would still be able to work at the reduced voltage.

Does anyone have ideas of what I am doing wrong?

Last edited:

geekoftheweek

Joined Oct 6, 2013
1,183
Looking at datasheet found here https://www.ixysic.com/home/pdfs.nsf/www/CPC1708J.pdf/$file/CPC1708J.pdf... If I am reading it correctly the maximum input current (on the LED) is 50mA. Note 3 under section 1.2 recommends a 20mA drive for high temperatures. What I am guessing is even though everything looks right math wise it's just not getting enough power to turn on. The problem then is you are getting close to the maximum output on the PI where you are now. It may take a transistor to switch the relay to make it all work. I could be wrong, but that would be my guess. Thread Starter Riskinit Joined Jan 28, 2022 65 Looking at datasheet found here https://www.ixysic.com/home/pdfs.nsf/www/CPC1708J.pdf/$file/CPC1708J.pdf...

If I am reading it correctly the maximum input current (on the LED) is 50mA. Note 3 under section 1.2 recommends a 20mA drive for high temperatures. What I am guessing is even though everything looks right math wise it's just not getting enough power to turn on.

The problem then is you are getting close to the maximum output on the PI where you are now. It may take a transistor to switch the relay to make it all work.

I could be wrong, but that would be my guess.
I would be more inclined to believe this theory if I saw a voltage drop across the resistor or if I understood why I wasn't getting a voltage drop...

but I am willing to pursue the idea of using a transistor in parallel with the relay or even in place of the relay.

I have a 2N4401 transistor available; otherwise I'll have to order something. Could you help me identify a transistor that takes 3.3 volts at the base (16 mA max) and then allows 0.25 amps at 5v to flow?

geekoftheweek

Joined Oct 6, 2013
1,183
I am having a tough time myself and don't really have anything on hand to throw together for a quick test. It just seems like that may be the case as I have had similar issues in the past.

I meant to use the transistor to turn on and off the LED of the relay. Google "npn transistor as switch". The 2N4401 should be more than enough to get it done.

Riskinit

Joined Jan 28, 2022
65
I am having a tough time myself and don't really have anything on hand to throw together for a quick test. It just seems like that may be the case as I have had similar issues in the past.

I meant to use the transistor to turn on and off the LED of the relay. Google "npn transistor as switch". The 2N4401 should be more than enough to get it done.
Based on this link the 2N4401 should work for my application in place of the relay I have chosen but I am having trouble identifying what resistor I need between my 3.3v pin and the base of the transistor. It looks like I connect my fan to 5v and the collector and then the emitter goes to a ground pin.

sagor

Joined Mar 10, 2019
898
Try putting the fan on the +5V to pin 3 side. If this SSR is based on a N-Channel MOSFET, it should be on the sink side (ground side) of the circuit.

KeithWalker

Joined Jul 10, 2017
3,034
There are more things you can do to find out what is going wrong:
Measure the voltage across the relay coil when the pin is high. What does the result indicate?
Are you sure you have the relay connected correctly? Re-check with the datasheet.
What is the resistance between the two pins of the relay coil? Is it what you expected?
Does it have a built-in back-EMF suppression diode? If so, is the coil connected the right way round?

geekoftheweek

Joined Oct 6, 2013
1,183
Actually noticed if your numbering is right the connections are wrong.

Pins 3 and 4 are what control the relay, 1 and 2 are what is controlled.

As far as the transistor goes you are getting into a gray area for me. If I am looking at all the information right 1000 ohms between the PI and the base should get the job done. I usually don't use them for more than turning of and off status LEDs myelf and usually use MOSFETs for bigger loads. It's cheaper and easier for me in the long run.

geekoftheweek

Joined Oct 6, 2013
1,183
There are more things you can do to find out what is going wrong:
Measure the voltage across the relay coil when the pin is high. What does the result indicate?
Are you sure you have the relay connected correctly? Re-check with the datasheet.
What is the resistance between the two pins of the relay coil? Is it what you expected?
Does it have a built-in back-EMF suppression diode? If so, is the coil connected the right way round?
Being a SSR most of this doesn't apply... no coil to speak of.

geekoftheweek

Joined Oct 6, 2013
1,183
Try putting the fan on the +5V to pin 3 side. If this SSR is based on a N-Channel MOSFET, it should be on the sink side (ground side) of the circuit.
I thought of this too, but every time I have searched this online it always seems to say since it is an LED turning on a photo transistor it doesn't matter. Kind of along the lines of high side N FET switching, but without having to boost the gate voltage to make it work. One day I'll try it out myself.

Riskinit

Joined Jan 28, 2022
65
Actually noticed if your numbering is right the connections are wrong.

Pins 3 and 4 are what control the relay, 1 and 2 are what is controlled.

As far as the transistor goes you are getting into a gray area for me. If I am looking at all the information right 1000 ohms between the PI and the base should get the job done. I usually don't use them for more than turning of and off status LEDs myelf and usually use MOSFETs for bigger loads. It's cheaper and easier for me in the long run.
Yep! I wired it wrong. Honestly, I don't know how to read this diagram other than it has a diode and an opto coupler?

Originally I was trying to control pins 1 and 2 to "open" pins 3 and 4. So now I am controlling pins 4 and 3 to "open" pins 1 and 2.

Original problem solved.

But the talk about transistors makes perfect sense for my application and it is \$7 cheaper than this relay so I think I will pursue that opportunity over the next day or two.

Thank you everyone for your help on this problem.