Electronic – When to use or not an optocoupler

dc motormicrocontrolleropto-isolator

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?

Best Answer

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.