I understand the benefits of optocouplers. Always when I'm designing a microcontrolled motor control I isolate the mains from the MCU with those devices. On a few designs I did without the optical isolation I've had some malfunctions on MCU, sometimes it crashes or resets.

Now I'm designing a motor control based on MOSFET, specifically the IRF640N. The motor is the F 006 WM0 310 and it operates under normal circumstances and load at 1.5A. When I've first tried to control it, I've used a TBJ, but the motor presented a loud humming at low speeds. The MCU I'm using is a Atmega328p-pu and after did some research I found I can low its humming rising the PWM frequency. The frequency I've used before was near 500Hz and now will be almost 1kHz, then 1us of period. Due to its price and its availableness (most because of it, since in my town is very hard to find components) I've chose the 4N25 as optocoupler. Its datasheet specify 2us of fall/rise time, which is bigger than the period of PWM. Due to this, I suspect the raise of PWM speed will not reduct the noise of motor and maybe I should not use the optocoupler at all.

Is this a real problem? Since the design has to work on all the country and will be exposed to different mains with different noises, should I really use the optocoupler? May a filter correctly designed will prevent some MCU malfunctions in spite off isolate it from the motor voltage?

Finally, is there any guidelines for when or not to use an optocoupler based on the clock frequency of MCU, current drawn by load, PWM frequency or any other aspect?

  • \$\begingroup\$ I think in your case you should not use opto couplers. I dont think opto couplers and clock frequency of MCU have any relation. You should work on PWM to get it done. \$\endgroup\$
    – Aircraft
    Aug 19, 2015 at 12:23
  • \$\begingroup\$ Why do you think an optocoupler will help here? \$\endgroup\$ Aug 19, 2015 at 12:47
  • \$\begingroup\$ @NickJohnson to prevent any interference generated from the motor/mains \$\endgroup\$ Aug 19, 2015 at 13:25
  • \$\begingroup\$ @PedroQuadros If you have significant noise issues, you need to suppress them, not just isolate them. \$\endgroup\$ Aug 19, 2015 at 13:37
  • \$\begingroup\$ @NickJohnson - second that. In the conditions you describing the isolation from power stage might not be enough. In the similar situation I had to isolate MCU power AND all inputs as well. \$\endgroup\$
    – Maple
    May 9, 2018 at 0:47

1 Answer 1


The 4N25 is unsuitable for this kind of application. Rise and fall times will be more like 20usec in realistic situations (not 100 ohms load). It's fine for really slow stuff like relay or switch detection, but not for fast PWM.

Use a very common and cheap 6N137 which has < 100ns response times. Then you can increase your PWM frequency to avoid the noise. If you have a good design you may be able to move it above the audible range.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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