Hello Guest it is March 28, 2024, 06:26:44 PM

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - DamonJones

Pages: « 1 2 3 4 5 6 »
11
General Mach Discussion / Re: High Speed Servo as Spindle - My Solution
« 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. 

12
General Mach Discussion / Re: High Speed Servo as Spindle - My Solution
« 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.

13
General Mach Discussion / Re: High Speed Servo as Spindle - My Solution
« on: December 05, 2011, 08:10:40 PM »
You are right there are many ways to do this. I briefly went over some of them in the beginning. A lot of this project is just to see if it can be done and be done cheaply. The smooth stepper is a great option but at close to $300 bucks it seemed like a lot of money to just get over the clocking limit in Mach3.

As far as the reason for the project let me expand. First was the goal of a cheap system and one that was not fixed. Meaning I can change it at will and I'm not tied into support from anyone. If it works great if not then I'll go away with much more knowledge of what I really need.

Next was to overcome the short comings of the parallel port and Mach3. I don't really need to index the main spindle on the Z axis but it's the same technology that I need to setup the 4th axis the way I want. Meaning having it capable of turning as a spindle. My mill has manual speed control of a 3phase motor and needed to change. So it just seemed natural to make it function just as the 4th axis is going to. The first big problem with Mach3 is that my spindle is setup on relays that control forward and reverse. The swapaxis command does not disable them. I actually designed a brain to overcome the issue but it seemed a bit hokey. So the next plan was to replace the motor with a servo motor that would eliminate the relay issue. That's when the frequency limit came into play. Now PWM was an option but it occurred that I was going to have the same issues with my 4th axis. So I quickly dismissed the PWM option because it would not index and went for a solution using STEP and DIR signals. So back to the issue with frequency in Mach3. Mach3 just won't drive STEP and DIR fast enough to use as as spindle.

So the issues with swapaxis that came up are; first that none of the tuning information follows the motor. Any encoder differences that come from either different motors or gearing would not follow the motor. It simply switches the pin outs. So you would have to macro change those params on the fly. Again a bit hokey and prone to problems. Especially if the software lost track of what mode it was in for what ever reason. Then came the Index input issue. Mach3 only has one so there needed to be a way to switch it from spindle to spindle so you can get speed feed back from the appropriate motor. The sensor will also be used to home the axis when in indexing mode so needs to switch from one pin to another.  Again all this probably could have been done via macros and brains but the hardware solution just seemed cleaner.

So in a nutshell it's an inexpensive way of doing it myself without a bunch of customizing to Mach3. I get to learn a bunch of new things along the way to.

The long term goal of the system will be to have the 4th axis setup to index as the (A) axis and be able to turn as a spindle on the fly. To have the main spindle on the (Z) axis be able to index as the (C) and work as the main spindle. Last will be to run both as spindles at the same time but that's a long term goal.

I liked the multiple gearing option you mentioned. My driver has the option to run both STEP/DIR and switch to +-10V mode. I tossed that around but then I'd be locked into a particular drive. Also another reason I didn't like the software gearing option. STEP/DIR is everywhere and I have a ton of drive options when using that. It also is capable of running both modes of operation. Just seemed like the best way to go. One technology covering everything I wanted to do.

To sum it up here's a list of benefits:

1. Eliminate the need for 3phase by replacing the current main spindle motor with an AC servo motor.
2. Give the machine software control over spindle speed and direction. Currently manual speed change.
3. Use STEP/DIR protocol as the one and only protocol for flexibility and simplicity.
4. Control both the A axis and the main Z axis motors as spindles or as index axis's.  
5. Minimize customization to Mach3. (I'll have one very simple brain, 2 simple macros and one OEMLED only).
6. Minimize cost.
7. Maximize customization.
8. Minimize outside support requirements.
9. Control of the Index input.
10. Control of the Home sensor (use one sensor for both functions, home and Index)

Did that answer what you were asking?

14
General Mach Discussion / Re: High Speed Servo as Spindle - My Solution
« on: December 03, 2011, 01:06:22 AM »
Let me explain. Mach3 can, on my system, run a maximum clock of 45 khz. Some systems would allow up to 100 Khz but this would require a serious motherboard and parallel port to work if at all. A 45Khz signal has a max possible speed on a servo motor with an 8000 count encoder of (45000/8000) * 60 which equals 337 RPM. A far cry from the possible 4000 RPM of the motor. And that's at 1:1 gearing. I plan to run my 4th axis at least 2:1. So spindle speed would be half of 337 or like 168 rpm. Now to get the 45 Khz signal up to full speed you would have to multiple it my a factor of 12. This can be done with the driver with a function called software gearing but you'd be stuck with it for the indexing mode as well. The resolution would stink at best. The other option would be to have an intermediate controller to switch in and out of multiplication. Well that is no more difficult then my solution. Add in that now that I have an intelligent and programmable solution I'm not locked into any one solution. Giving me things like being able to swap the index and home signals or change the ramping of the motors, ect.

I hope that answered the questions, if not let me know I'd be happy to expand.

15
General Mach Discussion / Re: High Speed Servo as Spindle - My Solution
« on: November 30, 2011, 09:00:46 PM »
Quick update - I have come up with a better solution than using the internal timer in the Arduino. I found a cool add-on module called a DDS. ($12 on ebay) It is a serial programmable frequency generator that will produce a square wave from 0 to 1M hz. Perfect for the servo motor controllers. In theory a 1Mhz signal will drive an 8000 count encoder servo motor to 7500 rpm. Plenty for my needs of around 4000 rpm. The benefit is that it will produce the exact frequency needed for the requested RPM unlike the Arduino timer that could be off by as much as 3%. I've created a library to run the DDS boards that allow for multiple board control. If in the future I want run more that one spindle at the same time the library would handle it. Mach3 has no provisions for this so for now the main program will just run either of two motors as the spindle. I've tested the DDS module and it seems to be very fast between frequencies which will make ramping the servos work well.

I've also changed the messy logic control circuit from a bunch of AND, OR  gates to us some tri-state drivers instead. Simplifies the hookup and reduces the number of components required. They handle the switching between Mach3 using the motor as an axis and the Arduino driving it as a spindle. This will also give me the option to swap the index and the home signals to mach3. Basically when running the servo as a spindle the signal from the sensor will be fed to Mach3's index pin. When using as an axis it will feed as to Mach3's home input. This was another issue that the swapaxis function in Mach3 could not handle.

The MODIO part of the Arduino remains the same and has been working very reliable throughout testing.

More to come soon.

16
General Mach Discussion / Re: High Speed Servo as Spindle - My Solution
« on: November 22, 2011, 06:46:56 PM »
I added a couple of things today to the project. First was an additional register to MODIO for Estop. I added a control line to the brain to control it. Then I modified the Arduino code to disable everything in Estop.

I also changed the logic so I can control both sources (mach3 and the Ardu Timer) independently for each servo. This allows me more programming options and eliminated my 74HC04 Inverter chip that I was only using to invert the control signal for the source signals. Before it was one or the other (Mach3 or Ardu) at a hardware level. Now I can do either, both or none. Basically this allow me to index both motors at the same time. You can never spin both of them at the same time however. The Ardu only has one timer  capable of the frequencies required. One timer source only allows for one spindle at a time. Some day I'll build in another timer but for now this works.  I know this probably makes no sense without the schematics. I do plan to draw them up soon.

The next challenge is homing the index axis when switch modes. I also need to inhibit Axis indexing while in spindle mode. Although the gcode should override any issues this would bring. That is as long as the axis is re-homed properly.


17
General Mach Discussion / High Speed Servo as Spindle - My Solution
« on: November 22, 2011, 03:13:08 AM »
I thought I'd share my solution to some of the issues I've brought up here recently in other threads. This all started with my plan to add a 4th axis to my mill with the intent to be able to run it as a spindle for turning processes as well as index mode. Well if any of you have looked very deep into this Mach3 has a few gotchas and although there has been some success in this area I wasn't really happy with any of the solutions. Now before I get to far into this so far this has been bench tested only so if in the long run it doesn't work out this info can be thought of as learning material.

First lets outline what I wanted. My mill currently has a 5 HP 3 phase motor that is relay controlled for direction and a manual adjustment for speed. Goal: get rid of the 3 phase and get mach to control direction and speed. Second is the addition of a 4th axis that is capable of both indexing and turning functions.

First came the main spindle motor and what to do with it. After some helpful advice on the board here I decided to give an AC servo motor a go for the spindle. Mechanically the switch won't be tough but the control of it soon became an issue. I selected a servo motor 2.5HP 4000RPM and plan to run it 1 to 1 with the main (Z axis) spindle. The motor has an encoder of 8000 steps per revolution. I plan to run the driver with STEP and DIR  signals, for reasons I'll explain later, so here's the first issue. To get full speed out this motor I need to feed it a Step signal at 533Khz. Mach3 parallel ports are only able, at best on my system, to go to 45Khz. Even if I got to the 100Khz max Mach3 allows I'd be well short of my goal. Two solutions came up, one software gear up the driver by multiplying the steps by a factor of 12. Second buy a smoothstepper board. The software gearing my have been OK for the main spindle but not for the A axis the resolution would be unusable. So the smoothstepper solution won out. However they are not exactly cheap and although offer a ton of benefits, in this case all it was really doing was clocking my servos for high speed rotation. In comes the next issue. So far the solutions mentioned did nothing to help with swapping between my main spindle on the Z axis and the future A axis spindle. Mach3 has the swapaxis commands but none of the motor tuning options follow the swap (Mach3 guys this is a huge deal). So if the two servos have any differences (which they will) then a complex set of macros would have to be written to move this information around. In addition the swapaxis command does not undo itself so if it's not reset then the next time you come into Mach3 your axis's will be reversed. So there is the overview.

Now for my solution. So I need a way to clock two different high speed servos using STEP and DIR signals, Also be able to index with at least the A axis (actually I can do both using C axis to index on the Z spindle, I'm sure this will come in handy some day), Lastly I need to control this all from Mach3 and not have the software get "confused" about the config it's in. What came to mind was a microcontroller. In particular an Arduino Uno. First it's cheap $30, second it has built in timers for clocking, it has a built in USB port for talking to Mach3, and it's programmable. So as things change or issues come up I can reprogram on the fly. It is well supported and I don't have to eat up a bunch of my parallel port pins run logic.

So into the junk draw I go and out comes the arduino and my proto boards. Here was the progression of events that I've gone through the past week.

First issue: Make the Arduino board talk to Mach3. Here is the beauty part of a well used open source microcontroller. Someone wrote a MODIO slave library already. It is very basic and all it does is write output holding registers to the arduino from Mach3. Took a little playing as I'd never worked with MODIO before but soon had Mach3 writing 4 registers to the arduino. Registers 1 and 2 I mapped to Outputs 8 an 9 in Mach3 with I tied to spindle relays control for CW(M3) and CCW (M4). Sweet I now have spindle direction, along with Off and On control in my Arduino. Next came speed. I wrote a quick one command brain that maps the Override speed DRO to ModIO register 4. Again success I now have the speed I need to turn my servo in my arduino. Last for the registers in number 5 which is tied via the brain to an OEM LED I put on all my screens. I added a button that calls two custom macros (M900 and M901) which turn this lLED off and on. So I have button control and well as gcode control of the LED. This is going to show the current spindle. LED off the main spindle is active and the A axis is in indexing mode. LED on and the reverse is true. (Yes it will index the main spindle too). Sweet I have control of everything I need.

Second issue: First before we get to much farther I should let anyone know that does't that MODIO is not suitable to run STEP (timing) signals for axis movement directly. There is lag time in the USB that prohibits this. That's a complete topic of it's own. Just know it doesn't work. Also what doesn't work is using the Arduino board to intercept the parallel ports pin signals and do logic control of them and spit them back out on another port. Again the response and log time just don't allow for it. But wait I need to change the STEP and DIR source for my Servos to either my external clock signal (next issue) or the STEP and DIR pins from the parallel port. The only option is to us TTL logic chips to do the swapping and control them from the arduino. A couple of AND, OR and NOT 7400 series chips later and I have a matrix to swap the control signals for the two servos. I'll probably add the INDEX pin as well for speed feedback to mach. I won't bore you all with the details of the logic just know what it does.

Third issue: So I now have all the control signals from Mach3 I need and a way to swap the controls signals between my two servo motors. All controlled by a program in the arduino. Testing on all this goes great. Now for the big issue. How do I drive the servo at the speed I need. This turned into quite a big deal. When I looked at the datasheet for the arduino MPU it mentioned that one of it's three timers has a 16bit resolution of the system clock. The system clock is 16Mhz and 16 bit (65000+ options) seemed plenty. Well not so fast. The details of how the clock works is quite involved. Basically it is a divider network of the system clock that as higher frequencies are output the gap between them gets log-rhythmically larger. After hours of trial and error and allot of math I'd forgot how to do I came up with a timer program that is reasonable for the range I needed. Using the servo motors I mentioned The worst case is about 132 RPMS variance at 4000 RPM. It gets more accurate the lower the speed. The control program also gives configurable ramp up and ramp down, as well as different encoder counts which will come into play when I gear down the A Axis. Each servo has it's own profile so they can be  totally different and the program will compensate and send the appropriate frequency to the motor based on the speed asked for in Mach3.

So it works on the bench and I'm waiting on parts to build the real deal. I'm sure there will be a ton of tweeking to make the motors spin up and down smoothly. My test setup just has a small stepper I had laying around as a test motor. A far cry from the full sized servos that will be used for real. I did bind an encoder to the stepper and grabbed the index pulse and fed it back to mach3. Test so far of the limited speed of the stepper are 100% accurate.

I'll keep you all posted on the build as it progresses. Eventually I'll post he arduino code but I'll wait for it to be tested and working. I haven't written in C for about 15 years and I had a bunch of cobwebs to clear. Bit register sets and clear, floating point variable, Arrays and pointers, just to mention a few of the problem areas.

For those interested here is some of the math involved in this project. Just FYI stuff.

Frequency of STEP signal for given RPM is figured as follow: Frequency=(RPM/60) * Encoder Count for 1 Revolution. (Note this could be different from your encoder resolution on the motor based on the gearing from the motor to the spindle.

Mach3 motor tuning for STEPS rotational axis: Mach3 wants the steps for 1 degree of rotation or unit. So a 1:1 geared servo to axis with an 8000 count encoder would be 22.222222 steps. 2:1 gearing would be 44.4444444 and so on.


18
General Mach Discussion / Re: Opinions For Spindle HP
« on: November 15, 2011, 01:08:00 PM »
My thought exactly however I was looking over the Wiki last night and noticed the motor tuning params can be changed via macro. So if that does become an issue I should be able to changed those in my macros that swapaxis. As far as gearing differences go I figure I can use different pulley setups to compensate. Also changeable via Macro by changing the DRO.

19
General Mach Discussion / Re: Opinions For Spindle HP
« on: November 14, 2011, 06:48:20 PM »
Ya that's what I thought. Defiantly going to want the SS when the time comes. No way the 1.85 steps per unit with the 12:1 gearing is going to work on a 4th axis as spindle. I'd imaging having it geared down some where between 2:1 and 4:1 making the slow 45K even that much worse. Although turning slower would be fine I guess but the RPM's in Mach will be off. That's going to be a problem anyway unless I can balance the two systems. That's going to take some thought. I'd imagine setting things up to work as desired on the 4th axis and then using the DSD gearing to balance the two. Guess I'll work that out when the time comes. To much to think about for now.

20
General Mach Discussion / Re: Opinions For Spindle HP
« on: November 14, 2011, 06:07:45 PM »
That way cool - Perfect timing as I should have funds by then.

Hey off the top of your head. Does swapaxis also move tuning params or just the ports? This will become an issue when it comes time to do my 4th axis project as I plan to turn on it as well. I thought I read somewhere that all it does is move the ports. This will get a bit tricky setting up if so. Especially if they end up geared differently. Haven't thought it all the way through yet but I'm sure it will be an issue. Of course there will be a bunch of factors depending on the drives, motors and encoders that I end up with.

Pages: « 1 2 3 4 5 6 »