My first schematic of a 2-channel relay board

Thread Starter

StealthRT

Joined Mar 20, 2009
303
Hey all this would be my first try at creating a schematic in KiCad.

The schematic is a basic 2-channel relay.

The inputs are automotive 12v and gnd. This gets converted to 5v by the K78L05-1000R3.

The Wemos D1 mini has 2 digital pin outs that are 3.3v going to the LTV-356T with a 200 kOhms resistor in between.

From there it goes to a 1k resistor and then to the PMBT3904. Between that and the G5LE-1 relay is a 1N4007F.

In that same area is another 200 kOhms resistor that’s connected to an LED.

The outputs and inputs are the 2pos and 4pos 3.5mm Pitch Terminal Block Connector 300V 8A.

Just want to make sure my values are good and the components I have selected are suitable for my application. Please let me know if I am missing anything or have a value incorrect. Thanks!

1696103983301.png

Question also asked on:
maker.pro, electronics-lab, kicad, Elec. Stackexchange, electro-tech-online.
 
Last edited:

dendad

Joined Feb 20, 2016
4,376
Add a 10K pull down resistor from the Base to Emitter of each transistor.
The LED and resistors are wrong. The left hand end of R12 and R5 need to go to the relay supply. And I would run the relays and LEDs on the 12V supply (and 2K2 resistors for the LEDs) so as to keep the switching noise off the 5V supply. There is no real reason to use opto isolators if the supplies share a connection. The transistors could be driven from the port pins via suitable resistors of course. And the "200R" resistors would be 220R as that is a more common value.
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
Add a 10K pull down resistor from the Base to Emitter of each transistor.
The LED and resistors are wrong. The left hand end of R12 and R5 need to go to the relay supply. And I would run the relays and LEDs on the 12V supply (and 2K2 resistors for the LEDs) so as to keep the switching noise off the 5V supply. There is no real reason to use opto isolators if the supplies share a connection. The transistors could be driven from the port pins via suitable resistors of course. And the "200R" resistors would be 220R as that is a more common value.
Ok, got the 10K's.
View attachment 303848

Not sure what you mean by the R12 and R5 need to go to the relay supply. Should I just put the LED in line with the 3.3v going to the opto?
View attachment 303850

And I wouldn't be able to do 12v to the relay if its rated to only accept 5v for trigger, right?
 

dendad

Joined Feb 20, 2016
4,376
Not sure what you mean by the R12 and R5 need to go to the relay supply.
Have a look at your circuit. The resistor/LED pairs are shorted out. The resistor for the LED needs to be connected to the +5V, that is, they need to be across the relay coil.
Should I just put the LED in line with the 3.3v going to the opto?
NO! You need a series resistor when using an LED. They are current operated devices, not voltage. Also, if you have 2 LEDs in series as you show, the 3.3V will not be enough to turn them on as you will need about 4V as each LED will drop around 2V across it. (The voltage varies with the LED colour.)
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
Ah, good :)

Now what was this about the 12v for the relay? Would that really work if the relay is only rated to 5v for the trigger? Or am i reading the datasheet wrong for it?
 

dendad

Joined Feb 20, 2016
4,376
Use 12V relays on 12V. But is you have the 5V ones, that is ok, just go with what you have drawn. I'd also add a 2200uF electro on the +5V (and 12V too) supply to help keep the noise down.
You have not shown the power supplies. It is a good idea to include that on your circuit too. Good power supply filtering is always worth while. It is the foundation of your project.
Adding the 10K resistors I mentioned earlier will ensure the relays do not operate with floating transistor base connections. That may not be needed in reality but it is good practice to never leave things in an unknown state.
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
Use 12V relays on 12V. But is you have the 5V ones, that is ok, just go with what you have drawn. I'd also add a 2200uF electro on the +5V (and 12V too) supply to help keep the noise down.
You have not shown the power supplies. It is a good idea to include that on your circuit too. Good power supply filtering is always worth while. It is the foundation of your project.
Adding the 10K resistors I mentioned earlier will ensure the relays do not operate with floating transistor base connections. That may not be needed in reality but it is good practice to never leave things in an unknown state.
Good points there.

The power supply will be the automotive 12v from the fuse panel. The 2200uF would probably not be a bad idea due to that not constantly being 12v. I think i read it could "spike" during cranking up to ~20v).
 

dendad

Joined Feb 20, 2016
4,376
What is your 5V reg? Will it be a 7805? If so, make sure it is on a heat sink and has 10uF Tantalums from i/p to gnd and o/p to gnd close to the reg.
Also, a reverse diode across it, Anode to +5V, Cathode to the +12V. Here is an example circuit from the net.
1696107410183.png
 

dendad

Joined Feb 20, 2016
4,376
Ah. They are good. Those switch mode type regulators are very handy. When we first started using an early version of them, they were around $40 each I think, but now the price is much lower!
A good thing to do is to measure the voltages around your circuit before installing the WiMos, just to ensure you have no errors. That does help keep the smoke in!
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
Ah. They are good. Those switch mode type regulators are very handy. When we first started using an early version of them, they were around $40 each I think, but now the price is much lower!
A good thing to do is to measure the voltages around your circuit before installing the WiMos, just to ensure you have no errors. That does help keep the smoke in!
In your opinion would you do away with the opto altogether and just hook the 3.3v to the Transistor?
 

dendad

Joined Feb 20, 2016
4,376
UMDC16_Small.jpg
Here is an examle of one of my boards. There are optos used here as the processor has an isolated 5V supply, not connected to the 24V power. This vastly increases the reliability in the industrial uses this controller is used for. I have other boards that have relays that provide the isolation too. The trick is to have a 24V (or 12V) to 5V supply that is isolated. But in a lot of cases, that is not needed.
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
View attachment 303870
Here is an examle of one of my boards. There are optos used here as the processor has an isolated 5V supply, not connected to the 24V power. This vastly increases the reliability in the industrial uses this controller is used for. I have other boards that have relays that provide the isolation too. The trick is to have a 24V (or 12V) to 5V supply that is isolated. But in a lot of cases, that is not needed.
Wow. Thats quite the layout there. So are all of those SSR?
 

dendad

Joined Feb 20, 2016
4,376
The circuit in post #17 looks pretty good to me. Leave the 220R there.
In post #16, that board is a networked 16 I/O board. Wayne, the guy who designed the original version, came up with a way to have the pins on the green connectors both inputs and outputs. The FETs on the outputs switch to GND so you can have a relay coil from +24V to the pin and be able to turn it on or off. Also, a switch can be connected from the pin to GND to allow manually switching the relay. Or if just as an input, have no relay connected.
The trick with the bidirectional function is to have the processor turn off the o/p very briefly (if it is on) so it can then read the status on the pin to see if the switch is operated. This can be just 1mS or so and the output will not have time to change. Very clever I think. We have installed many of these boards and they have given great service for over 25 years.
 

Thread Starter

StealthRT

Joined Mar 20, 2009
303
The circuit in post #17 looks pretty good to me. Leave the 220R there.
In post #16, that board is a networked 16 I/O board. Wayne, the guy who designed the original version, came up with a way to have the pins on the green connectors both inputs and outputs. The FETs on the outputs switch to GND so you can have a relay coil from +24V to the pin and be able to turn it on or off. Also, a switch can be connected from the pin to GND to allow manually switching the relay. Or if just as an input, have no relay connected.
The trick with the bidirectional function is to have the processor turn off the o/p very briefly (if it is on) so it can then read the status on the pin to see if the switch is operated. This can be just 1mS or so and the output will not have time to change. Very clever I think. We have installed many of these boards and they have given great service for over 25 years.
That's wayyyyy beyond my understanding. But I am glad its working and pretty since it been running for 25 years!
 
Top