2015. február 21., szombat

CNC Motor Driver 1.

A long time ago I started to work on my CNC spindle drive. After many experiments I rendered the whole unit to useless. Today I've a dead 230W motor, a dead 600W switching power supply as a result. The box of the power supplies are taken apart. So the thing not looks great.
A few month ago I started a project to reanimate the thing.
Now I've a new power supply and a new 400W motor on hand. The only thing is missing the electronics between this two.
When I started not even considered to use the original electronics. It is a useless crap.
I have had some goals:
  1. Switching on/off from software
  2. Control the rotational speed from software (g-codes)
  3. Creating a closed loop control with measuring just the motor current and voltage. Not using optical encoder, hall sensor or any similar thing
  4. Adding some kind of digital RPM display
Unfortunately I not documented this project as deeply than I did it with the previous ones, but I write some notes about it now when I reached some of my milestones.
So:
Milestone 1 - Measure the motor rotational speed
If I put a diode in series of the motor, the diode will close briefly every time the motor brush step from one commutator segment to the next. This happening because of the sudden change in the magnetic field of the motor. When this change happens the the motor's windings are try to work against the power source, creating a negative current pulse (sorry for my phrasing, I'm not a native English speaker, and my study of physics happened long ago). This can be measured:


Ok, we can measure the frequency of the above pulse, but I thought, not to feed this signal directly into an MCU, so I did some shaping before.
First of all the signal decoupled with a 1uF capacitor, to keep just the AC part. After this I filtered out the frequencies above the the maximum I can get.
BTW what is the maximum here? The motor has 15000 rpm maximum rotational speed. This ok, but to keep some room, we can start to calculate from 30000 rpm. It should be devided by 60 to get the revolutions per second, and multiply by 12 what is the number of the segments in the commutator. This gives to us 6kHz. Everything above this can be eliminated. The filter in the current circuit has ~7.5kHz:


The filtering is needed because of the switching noise coming from the controller (In the further development this noise will be reduced as much as I can)
The filtered signal is fed into an MCP6002 opamp after transposed to the half supply voltage (2.5V in this case). The opamp is acting as a Schmitt trigger. The hysteresis is set to ~35mV. This is high enough to eliminate the remaining noise but low enough to be able to catch the signal what is around 200mV. At the output of the opamp is a stable square wave what is proportional to the rotational speed of the motor.
Milestone 2 - MOSFET driver
I needed a switching MOSFET driver for the motor. From the first look it looked simple, but finally it came out that I need DC to drive the circuit above, with the least possible amount of noise and clearly high side switching. The circuit come out is closer to a buck regulator then a simple MOSFET switch.
I chosen a P-Chanel MOSFET for switching, because the required maximum current (~8.5A) can be easily handled with a relatively low cost MOSFET and eliminate the rather tricky circuit or specialized driver IC needed for driving an N-Chanel MOSFET on the high side.
Theory of operation:
When the incoming PWM signal get high, the Q2 start to conduct and pull down the gate of the MOSFET 10V below the 48V rail (restricted by the D3 zener) and the FET start to conduct. The 50mA what can flow here is enough to fill the gate capacitor of the FET. At the same time Q1 transistor's base pulled down keeping the Q1 in nonconducting state (the D2 is used to protect Q1 base to not go bellow the BE diode rated voltage). When the PWM signal goes low, the Q2 stop conducting allowing the FET gate to go high, but because of the high gate capacitance the FET would not switch off fast enough. Here come the role of the Q2. When the Q1 stop conducting the Q2's base is pulled up to the rail through R1-D2. The Q2 start to conduct and the FET's gate capacitor gets discharged through Q2.
The high energy square wave generated by the MOSFET is fed to the L4-C8-D4 buck network creating a DC signal proportional to the PWM signal.

There is still lot of work to go, but here is the first working model:

 
 
And here is the schematic design:


Nincsenek megjegyzések:

Megjegyzés küldése