I don't know what's wrong... I have an ATTiny13 which gives a dummy impulse turning a fan on and off every 2 seconds; so the plan.

I attach two power sources (for dummy purpose) before and after the optocoupler (5V on the top right; and DV on the center bottom). In the experiment both have 5V but it has to be tested like this.

When I put an LED behind the opto instead of the fan, it shines bright and nice. When I replace it with the fan - you see it trying to move but without enough power so he just move 1mm until the power goes off again.


I just circled the optocoupler part.

It would be very nice if someone has a clue why there is such a voltage drop through the optocoupler.

EDIT: After the answers below I came up with this working solutions (it seems so). enter image description here

  • \$\begingroup\$ As mentioned in my comment below: add a resistor (> 1kOhm) between ATtiny and base of BC141. \$\endgroup\$ – Curd Sep 6 '19 at 9:58

The optocoupler is able to switch a few mA (the datasheet says max. 30mA @ 5mA input current) which is enough for a LED but obviously by far not enough for your DC motor.

A simple solution would be to add a transistor at the secondary side (motor side) of the the optocoupler.

  • \$\begingroup\$ I just tried this after I sent the question. But the current seems to be too low anyway. I use a 'BC 141-16' transistor which can switch 1A but nothing happens on the fan.... (when I put it directly on the 5V it turns; so the power supply has enough A) - any ideas? \$\endgroup\$ – dessi Sep 6 '19 at 8:02
  • \$\begingroup\$ How did you connect the transistor? \$\endgroup\$ – Curd Sep 6 '19 at 8:14
  • \$\begingroup\$ The opto signal I used for the Base-Pin. The Collector to the second power source and the emitter on the + of the fan. The - of the fan to the GND of the second power source. \$\endgroup\$ – dessi Sep 6 '19 at 8:29
  • \$\begingroup\$ What you've described (emitter follower) is not a suitable circuit for this purpose. Use a common emitter circuit: Emitter to GND (=neg. power supply), collector to (-) of motor, positive power supply to (+) of motor. \$\endgroup\$ – Curd Sep 6 '19 at 8:43
  • \$\begingroup\$ patrickbeck.de/stuff/dummy.jpg (Can you give it a look?) I've just done it like you said, but it just tries to rotate; no movement. (24V ist just for me; it's 5V to test with the fan-thing) \$\endgroup\$ – dessi Sep 6 '19 at 8:57

Optocouplers aren't made to switch power. They are made to transfer signals.

Here's a snippet from the datasheet for the PC817 you are using:

enter image description here

Do you see the line "Collector current" in the "Output" section? That 50mA is all the current that optocoupler can pass without burning out. That's probably a lot less than your motor needs.

You don't need an optocoupler to drive your motor. A properly sized transistor would do - together with a diode in anti-parallel with the motor to catch the high voltage spikes when you switch the motor off.

  • \$\begingroup\$ "You don't need an optocoupler" >> even if I want to run it with 5V on one side and 24V on the other side? \$\endgroup\$ – dessi Sep 6 '19 at 8:03
  • 1
    \$\begingroup\$ Nope. If you can connect the grounds of both power supplies then you don't need the optocoupler. \$\endgroup\$ – JRE Sep 6 '19 at 8:07
  • 1
    \$\begingroup\$ Look around this site. You'll find plenty of examples. \$\endgroup\$ – JRE Sep 6 '19 at 8:08

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.