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

Joined Nov 21, 2018
807
Hi,
any better solution than use resistance divider?
Thanks for help.

Joined Jan 15, 2015
6,531
Logic level shifter. The same chip is used on a dozen modules available through as many distributors. Nice feature is bi-directional. That assumes you only want to go from 3.3 volts to 5.0 volts or 5.0 volts to 3.3 volts.

Ron

Joined Nov 21, 2018
807
Logic level shifter. The same chip is used on a dozen modules available through as many distributors. Nice feature is bi-directional. That assumes you only want to go from 3.3 volts to 5.0 volts or 5.0 volts to 3.3 volts.

Ron
Thank you.
but seems it can't do the job.
Logic Level Converter Bi-Directional Module do the job below:

I need the 5v signal to drive the 3Vdc device, omron mini relay g6s2f 3vdc:

Last edited:

#### dl324

Joined Mar 30, 2015
14,318
Great!
Thank you.
If you're willing to take a chance on Ali Express, you can get 10 for the price of 1 on Sparkfun.

EDIT: Updated with seller that packages in antistatic bags (from one of the comments).

Last edited:

#### Wolframore

Joined Jan 21, 2019
2,533
forget about it, by the time it arrives you will have bought something else unless you can wait months between getting parts for a project.

#### SamR

Joined Mar 19, 2019
4,127
At least 6 weeks for anything coming out of china now... Sometimes 4 weeks in Shanghai alone.

#### SamR

Joined Mar 19, 2019
4,127
Have you looked at the relay PDF to see how many mA to pull it in? I often use a transistor switch for more than a 20mA draw needed on an I/O pin and supplied from an external PSU.

#### AnalogKid

Joined Aug 1, 2013
9,956
I need the 5v signal to drive the 3Vdc device, omron mini relay g6s2f 3vdc:
That relay draws 47 mA at 3 Vdc, which is too much for a uC I/O pin. Use a general purpose npn transistor such as a 2N4401, 2N3904, or 2N2222 as a saturated switch. A high GPIO output will turn on the transistor and drive the relay. Place a 470 ohm resistor in series with the base to limit the base-emitter current.

ak

#### Ian0

Joined Aug 7, 2020
4,863
If you are driving a 3V relay from a 5V output, all you need is a series resistor. The relay needs 47mA. You need to drop 2V @ 47mA. R=43Ω
But the pin can't source 47mA, so you need the transistor (as @AnalogKid said in the post above) to drive the relay.
Also, don't forget the 1N4148 diode across the relay coil to suppress the back EMF. It can go directly across the coil, or across the combination of coil and resistor, it doesn't matter.
A small MOSFET (2N7000) is another possibility.

#### BobTPH

Joined Jun 5, 2013
4,769
At least 6 weeks for anything coming out of china now... Sometimes 4 weeks in Shanghai alone.
I just got boards from JLCPCB in 7 days. $5 for the boards$20 for shipping.

Bob

Joined Jan 15, 2015
6,531
You have about a 47 mA relay coil. The BSS138N MOSFET used in these cheap logic level converters is a 200 mA Drain Current device. I would just run with Post #3. Buy a bucket of them.

Belay that, my bad. Looking at a schematic of one of those boards I see the problem is the current will be limited by the current in. The uC pin is not going to give you the current you need. Transistor used as a switch time, as was suggested.

Ron

Last edited:

#### Wolframore

Joined Jan 21, 2019
2,533
I just got boards from JLCPCB in 7 days. $5 for the boards$20 for shipping.

Bob
that’s different, it’s air freight. Most product though the China market consolidates and get shipped ocean freight.

#### BobTPH

Joined Jun 5, 2013
4,769
That was my point. If you pay for expensive shipping you can get things quickly.

Bob

#### SamR

Joined Mar 19, 2019
4,127
Most product though the China market consolidates and get shipped ocean freight.
Yes, for a while now, china postal sorting puts packages going to the same address into a consolidated package for further shipping. All of mine go by air but apparently there is also a pileup at the air shipping warehouses in china. Shanghai seems to be the big black hole for china shipping when following package routing. Not too bad coming from Hong Kong or Taiwan. And if you want it overnight you can pay the bill in gold. Also, for some time now, china packages in a plastic bag instead of boxes and the packages get beat all to hell unlike when they were boxed.

#### dl324

Joined Mar 30, 2015
14,318
forget about it, by the time it arrives you will have bought something else unless you can wait months between getting parts for a project.
I've been getting items from Ali Express in 2-4 weeks. The first time I needed those level shifters, I made the board using parts I had on hand.

#### SamR

Joined Mar 19, 2019
4,127
Just got some parts that were ordered 4 weeks ago, none of the others ordered then are here. And some orders now over 6 weeks since orders are still in shipping. And that is just for AliX. Amazon Prime usually has the same stuff at a premium but with fast delivery if in a hurry but you have to pay the middleman. Which is why I sit back and order direct to save what I can of the little I have to spend. And then there is always Digikey and the others when I must have it now and will pay the premium for it. But we are drifting a bit off topic here...

Joined Nov 21, 2018
807
Have you looked at the relay PDF to see how many mA to pull it in? I often use a transistor switch for more than a 20mA draw needed on an I/O pin and supplied from an external PSU.
Thanks

Joined Nov 21, 2018
807
That relay draws 47 mA at 3 Vdc, which is too much for a uC I/O pin. Use a general purpose npn transistor such as a 2N4401, 2N3904, or 2N2222 as a saturated switch. A high GPIO output will turn on the transistor and drive the relay. Place a 470 ohm resistor in series with the base to limit the base-emitter current.

ak
Thank you AnalogKid.