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?
P.S.
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)