I am trying to drive a 24V DC motor with IRF5305 PMOS. I am generating ~300Hz PWM signal with an AVR microcontroller and level-shifting it to 12V-24V signal to drive MOSFETs gate. I need to use a PMOS because this will get added to an existing machine.

I am also measuring current tru the motor with ~1 Ohm resistor on the source. But am getting some weird measurements. MCP6022 op amps are powered from 5V so I need to reduce the voltage then get the difference across the resistor (24V is not totally stable) and then amplify the difference by the same amount which then gets feed to a comparator. Also inverting and non-inverting inputs on OA1 have clamping schottky diodes to 5V.

This is how I got everything set up:


simulate this circuit – Schematic created using CircuitLab

And these are the results I get when driving the motor:


Blue trace is MOFETs gate which gets a nice 12-24V signal. Pink is connected to the MOFETs drain pin where these oscillations occurs. And yellow trace represents output from AO1 the differential amplifier, weird shapes.

I was expecting to see a sawtooth yellow trace without these giant bumps and peaks. Also the pink trace looks a bit weird, when the blue trace is high (24V) shouldn't the pink trace gradually approach ground (as the power is dissipated by the diode)?

What is going on? How can I fix it?


I have to admit I've used a 12V motor connected to 24V line but it was under no more than 50% duty cycle and I turned it off more or less as soon as I got the readings. Did I damage the motor? (it looks like it is spinning ok)

  • 1
    \$\begingroup\$ Here's part of it... electronics.stackexchange.com/questions/164092/… ... the pink waveform shows the back EMF when you're not driving the motor. The spikes on the yellow could be the motor commutator switching which affects the detected current. \$\endgroup\$
    – user16324
    Jul 16, 2015 at 20:51
  • \$\begingroup\$ Try monitoring your 24 volt line. \$\endgroup\$ Jul 16, 2015 at 21:44
  • \$\begingroup\$ What's weird about the scope traces? They seem to tie in with what I'd expect but maybe you see something I don't? \$\endgroup\$
    – Andy aka
    Jul 16, 2015 at 21:50
  • \$\begingroup\$ @Andyaka The pink trace seems a bit odd to me. When the MOSFET gets turned off (24V at gate), the drain voltage drops to 0V but then rises after 100us and oscillations start. Whats going on there? \$\endgroup\$
    – Golaž
    Jul 16, 2015 at 22:02
  • \$\begingroup\$ "shouldn't the pink trace gradually approach ground (as the power is dissipated by the diode)?". The diode recirculates current through the motor as the magnetic field in the armature collapses. The winding inductance of your motor is quite low so this happens quickly - which shows up as a short spike going below ground. During the rest of PWM OFF time the motor is coasting and acting as a generator - producing a DC voltage which ripples in time with commutation. \$\endgroup\$ Jul 16, 2015 at 22:09

1 Answer 1


I agree that that the oscillations are probably due to the commutator in the motor.

You could try equal value capacitors across R9 and R11 to filter the higher frequencies.

To represent zero current you will need a negative power supply to the MCP6022. This may also be causing it to saturate during the FET off time as the feedback loop will go open, it may take a significant time to come out of saturation.

What tolerance do you have for the 13K and 2.7K resistors? They need to be precision parts to get a reasonable common mode rejection.

Why not put the sense resistor in the grounded end of the motor - you would then be able to sense the current during the FET off time as well to get a motor average current - is this because it is added to an existing machine?

Also you are going over the max VGS for the MOSFET - it is only rated to +/- 20V or it might breakdown.

  • \$\begingroup\$ They are 1%, I will try to match these as close as possible. Yes you are right, the motor has one side grounded and I cant reach that. I dont think I am going over max Vgs, when there is 24V at the gate Vgs = 0 and when there is 12V Vgs = -12V. Am I doing something wrong? \$\endgroup\$
    – Golaž
    Jul 16, 2015 at 21:44
  • \$\begingroup\$ My mistake - You are correct - I didn't notice that the Gate driver was connected to 12V. However you will be reverse biasing the base-emitter of Q1 by 12V. It has a reverse breakdown voltage of ~7V. Over time that can significantly degrade the transistor. "If the emitter-base junction is reverse biased into avalanche or Zener mode and current flows for a short period of time, the current gain of the BJT will be permanently degraded." (en.wikipedia.org/wiki/Bipolar_junction_transistor) \$\endgroup\$ Jul 16, 2015 at 21:51
  • \$\begingroup\$ Had no idea reverse biasing can damage the transistor. Thanks for pointing that out. \$\endgroup\$
    – Golaž
    Jul 16, 2015 at 22:00
  • \$\begingroup\$ Do you have any solution to that? \$\endgroup\$
    – Golaž
    Jul 16, 2015 at 22:01
  • 2
    \$\begingroup\$ For this circuit I would add a diode between base and emitter of Q1 to prevent the reverse bias being greater than -0.7v. A generic signal diode 1n914/1n4148 etc would do. It shouldn't have too much capacitance or it would slow down the switching. \$\endgroup\$ Jul 16, 2015 at 22:23

Your Answer

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

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