Electronic – Single MOSFET motor driver with oscillation on output

dcmosfetmosfet-driverpwm

I'm trying to drive a small DC motor with a PWM with the circuit below, where I'm using a TIL111 optocoupler and a IRF510N MOSFET. The PWM (50% duty cycle) is generated by a MCU STM32F103C8T6, the +3.3V source comes from this MCU and the +5V source is another one.

enter image description here

The motor drives, but the waveform over the motor looks like the one below (sorry for my oscilloscope). The image isn't clear but what happens is that this output have some waves (resembling coil discharging waves) when it should be off, or 0V (the ON semi-period is working ok). Since I have a +5V source and a 50% duty PWM, I should measure 2.5V over the motor, but, with this signal, I'm measuring 3.55V.

enter image description here

If I remove the motor and put some 120 ohm resistor in its place, I can visualize the correct waveform below. I also verified the waveform over the opto and over the MOSFET's gate, and it's working fine (with or without the motor).

enter image description here

I'm using this dummy dc motor below, but I have tested with other two dummy motors and having the same result. Actually, I tried to drive these motors with a TIP before, using a similar circuit; that time, I changed pretty much all the components (TIPs, resistors, diodes, motors, protoboards) and I still ended with this same result. If someone could tell me some tip about why I'm having this behavior, I would be grateful.

enter image description here

Best Answer

It would be more illuminating if you trigger your oscilloscope off of FET gate -- that should be a cleaner signal.

What's happening is that the circuit will push current into the motor, but it won't pull it out. So when the FET is on, if the motor is spinning any slower than it's no-load speed with 5V applied, the motor will speed up. When the FET is off, the motor will coast along, generating a voltage proportional to its speed. Because the system is lossy, the motor isn't spinning quite fast enough to generate 5V -- but it's pretty close to it. You're reading the average of 5V and whatever the motor generates as it's coasting.