Looking for solution how to control 3.3V relay by Arduino digital pins,

AnalogKid

Joined Aug 1, 2013
12,242
R1 can be higher 4.7k to about 9k.
Don't think so. Assuming a 5.0 V output from the Arduino (which it is not), the base current would be 4.4 mA at 1 K, and less than 0.5 mA at 9 K. The 1 K current is ok, but the 9 K current is way too low to assure firm saturation at 50 mA collector current.

At Ic = 50 mA, the 2N3904 has a minimum specified gain of only 60. If you stick to the 10:1 rule of thumb, even the 1 K current is too low. If the Arduino output voltage is only 3.3 V, then both resistor values are off.

ak
 

Attachments

Wolframore

Joined Jan 21, 2019
2,619
I was calculating min beta of 100…with 4.3v dropped across R1, we should get 47 mA. I forget about BJT saturation issues.

perhaps better idea to use a logic level MOSFET.
 

AnalogKid

Joined Aug 1, 2013
12,242
I was thinking maybe a logic level MOSFET... 2N7000?
The datasheet specifies full enhancement at Vgs = 10 V, so even though it behaves very well at Vgs = 5 V, it is not a true logic level part.

And I know this goes back to the 60's when MOSFETs were extremely delicate, but I'm never comfortable recommending driving an inductor with a FET. I've lived through almost the entire history of FET development, know all of the arguments, and have designed them into a variety of power application. But, still . . .

ak
 

Wolframore

Joined Jan 21, 2019
2,619
I have some 2N7000 - are these super old? Their RDS is pretty high.

try the Si2302 or something similar, the RDS is several factors better and will trigger down to 2.5V Vgs with about 100 mOhms Rds… if you need thru hole, look into IRL series… they are overkill but easy to work with.
 

Wolframore

Joined Jan 21, 2019
2,619
I agree with generally using a BJT to drive an inductive load, but with the back EMF clamped, it should be fine. I just don't like the thought of wasting 5 mA to drive 50mA. With PMOS, even with a pull down (which in this case you might not need) you can keep it well within 100:1 and if speed is not an issue much lower current. I usually double up with a PMOS on critical use just in case.
 
Last edited:

Thread Starter

LAOADAM

Joined Nov 21, 2018
956
Thanks all participants.
I'll use Arduino+PC817C+Omron G5V relay. any suggestions please.
what's the function of 2N2222 of the picture below.
FP6P4ZRIFMTPOTD.jpgFP6P4ZRIFMTPOTD.jpg
 
Last edited:

Thread Starter

LAOADAM

Joined Nov 21, 2018
956
Great!
Thank you dl324.
I got a question about what's the deference of the pictures below:
DOWN.jpeg

AND
pastedImagUP.png
 
Last edited:

dl324

Joined Mar 30, 2015
18,449
I got a question about what's the deference of the pictures below:
The first picture is driving the relay low side and the other is driving high side. The second is not a desirable configuration. You'd normally use a PNP transistor so you don't lose a diode drop for the coil voltage. Wherever you found the second circuit, I'd suggest avoiding them in the future.
 

Thread Starter

LAOADAM

Joined Nov 21, 2018
956
The first picture is driving the relay low side and the other is driving high side. The second is not a desirable configuration. You'd normally use a PNP transistor so you don't lose a diode drop for the coil voltage. Wherever you found the second circuit, I'd suggest avoiding them in the future.
Thanks.
I found that here, actually I prefer first one too, but I soldered a PCB which is not easy to modify, so:
https://prometec.org/actuators-and-sensors/arduino-and-relays/
I'll keep your advice.
seems not work. I measured the empty VE (even VB) uo to ~4V, so the control is very unstable. why?
 
Last edited:

ScottWang

Joined Aug 23, 2012
7,504
Put two or three rectifier diodes in series with the relay coil to drop the voltage.
The output of GPIO is not enough current to drive the relay coil, AnalogKid already mentioned in #9.

The Aduino only could provide 40mA for each pin, otherwise it will be more easier, it just needs a resistor to limits the current for relay coil.
 

djsfantasi

Joined Apr 11, 2010
9,237
The output of GPIO is not enough current to drive the relay coil, AnalogKid already mentioned in #9.

The Aduino only could provide 40mA for each pin, otherwise it will be more easier, it just needs a resistor to limits the current for relay coil.
Plus, 40mA is a maximum. Designs usually only provide 20mA per pin.

And, one has to consider the total maximum of 200mA that an Arduino’s voltage regulator can supply.
 
Top