How do I choose an optocoupler/transistor?

There are 2 circuits,one is a clap switch which provides output to ground voltage as 12 volts,and with a resistor,I managed to get an led to turn on each time I clap.I wanted to interface it with a clock which shows time when a button is pressed,but the problem is the button(marked as "show") isn't connected from microcontrollers  pin to vcc but from micro's pin to gnd (find attachment for reference).so I wanted to chose an optocoupler or transistor,but being a school student,I haven't  learnt about them,though I know how to connect them.

also,please suggest some method (transistors or optocoupler & which one) to increase the number of output leds without overloading the micro

Please help

Picture of How do I choose an optocoupler/transistor?

A K815P Optocoupler should do you.

You can get the datasheet here.


The question you ask is a complicated one as there are Triac, Darlington transistor, SCR optocouplers, and more it would depend on what you are doing, a CSR optocoupler for a job you would use a CSR and so on.

For your project replace the clapper LED with the Optpcoupler LED and the switch with the transistor side of the optocoupler.


Answer 1.png
Suraj Grewal (author)  Josehf Murchison3 years ago

thanks for the advise,had a few bc547,I wired them a few minutes ago,it did my job.But I preferd optocouplers though

That is correct. The button should be connected from the I/O to ground to work. Even if it was connected the other way round you would still need a transistor between the clap circuit and micro controller. Another BC547 would work just fine in this situation. What you need to do is connect the ground of the clap with the ground of the micro. The base of the transistor will connect to the positive leading to the LED. The emitter connects to the common ground and the collector needs to connect to the pin on the micro.

Suraj Grewal (author)  mpilchfamily3 years ago

bc547 worked