CNCCookbook: Be a Better CNC'er

Want to be a better CNC'er?

Get our weekly newsletter plus a package of greatest hits, special tips, and more, all for free.

I'm Ready to Be a Better CNC'er, Hook Me Up!

Debugging My IH Mill CNC Electronics and Servos

Here is my stream of consciousness blog about how I debugged my IH CNC Electronics and Servos.

I had a rpetty long road of debugging by my estimation. I started with a single axis.

Diagnosing Problem 1: Relay control of the DC power supply by the CNC4PC Master Control Board

The CNC4PC Master Control Board is supposed to process all servo faults, E-stops, and limits to make it easy to provide centralized control for E-stopping. Before I mess with the servos, I wanted to make sure this worked okay. Because I did not have servos connected, I set the DIP switches to simulate stepper drives because they have no Err/Fault lines. This turned out to be a mistake because the board acted really oddly. It has 3 modes--standby, pre-ready, and ready. In pre-ready, the ready light blinks. With the DIP switches set for stepper, I got the relay closing only during pre-ready. It was open during standby and ready.

I spent a fair amount of time futzing with it before I thought to try to the DIP switch setting for servos. I suspected I was mistakenly missing charge pump and all sorts of other goofy things. Once I set the DIP switch to all 0's, the right setting for no charge pump and servos, it worked fine.

Along with all that fussing, I discovered that I had mislabeled my "Start" and "E-Stop" leads. They were reversed and that had to be straightened out before I could get it to work either.

Diagnosing Problem 2: Tuning the Servo Motor

During this phase I was having a hard time getting the Gecko to drive the servo and keep the shaft locked. I followed the advice in the manual for the G320, setting the limit, gain, and damping pots to the recommended initial settings. I'd power up, and the motor would jerk slightly and then immediately fault every time I powered up. The suggestion in the manual is to reverse the motor connections, and herein I managed to create a big problem for myself. It was late at night and instead of reversing the motor leads, I reversed the leads to the Gecko drive itself. Really bad idea!

The long and the short of that move was that I blew up my DC power supply. Surprising. I think the Gecko might be okay, I did the MOSFET test described in the CNCZone Gecko FAQ and it shows ok. But, I had to round up an alternate power supply. I jused an electrolytic cap and Ajax CNC rectifier board of the same type I had used for my lathe project.

Once I got the power supply working again, and with a different G320 drive just to make double sure, I tried again with reversed motor input to no avail. When hooked up and driven by Smoothstepper, the G320 immediately faults. This time there was no visible movement of the motor whatsoever, not even the little jerk I had before.

I tried reversing the motor connections-same result. G320 immediately faults with no visible movement of the motor.

The voltmeter test of encoder described in the Gecko Manual looks good.

Per another thread I found, I disconnect motor from drive and there is an immediate fault. Supposedly this means I may have a problem in my servo cabling, so I directly connect motor to DC supply and it spins.

Next, I tested the Geckodrive per the FAQ measuring resistance from pins 1 and 2 to pins 3 and 4. Megohms in all cases, so MOSFETs are good.

Eventually I found a note from Mariss on CNCZone sugesting to tie a 47K ohm resistor across pins 1 and 3; per Mariss suggestion this may be needed to clear the bridge to 0V.

Now it continues to faul the CNC4PC MCB board, so I tried a temporary jumper that lets me tie the Err/Res pin to Enc+. Now if I hold that on there, the servo sits there alternately jerking and faulting. This is the most life I've seen from it yet!

So, I tried reversing the encoder A/B channels. Now I get servo lock with a little bit of dithering. The system is responsive to tuning, meaning I can underdamp and overdrive the gain and make the oscillation louder. I set things to where I think they should be and move on to the next phase.

Diagnosing Problem 3: Mach 3 controlling one axis via Smoothstepper

Things are still a bit flaky because I have to reset the Err/Res by hand instead of via the MCB board. Also, sometimes the reset leaves the servo in a state where it isn't locked up. You can turn the shaft by hand until it faults. A reset on this is usually all it takes to fix it. Eventually I have to figure out the MCB problems, but for now, I just want to drive that motor from Mach 3.

Smoothstepper appears to be installed correctly, but I can jog the X-axis all day long in Mach3 and nothing happens with the servo.

I double check my port connections--the physical step/dir pins are the ones showing up in Mach 3.

Based on the Gecko FAQ, I have set the ActiveLo for both step/dir, and I have set the pulse width to 5. Still no joy. I note in later Mach3 forum reading that Art says the pulse width parameter is ignored with the SmoothStepper, so that change was a placebo anyway!

I bring down the Smoothstepper diagnostics, and it shows that it is getting the X/Y signal. Why doesn't the motor move?

Common on a G320 looks like it wants to be 5V from the Smoothstepper. I've got it grounded. However, changing this I still can't get the thing to move!

Recommendation from IH on Mach 3 settings: 115 IPM speed and 0.15 acceleration. (Can't believe this will help as I do not fault, I just do not see the servo move at all) This is a lot different than what I had, but it doesn't seem to help. I also calculate and set the rest of the motor tuning. I have 500 CPR encoders on my servos, which means 500 x 4 (quadrature) = 2000 steps per motor revolution. It takes 5 (leadscrew pitch) * 2.824 (timing belt ratio) rotations to move the X or Y axes 1". So, I need 2000 * 5 * 2.824 = 28,240 steps per inch of axis motion.

I decided to check the jumper settings on the Smoothstepper to see if anything was awry. There are 2 jumpers that appear to provide +5V to the breakout board. I wonder if I am getting +5V to the Geckodrive common? Took out the voltmeter and sure enough, those contacts were dead. So I moved the jumpers, measured to see I was getting +5V, rebooted the whole works and low and behold, I can now spin my motor!

If I reverse direction too abruptly, I can cause a fault, but this is just servo tuning.

Diagnosing Problem 4: Err/Res circuit on CNC4PC Master Control Board Not Working

Drive faults at startup. I had been manually touching the Err/Res to Enc+ to clear the drive at startup.

Problem turns out to be not having grounded Enc-.

After fixing this, my 2nd axis went fine, but problems resurfaced on the 3rd axis module. The system fell into a mode where it would not reset. The most identifiable symptom was that it did not turn on the relay during startup, but only when ready, at which point it immediately faulted. I traced this one to a stupid error on my part. I had installed a quick disconnect in the signal cable made out of a male and female DB9 connector. I had taken great care to wire them identically, but there is a gender change issue when you do that. One needs to be wired the reverse of the other. Hence I had a lot of signals going to the wrong places. I discovered this when I started checking cable continuity with the multimeter and there almost was no continuity where I expected. I had to sleep on it a night, but when I revisited feeling fresh, it became clear pretty quickly where I went wrong.

Diagnosing Problem 5: Err/Res circuit on CNC4PC Master Control Board Not Working, Again!

I got my electronics successfully mounted in the enclosure and went to try it out. Come to find I get immediate faults. The relay is not closing during the startup cycle as it is supposed to.

Even if I disconnect everything from the board except +5V, grounds, Start, and E-Stop, this time around the relay doesn't close during the startup cycle. This means the Gecko 320's do not cycle properly and when the system does try to swing over to Ready, it just faults immediately.

I got to looking at my solid state relay that I use to deliver AC power to the DC supply. It calls for a control signal of 3.5V and I had been feeding it 12V. So, thinking this could be an issue (Arturo warned I might see the system if the relay was drawing too much current), I rewired the system to use 5V for that relay. No help. If anything it made the board slightly flakier when it was first powered up.

I have a note into Arturo asking for ideas. Meanwhile, I'm flying blind just trial and error to see if I can get it to work somehow.

Questions and Thoughts:

- Is it the way I'm drawing the 5V for the relay? I just wired it in parallel with the 5V supply to the board. Maybe the relay needs a current limiting resistor or some such. The docs for the CNC4PC board show taking the 5V out of the E-Stop circuit to power this sort of thing. Need to change the wiring to work that way. Actually, the doc shows taking it off the Start switch to the NO terminal. That would supply 5V to that relay during the startup. Try this first!

This worked great and I'm now spinning all 3 servos. I simply ran a line from the switched side of the Start button over to the relay for the power supply. I kept the connection from the C17 board to the relay as well. During startup, +5V is supplied to the relay via the Start button. Once started up, +5V is supplied via the C17's relay. If the system faults, the 5V is interrupted and the power supply shuts off. This still leaves me without a circuit to shut down the spindle and coolant, but it's a start!

I will keep these other possibilities for future generations, or perhaps myself if this one fails in the end. I still need to set up the other axes and see what happens!

- Is it not fully warmed up? Maybe I need to leave it in Standby mode for a little while before trying Start. Try this second! FWIW, in my successful test above, I turned the enclosure on, then booted the computer from power off and brought up Mach 3 before I tried to start anything up. This would've given the C17 lots of time to get itself together.

- If I get here and it isn't fixed, I will put debugging of this on hold and come up with an alternate E-stop mechanism. The Gecko docs state that you can simply tie Err/Res to Enc+ if it isn't important to detect a servo fault. If I do that to all the axis modules, I think I can simply use the CNC4PC board to E-Stop if I manually hit the switch. Far from ideal, but it will get me moving again!

- Is there an alternative to this board? I need to go research that if I don't get a solution soon. There is almost no mention from anyone of using the board anywhere I can find. There is a simple circuit presented in the Geckodrive documentation that could be used.- Is it the power supply? Need to look for an old PC supply to try. It's cumbersome, but it'll deliver more current.

- Is it the board? I have a note into Arturo. I have had so much trouble I don't have a lot of confidence in this board at the moment. It seems like I have so thoroughly isolated it from wiring problems by just disconnecting almost everything that it ought to work.

Next Steps

When tuning servos, start with Runner4404spd's settings:

x acceleration 10

y acceleration 10

z acceleration 08

x top speed 120

y top speed 120

z top speed 110

More Notes on Diagnosis

Someday, I want to collect all of this into a useful resource for those diagnosing. For now, I'm just going to try to collect the info.

From an article on switching from Xylotex to G540:

This gent was doing wax cutting for jewelry casting and his axes weren't tracking properly. Squares came out as parallelograms.

Lost Steps:

- Really losing steps makes audible noise from the stepper. In many cases, what are assumed to be lost steps are other kinds of problems in the system.

- Run a test where the motors run backwards and forwards many times. Make sure that after all the cycles the motors have returned to where they are supposed to be.

A stepper system should be silent at idle. If there is a ticking or other noise that is probably noise or uncommanded pulses.

It's possible to set up Mach3 to send Charge Pump to 2 pins. That's usually a bad idea!

The Sherline 1/2 Pulse option increases pulse width to 40 usec. Art says if you have to do that you may have too little power supply voltage or noise.

Mariss recommended Mach 3 settings for Gecko 540 and 250/251: Pulse Width = 2uS Step Pulse = Active High Direction Precharge = 0uS Direction = Active High. Mariss says there is no advantage to a step pulse wider than 2 uS. All other Geckodrives need Active Lo!

You can verify some of the Mach3 settings with a multimeter. Set your multimeter to DC volts. Put the black probe on the DB25 ground, the red probe to any step output pin. The meter must read near 0 VDC when you are sending no step pulses (Mach3 idle). If you read 3.3VDC or 5VDC, the step pulse polarity is wrong and needs to be changed because it will cause trouble.

If you are running a fairly low voltage power supply, you may have a problem if you don't have enough capacitance. The G540 (actually the G250s inside) drop out of regulation below 18VDC. If your power supply sags under load, 24VDC can easily drop below 18VDC on the 120Hz DC ripple voltage troughs and cause problems. How much capacitor is needed? Here is a calculation Mariss gave:

Allowing a 10% ripple voltage at 6A and 24VDC requires:

uF = 80,000 * I / V

uF = 80,000 * 6A / 24V

uF = 20,000

Note that a switching power supply requires less capacitance. You can measure the ripple with your meter. Set your meter to AC volts and put it on the DC output of your supply. If you read more than 0.5V AC while the drives are running then you may need to install an external capacitor (about 5,000uF / 35VDC) across the output of your supply.

 

 

 

 

{PageNav}

Featured Articles

Step-By-Step Guide to Making CNC Parts

CNC Router Cutter Types

Why Use a Single Flute Endmill?

Step and Servo Motor Sizing

The Truth About Tool Deflection

10 TIps for Router Aluminum Cutting

2 Tools for Calculating Cut Depth and Stepover

CNC Machine Hourly Rate Calculator

Special Purpose CNC Calculators

Feeds and Speeds Guide

CNC Cutter Guide

Feeds and Speeds By Material

G-Code Tutorial

  Feed Rate Calculator

Sales, and Special Deals

 

GCode is complicated.
G-Wizard Editor
makes it easy.

Try It!

 

Feeds and Speeds:
Made Easy.

Try G-Wizard

 

 

Do you want to be a better CNC'er?

Get Better Tool Life, Surface Finish, and Material Removal Rates.

 

Start Now, It's Free!