Electrical – Get rid of back emf in motors

dc motormicrocontrollerpwm

I am controlling motor speed by using PIC16F877A and L298, but motors give Back EMF which can burn the microcontroller. To avoid back emf, I have 3 options:

  1. Diode.
  2. Darlington pair.
  3. Optocoupler.

What would be the preferred method, in your opinion, keeping into consideration the respective problem? A practical example would be very helpful for me.
Thanks

Best Answer

You need to use flyback diodes to protect from large inductive currents on motor startup and shutdown. I used the following circuit with the L293B, you have to adopt it for the 298, but the basic principle and arrangement of the diodes is the same.

enter image description here

The flyback diodes provide a path for the current generated by the back-EMF (stored in the motor's magnetic field) when the motor is switched off/turned on. You can read more on flyback diodes on Wikipedia. Also, take care to use Schottky diodes (a special type of diodes) which are much faster than the generic rectifier diodes. I used SB260 (60V, 2A) but you may need to use something larger, depending on the current and voltage. Allow for a significant voltage overhead above your operating voltage, because these inductive voltage spikes can be big. The resistors R1 to R6 are there for current overload protection for the microcontroller, they are not strictly necessary, but can save your ucontroller if you screw up something.