0
\$\begingroup\$

Im trying to interface a keypad button in a device with a MCU, and they need to be in different circuits, with no shared GND.

This keypad button has 5V DC when not pressed, and 0V when pressed. I want to use an optocoupler to "sense" when the button is being pressed (or released) so I can send a signal to an MCU.

But when pressing the button, the amount of current that flows is only 0.5mA. Is this current enough to "turn on" the internal led of an optocoupler, and then it switches the internal transistor?

I tried an ordinary led in series with the keypad button wiring, and although it allows current to pass and the button works, it never lights. The current in the led is even less, it's 0.32mA.

So, if an ordinary led doesn't light, would the optocoupler work?

The optocoupler I have is the 4N25. I can't find if there's a min input current in its datasheet.

If not, is there another way for me to do it?

I added a diagram of "what I wanted to happen" and "what I did for testing", to be more clear. Diagrams

Thanks!

\$\endgroup\$
1
  • 1
    \$\begingroup\$ That datasheet is quite straightforward: Fig. 4 answers this question. However, I don't think this really solves your problem, which you sadly forget to fully explain: why on earth would the current through the button be so severly limited? \$\endgroup\$ – Marcus Müller Mar 18 '20 at 20:18
2
\$\begingroup\$

There is no minimum current but there are some graphs and you've fallen off the end of the curve.

enter image description here

But when pressing the button, the amount of current that flows is only 0.5 mA. Is this current enough to "turn on" the internal led of an optocoupler, and then it switches the internal transistor?

This suggests to me that you are wiring the opto-coupler in series with the button. (The 0.5 mA suggests a 10 kΩ pull-up resistor.) That's a bad idea because the 'low' voltage will now be the voltage across the opto-LED and this may make the original circuit unreliable.

schematic

simulate this circuit – Schematic created using CircuitLab

Figure 1. (a) The original circuit? (b) The proposed opto-isolator modification?

If D1 is inserted as shown in Figure 1b then the voltage at 'A' can no longer be pulled to zero.

schematic

simulate this circuit

Figure 2. A fix?

Instead, add an external, strong pull-up in series with the opto-LED and tie the cathode to the switch. Now you can get as much current as you want through the LED. With 330 Ω you should get about 10 mA.

\$\endgroup\$
4
  • \$\begingroup\$ Ok, So I need to find the 5V DC source line before it's own wiring to the switch, to allow more current to flow through the led without interfering with the current allowed to the button switch. is it right? \$\endgroup\$ – Rodrigo Mar 18 '20 at 21:38
  • \$\begingroup\$ You need to find the 5 V supply (the power supply - not the keypad input) on the keypad and wire that to R1 as shown in Figure 2. \$\endgroup\$ – Transistor Mar 18 '20 at 21:42
  • \$\begingroup\$ it worked! I managed to find a 5V source before the logic circuit and it worked perfeclty. Thanks a lot for taking your time for help me! \$\endgroup\$ – Rodrigo Mar 27 '20 at 12:50
  • \$\begingroup\$ Good. Thank you for taking the time for the feedback and marking the problem as solved. \$\endgroup\$ – Transistor Mar 27 '20 at 12:57

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.