3
\$\begingroup\$

(see update at the end)

This is a continuation of my previous question about a relay: Question

What I want is a notification LED for both power and if a switch is on, which controls the relay.

Below is the circuit I have in mind:

schematic

simulate this circuit – Schematic created using CircuitLab

Below are my calculations and reasons.

  • S1: Adapter 9V DC
  • D1: Voltage reducer, 1N4148, Vfw = 0.7 V
  • D2: Power indicator, Blue 3mm, Vfw 2.8-3.2 V. 5 mA is enough for a LED indicator.
  • R1: Resistor for power voltage indicator LED. V = I*R. R = V / I = (9 – 0.7 – 2.8) / 0.005 = 1,100 R -> 1,000 R … A will be V / R = (9 – 0.7 – 2.8) / 1000 = 5.5 mA. For minimum: A will be V / R = (9 – 0.7 – 3.2) / 1000 = 5,1 mA.
  • Relay_vcc will be 9 – 0.7 – 2.8 = 5.5 V, which is in spec (5 V , 120% is 6 V). The minimum value is 9 – 0.7 – 3.2 = 5.1 V
  • D3: Switch indicator LED. Should be around 5 mA. Green 3mm, VFw = 1.8-2.2 V
  • R3: Resistor for switch indicator LED. V = I * R.  R = V / I = (9 – 0.7 – 1.8) / 0.005 = 6.5 / 0.005 = 1300 R -> 1200 R, resulting in I = V / R = 6.5 / 1200 = 5.4 mA. In case of Vfw = 2.2 : V / R = (9 – 0.7 – 2.2) / 1200 = 5.1 mA

I'm wondering mostly if I miss something, and if my values are 'ok'. I hope this is not a too broad question, the reason I ask is since in my previous question I forgot to add the extra diode, so supplying around 6-7 V to the VCC (since I missed the 1N4148 diode).

UPDATE

I found out:

  • CH1 does not need has requirement regarding current, in examples from Arduino there is not a resistor between a GPIO and CH1 (or IN).
  • VCC probably uses the nominal current for the coil, which is about 75 mA.

However, my main question is:

Since VCC of the relay needs 75 mA, and D2 will burn when 75 mA is applied, but also D2 is used as voltage limiter, what should I do?

I read in other threads that a resistor divider is not good for relays, and the only other way I can think of is adding 5 or 6 1N4148 diodes, reducing the voltage to 9 - (5 * 0.7) = 5.5 V.

(Btw, the best solution is to use a 9 V relay module, or use 5 V input. Since I don't have the first one, I am going to use a 5V cable and cut it or check for some bracket).

\$\endgroup\$
  • 3
    \$\begingroup\$ How do you plan on putting 85mA (to run the relay) and 5mA through the LED (D2) at the same time? Also, even in you can conquer that little nugget, the voltage across D2 will change when you activate the relay. \$\endgroup\$ – Trevor_G Feb 27 '18 at 21:58
  • \$\begingroup\$ @Trevor_G Good point ... I have to go back and think it over again. Thanks for the fast reply!. \$\endgroup\$ – Michel Keijzers Feb 27 '18 at 22:03
  • \$\begingroup\$ Does the relay board already have an LED on it? Or not at all? And if not, what's the VCC on the relay board achieve? (Given that you have to supply enough current to run the relay coil, anyway.) \$\endgroup\$ – jonk Feb 27 '18 at 23:41
  • 1
    \$\begingroup\$ Ya I was talking tongue-in-cheek with "Nugget". The point is.. YOU CAN'T. The circuit is flawed. full-stop. \$\endgroup\$ – Trevor_G Feb 28 '18 at 15:47
  • 1
    \$\begingroup\$ @Trevor_G Yes I noticed. Well, at least I learnt from asking the question. Going for a 5V regulator. Thanks for your explanations. \$\endgroup\$ – Michel Keijzers Feb 28 '18 at 16:19
4
\$\begingroup\$

Step back to the actual requirements. Apparently you have a relay module that takes power, ground, and a control signal. You will control the module with a pushbutton. You want two indicator LEDs. One for power applied to the module, and one to indicate the relay is activated. Apparently the relay module requires 5 V power and signal, although that is not clear. The available power is 9 V.

Here is a solution:

IC1 makes 5 V from the input voltage. This always powers the relay module.

The 5 V also always lights LED D1. If D1 is a typical green LED with 2.1 V forward drop, then the current thru it will be about 5 mA. That's plenty good enough for most modern LEDs used as indicators indoors.

R2 and D2 work the same way, but are only powered when the pushbutton SW1 is pressed. Pressing the pushbutton also drives the control input to the relay module high. R3 makes sure the control input is low when the pushbutton is off.

While this does what it appears you want, the whole thing seems rather silly. If you want to control a relay from a pushbutton, just put the pushbutton in series with the relay coil. You can connect a LED to ground both before and after the pushbutton to indicate power and relay on. There is no need for a relay "module".

\$\endgroup\$
  • \$\begingroup\$ Thanks for this comment. And explaining about R3 (I should have known myself). However, I have a few additional questions. I assume the capacitors are for regulating? And I really wonder what IC1 is. The reason I use a module, is that I have a relay module only, while not having a coil. Also the module has an opto-isolator which makes it more 'safer' probably. I bought it to 'play' with microcontrollers. \$\endgroup\$ – Michel Keijzers Feb 28 '18 at 14:53
  • 1
    \$\begingroup\$ @Michel: IC1 is a 5 V regulator, like a 7805 for example. C1 and C2 are usually required by such regulators. \$\endgroup\$ – Olin Lathrop Feb 28 '18 at 15:47
  • \$\begingroup\$ Thanks for this addition ... I'm looking further into it. I cannot wait until I order them (which I will), so for now I will try to cut a 5V USB cable, and later replace by a 7805. \$\endgroup\$ – Michel Keijzers Feb 28 '18 at 16:21
  • \$\begingroup\$ (btw, until that time I use a 'real' shortcut: a 9 V adapter for USB, and cut a USB cable to feed the VCC directly with that +5v, works great. Also made my first PCB today, not a masterpiece, but it works (and I'm proud). \$\endgroup\$ – Michel Keijzers Mar 1 '18 at 1:19
  • \$\begingroup\$ (Thanks again for the answer) ... I soldered my first PCB board, but I left some space to hopefully later add the 7805 and use a 9V adapter instead of 5V USB cable. \$\endgroup\$ – Michel Keijzers Mar 1 '18 at 9:48
1
\$\begingroup\$

I found the YUROBOT 1 relay module schematic. You said yours appears to be like that, which may of course mean it is not exactly like that. However, the approach taken by the schematic I found seems to be a more correct approach than one that would have IN raised to \$V_\text{CC}\$ to activate it. It's more likely, as the YUROBOT 1 schematic shows, that they'd use grounding the IN pin as the way to activate it. Because that approach found in the schematic is more broadly useful and applicable. So I'm going to take what I found as more reliable.

One approach to consider is to actually destroy and replace the LED that is currently on the relay board. See schematic:

schematic

simulate this circuit – Schematic created using CircuitLab

Above, you'd identify and remove the LED on the relay module and then construct your container and external LED fixture. Wire that LED to the same pads where the original LED was located on the board. This would provide you with the "relay active" LED function.

There is no need to hang the "power ON" led off of the \$5\:\text{V}\$ supply. It can just as well be hung off of the \$9\:\text{V}\$, too. So I placed the power-on LED there, instead. Either approach is fine. And there are arguments that could go both ways. I just wanted to use this opportunity to make the point that it can be placed in either position.

Note that the button is shown going to ground. Given what I found on the web as a schematic for the relay board; together taken with what actually would make more sense to a designer of such a board to reach a broader marketplace; I suspect this is the more likely connection that achieves what you want. If it really is supposed to be wired the other way, then just tie it to +5, instead. But I suspect this is correct given what I found on the web.

The main thrust here is that you can use the existing circuitry on the board to power your external "relay ON" LED. They've already provided the necessary parts to make all that work correctly. So use it to your advantage.

\$\endgroup\$
  • \$\begingroup\$ Thank you very much for all the time you spent to answer my question. Changing the LED is an interesting idea, however, it is SMD, and I already have problems enough soldering normal DIP technology/PCB boards. I need to reread it tomorrow again when I'm more clearer than now (it's late at night). I finished my first PCB board, not a masterpiece (two leds, 3 resistors and a 5 header pins), and the soldering could be done better, but at the end everything works. \$\endgroup\$ – Michel Keijzers Mar 1 '18 at 1:18
  • \$\begingroup\$ I hope you are not disappointed, but I used a different solution: a 9 V adapter for USB, putting an USB cable, cut the USB cable, and use the +5 V and GND directly. \$\endgroup\$ – Michel Keijzers Mar 1 '18 at 1:18
  • \$\begingroup\$ @MichelKeijzers I hope everything works great for you -- and I expect it will. (I don't know why you doing something different would disappoint me. If I had that kind of problem, I would not be here. I added an answer because I wanted to. If it helps, great. And it might help someone else some other day.) \$\endgroup\$ – jonk Mar 1 '18 at 1:21
  • \$\begingroup\$ Well there will be improvements but that's for later, adding a STM32, controlling DMX directly, maybe even add nRF24L01+, and putting everything in a plastic enclosure instead of a carton box :-). \$\endgroup\$ – Michel Keijzers Mar 1 '18 at 1:23
  • \$\begingroup\$ Btw, you helped me too by learning more about a relay module, and the idea of changing this (or any) module myself to my needs. \$\endgroup\$ – Michel Keijzers Mar 1 '18 at 1:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.