Relay circuit and over use of components

Thread Starter

abc14

Joined Oct 15, 2017
123
Hello Chaps,

I have relay connected in my circuit as follows.


upload_2018-9-13_12-31-15.png
disclaimer, this circuit is representation taken from google


Where IN2 is input from my MCU which is driving the logic with 3.3v. And my Load is 230V boiler. Basically the relay is turn on/off usual bog standard central heating boiler.

The circuit above is working fine. But am starting to wonder whats the point of U3 photo-coupler, I could simply control the relay VCC which is 5V with a npn transistor and flywheel diode to counter the back emf. So U3 seems a bit of overkill.
 

MrChips

Joined Oct 2, 2009
30,712
Maybe, maybe not. The devil is in the details.

VCC and JD-VCC could be on different devices, one at 3.3V and the other at 5V.
Maybe, the two portions of the circuit shown are already installed on two separate devices.
U3 provides an additional level of protection (isolation).

If it works I wouldn't change it.
 

Thread Starter

abc14

Joined Oct 15, 2017
123
Maybe, maybe not. The devil is in the details.

VCC and JD-VCC could be on different devices, one at 3.3V and the other at 5V.
Maybe, the two portions of the circuit shown are already installed on two separate devices.
U3 provides an additional level of protection (isolation).

If it works I wouldn't change it.

Well the entire circuit is getting supply from one single source of 5V, which is coming from mains supply after passing through 230V- 5V converter module. But there is extra 3.3v voltage regulator is on the board, to supply 3.3v for the MCU
 

Alec_t

Joined Sep 17, 2013
14,280
Well, without the opto-isolator, if the collector junction of the transistor were to break down you would get 5V applied to the output pin of the MCU. It probably wouldn't like that.
 

Thread Starter

abc14

Joined Oct 15, 2017
123
Thanks guys. It seems keeping the opto is sensible. I was hopping to save 90 pence on the opto. Since I don't need a bank loan to sponsor the use of opto I might as well keep it.
 

LesJones

Joined Jan 8, 2017
4,174
I think a 3.3 volt logic signal is a bit low to drive a green LED (Say 2.1 volts.) in series with the LED in the opto isolator.( Probably in IR LED so this would have a forward voltage of about 1.35 volts.)

Les.
 

ebp

Joined Feb 8, 2018
2,332
The circuit is typical of relay boards that are sold on ebay and the like. For most applications the use of the optocoupler is just plain silly. The only reason to use such a circuit is if there is a need to galvanically isolate the control circuit from the relay coil supply circuit or there is some extremely unusual difficulty in managing "ground." If the relay coil supply is the same as the control circuit supply, there might be a few instances in a million where the optocoupler is anything but added junk.
 

Thread Starter

abc14

Joined Oct 15, 2017
123
The circuit is typical of relay boards that are sold on ebay and the like. For most applications the use of the optocoupler is just plain silly. The only reason to use such a circuit is if there is a need to galvanically isolate the control circuit from the relay coil supply circuit or there is some extremely unusual difficulty in managing "ground." If the relay coil supply is the same as the control circuit supply, there might be a few instances in a million where the optocoupler is anything but added junk.
That is what I thought, what could be max current passing through transistor ?

Am putting a transistor where collector could source 1.5A of current.
 

ebp

Joined Feb 8, 2018
2,332
re #8

I don't understand what you are asking.

The collector current is equal to the relay current. Typically you would select the resistor in series with the base to set the base current to something in the range of 1/20 of the collector current, but it depends on the gain of the transistor. (Often you will see people say use a ratio of 1/10, but this comes from the way saturation voltage is specified and is a rather silly rule of thumb. If the transistor has sufficiently high gain at the current required, then there is no need to grossly overdrive it. e.g. If the relay required 50 mA and the transistor had a typical gain of 70 at that current at low temperature, I would assume half that gain and use 50/35 = 1.4 mA base drive.)

The other thing you commonly see is a 1N400x diode used across the relay coil. It is OK for the purpose but bigger and more expensive than it needs to be. The peak diode current is equal to the relay coil current, so unless the latter is more than about half an ampere, a 1N4148 type is quite adequate. If I'm driving a single small relay and need to keep things compact in surface mount, I will use a dual transistor - one normally and the other as a diode.
 
Top