In part 1 of this series I showed how to get the X/Y/Z steppers moving. In part 2 I hooked up the home and estop switches. In part 3 I got the spindle go relay working so that I could turn the spindle on (at full speed) or off. In this post, I will show how to get PWM speed control of the spindle working.
The Balfor NextMove ST card has an output (SOUT & SGND) line that provides an isolated 0-10 volt signal (at low current) suitable for controlling a spindle motor driver board. (0 volts is stopped, 10 volts is full power) In the bottom left of the picture below you can see the small blue and red wire leading away from SOUT & SGND.
It does this by using a DC/DC converter (NME0512D) to provide an isolated (floating) 12 volts, referenced to the SGND connector. A TLC272C OpAmp chip integrates a PWM signal (taking into account an offset adjustment from R35, the boxy blue variable resistor near the SGND/SOUT pins) into a 0-10 volt signal.
The PWM signal is fed via an Avago HCNW4503 optocoupler. Pins 5-8 are on the isolated output side while pin 2 is the anode (+5 volts) and pin 3 is the cathode (GND) of the LED inside the optocoupler that works at logic level with the rest of the Balfor board.
If you have to buy this circuitry on an adapter board it typically costs around $45-50, so I wanted to re-use it if possible. I was hopeful that the input to the optocoupler would be exposed on the 96 way connector (or the 50 way connector on the left side of the board) so that I could just plug into them. Unfortunately, this is not the case.
Pin 2 is tied directly to +5V, and the optocoupler is made active by grounding pin 3. Pin 3 does not lead to any external pin. I took the board off its mounting plate to try and trace where it did go, only to find that it was a 4 layer circuit board, and all the “interesting” traces were hidden on the inside.
Using my multi-meter in continuity testing mode, and 180 odd pins later, I finally got around to testing both sides of all of the surface mount resistors on the board and found that R29 (a 220 Ohm resistor) linked Pin 3 of the optocoupler to pin 12 of a big square IC surrounded by a white silk-screen box on the circuit board. It is a NEC 071054L-10 0417YKW37 a programmable timer/counter. Pin 12 is one of it’s output pins.
Basically, the top board would program this chip to output a specific PWM signal every time it wanted to change the spindle speed. (Requring 8 data lines plus several control lines….)
Since I was not going to be able to route a PWM signal via an exposed pin, I decided it was time to do some circuit bending. I removed the surface mount resistor R29 (disconnecting Pin 3 of the optocoupler from the programmable timer/counter chip) and soldered a 200 ohm resistor and a wire directly to Pin 3. (Covered in hot glue for strain relief….)
When this pin is brought low (inverted output) the voltage on the output climbs towards 11 volts (maximum power). I was able to plug this wire into my parallel port break out board pin 14 and using a PWM frequency of 100 Hz my LinuxCNC software is now able to control the spindle speed.
I now have software control over all aspects of the Sherline CNC mill in my Denford / ScanTek Micromill 2000. (Replacing the proprietary top board with software control via the parallel port.)
I’m mostly done, and plan on beginning work on the ScanTek Lathe that I purchased at the same time. Hopefully, now that I know what I’m doing, things will go much faster! Future improvements to the mill may include the addition of a “touch-off” plate/sensor and a spindle speed sensor for closed loop spindle speed control. I am also working on fixing a bent spindle motor bracket.