Hello Guest it is April 20, 2024, 01:24:45 AM

Author Topic: High Speed Servo as Spindle - My Solution  (Read 29537 times)

0 Members and 1 Guest are viewing this topic.

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: High Speed Servo as Spindle - My Solution
« Reply #10 on: December 06, 2011, 06:38:22 AM »
Damon, Thanks for the detailed reply. I have done some work with 4th axis with same goals as you are working toward. Obviously you have the knowledge and creativity to make the cat pretty nervous, so I was just curious about how you approached the problem.

It occurred to me in reading your posts that you had no way to run the 4th axis as a spindle and also run the main spindle simultaneously, but now I see that you have that on the list as well. My only comment on your method is to mention that if you are using a servo motor on an axis (S, A, whatever), there is no need for an index pulse to control speed. A single index pulse per rev, in my view, is pretty crude and also problematic in any case.

This is what I ended up doing . . .  again not saying this is *best*, just what I am running at the moment, and how I set up customer systems: Both the S and the A axis are dedicated to the 4th axis and I run the main spindle separately. M3,4, and 5 are editable macros 'out-of-thr-box' so relay on and off is no problem which only leaves speed. In my case, I have had speed under G-code control, and also manual and I much prefer manual, so my solution was an easy one. However, were I inclined to put the spindle speed back under Mach's control, I might spend some time noodling over the possibility of using the C or D axis somehow, but my thinking at this moment is that I would use one of the tiny 'PLC' like Arduino or PIC to generate the speed control for the spindle. Al ll you would need is to read the commanded speed out of Mach and send a command (pulse count would be easy) to the Arduino which in turn would adjust the spindle speed. Arduino/PIC could easily read an index pulse and provide a stable speed.

More comments in next post:

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: High Speed Servo as Spindle - My Solution
« Reply #11 on: December 06, 2011, 07:03:30 AM »
Continued from last post . . .

I am prepping an old mill for sale and I am considering options for the head. Those options include: laser cutting head, 3d printing head, or just a more conventional high speed routing/engraving spindle (while maintaining the 4th axis capability), so I was researching VFDs and came across a new Hitachi model that accepts pulse train input, and has a rudimentary positioning capability. Not sure exactly how that all works at the moment, but it is definitely worth a look-see.

Comments on smoothstepper; This device does more than just generate a ver fast and clean pulse stream, it also adds I/O. Adding a 4th axis and second spindle (effectively) gobbles up I/O. I view smoothstepper not unlike a graphics card . . adding processing power for a specifc task, relieving the burden on the CPU. The smoothstepper objects to me using the esc key, it seems. It is annoying, but exiting the error seems graceful and non destructive, so it may just boil down to having to changing my own behavior. Like the old Vaudeville yarn PATIENT: "Doc, it hurts when I do this." DOC: "Then don't do that".
Also, I am using a BOB made by CNC4PC specifically for the smoothstepper. The smoothstepper allows LPT2 to be input or output, the BOB forces LPT2 to be inputs only with no option to change. This limits the usefulness of the board in our application (indexer plus two spindles), so I will be going back to directly plugging cables into the smoothstepper.

Lastly, in my case, the problem with using an AC servo drive for the main spindle is that the power is limited by availability of single phase 220V power. The largest Mistu that runs on single phase 220 is 750W (one HP), and I want considerably more that that amount.  
« Last Edit: December 06, 2011, 07:16:50 AM by simpson36 »
Re: High Speed Servo as Spindle - My Solution
« Reply #12 on: December 06, 2011, 11:44:28 AM »
Hood - You're correct on the price - Don't know where I found it for that price. I still like the board but would prefer a solution with more flexibility and something I don't have to rely on support for. Cost for the solution I'm trying will be under $50 so still a savings.

Simpson - The beauty of using the Android was the MODIO capability. I don't have to send a pulse train to the board, I just grab the speed from Mach3 and have MCU calculate the frequency and generate the step pulse. It can also control direction and not eat up any I/O pins in the process. In addition it can compensate for different motors, encoders and gearing. Last was making it turn both all I have to do is add another DDS and rewite some code. Oh and add a few things to Mach3 to handle it. If the first part of this works out I'll do that later.

Like I said many ways to do this, this is just my take on it. take on it.

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: High Speed Servo as Spindle - My Solution
« Reply #13 on: December 06, 2011, 02:02:16 PM »
Simpson - The beauty of using the Android was the MODIO capability. I don't have to send a pulse train to the board, I just grab the speed from Mach3 and have MCU calculate the frequency and generate the step pulse. It can also control direction and not eat up any I/O pins in the process.
I'm a bit confused now. When you say Android, are you referring to the phone or is there also a PLC by the same name?

My suggestion was not to send a pulse train to the Arduino/PIC, but rather a command based on a pulse count. This would allow you to use only two (or perhaps even one) of Machs normal TTL outputs to control the motor speed in discrete steps. i.e. a single pulse could mean 'stop' two pulses could mean run forward, three pulses; run backward, and 4 thru 10 pulses being 200rpm, 300rpm, etc.

Mach also allows you to send a byte to the serial port, so you could have the Arduino/PIC monitor the serial port and easily have 64 separate commands available to send out. Indeed, the Arduino/PIC would generate the pulse stream, variable V signal, relays or whatever was needed to control the VFD.

I have a couple of Arduino boards that do data acquisition on my dynamic balancer. If I get a few minutes play time, I could confirm whether Mach can talk to the Arduino without writing a lot of additional interface code. It's one of those things that *should* be a piece of cake.
Re: High Speed Servo as Spindle - My Solution
« Reply #14 on: December 06, 2011, 02:38:33 PM »
I meant Arduino - hadn't had my coffee yet when I wrote that.  :-[

I already have the Arduino talking to Mach3 via MODIO. Very simple to do. The best part is it doesn't tie up any I/O pins. I have registers that hold the override speed DRO, M3 and M4 for off/on and direction via outputs, signal that holds which axis is in spindle mode, and Estop. Basically anything that is not timing dependent can be sent over the MODIO protocol to the Arduino. 

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: High Speed Servo as Spindle - My Solution
« Reply #15 on: December 06, 2011, 02:49:59 PM »
I already have the Arduino talking to Mach3 via MODIO. Very simple to do.

This definitely sound like the hot setup. I have not messed with this technique at all. Would you be willing to post a quick 'MACH/Arduino via MODIO' (for dummies)? Certainly I don't want to reinvent the wheel since you have already done so much of the groundwork on this and have it functioning.
Re: High Speed Servo as Spindle - My Solution
« Reply #16 on: December 06, 2011, 03:43:52 PM »
I can't take credit for the modIO interface but I can make it a bit simpler for you. Here is a link to the library I found.

https://sites.google.com/site/jpmzometa/arduino-mbrt/arduino-modbus-slave

You need the modbus slave library linked at the bottom. It's tar compressed so you will need a program to uncompress it. Drop the folder in your Libraries Folder in your arduino software. Here is all you need to make a sketch that will talk to Mach3. It shows the registers I setup. They are in an array called regs[]. I included a sample if statement to show how to reference them.

#include <ModbusSlave.h>
ModbusSlave mbs;

enum {       
  MB_REGS=6       //Number of Slave Registers
};
int regs[MB_REGS];      //regs[0] = Ignore this register
                        //regs[1] = M3 CW spindle Direction (Active High)
                        //regs[2] = M4 CCW spindle Direction (Active High)
                        //regs[3] = Spindle Speed
                        //regs[4] = Active Spindle 0 = Z Axis, 1 = A Axis
                        //regs[5] = Estop
                       
void setup()         
{
 
    mbs.configure(1,9600,'n',0); //Init ModBus Slave
}

void loop()
{
  mbs.update(regs, MB_REGS); // Update ModBus
  if(regs[5]==0) { // EStop
    digitalWrite(2,LOW); //Set Servo1 to Mach3

  }
}

I'll get a screen shot of the setup for Mach3 and post it shortly.
Re: High Speed Servo as Spindle - My Solution
« Reply #17 on: December 06, 2011, 04:02:30 PM »
Here is the screen shots. Also a brain view of how to address MODIO registers from a brain.

Re: High Speed Servo as Spindle - My Solution
« Reply #18 on: December 06, 2011, 05:36:28 PM »
Just finished drawing up the logic circuit. I'll build this on an Ardunio Proto shield.

Here a link to the PDF

http://damonj.com/pics/Mach3%20Shield%20Logic.pdf

Offline simpson36

*
  •  1,369 1,369
    • View Profile
Re: High Speed Servo as Spindle - My Solution
« Reply #19 on: December 07, 2011, 02:05:55 AM »
Damon;

This is a slick way of communicating between a tiny PLC and MACH. I have everyting set up and working and the MODIO test reads and writes to the Arduino.

What I cannot get to work is sending data to Arduino using a Macro. I tried a MACH example that was linked on the MODIO library source, but it does not work. I am unclear on your use of Outputs with port 0 that you have (I think) identified with or as MODIO register 1 and 2. My Arduino is on Serial port 5 and the MODIO test talks to it there. How does that relate to MACH I/O ports? Is port 0 the MODIO buss?

Can you post an example of a Macro that will talk to the Ardiono using your setups, please?