Awesome!
Awesome!
Thanks, giz.
Tonight I got my bench cleaned, piles of electronics set up (3 power supplies, pwm to analog converter, motor, and computer plus lots of wiring), turned everything on and made a motor twitch back and forth! Well, it's a start... The motor did lock up, but I couldn't actually make it spin. It would just twitch a bit when I changed the hall pattern. To clarify (mostly for Andy), this was using only the four output signals from the Fanuc encoder, C1, C2, C4 and C8 into the computer and sending hall outputs from the computer to an AMC drive. In some hall patterns, the AMC drive would give a green light and in others a red, so I *think* the software part might be working. However I believe I messed up something in my pwm to analog circuit. The negative side seems to work, with negative 100% pwm giving me ~-9V and 0% giving 0V, but the positive side is stuck at ~+9.9V all the time. I'll have to go through it later after I've slept and see if I just wired it wrong.
CNC mill build thread: http://www.cnczone.com/forums/vertical_mill_lathe_project_log/110305-gantry_mill.html
I can't figure out what's wrong with my pwm to analog circuit (half still works and half doesn't even though they should be the same), but I disconnected the non working half and just played with the hall signals this morning. Andy, it looks like there might be a problem with the code. I'm far from an expert on this, but rotating the motor by hand with the encoder powered, the 4 Fanuc signals are read by the computer as changing but the hall output signals never change. See 3 screen shots of the 'show pin' command as I rotated the motor by hand. The output hall signals never changed over several rotations. They did change when I changed the pattern, but still didn't change during motor rotation. Let me know if you need any other information.
CNC mill build thread: http://www.cnczone.com/forums/vertical_mill_lathe_project_log/110305-gantry_mill.html
I picked up another Fanuc 30F motor really cheap. It showed up today and I started playing with it to try to figure out the brake. These older (I assume) motors have a 3rd small connector on the side of the red cap, and I figured that was the brake. Well, I was wrong. I found out the 7 pin power connector has the brake connections after a bit of searching. See: http://www.cnczone.com/forums/970668-post7.html On the newer motors, the big ones have the same 7 pin connectors but they're just duplicating the power pins which is what was throwing me. I have some of the 7 pin connectors, so I'll have to do some wiring tomorrow and see if I can unlock these big motors.
CNC mill build thread: http://www.cnczone.com/forums/vertical_mill_lathe_project_log/110305-gantry_mill.html
I got one of my 30F motors to unlock tonight. Nothing too exciting other than that the rotor has way more inertia than the smaller ones. Now I'm working on getting the pinion off the output shaft of the one I just bought.
I played around with Hal scope for a minute tonight in EMC2. It confirmed that I'm not getting changing hall signals out of the bldc package, but the Fanuc signals are being read in. It's a pretty cool tool. I also put in another 512MB of ram, getting me up to 640MB. The system now runs decently. I also took a few shots of my test setup with a 10S motor.
CNC mill build thread: http://www.cnczone.com/forums/vertical_mill_lathe_project_log/110305-gantry_mill.html
Entirely possible, I have never tried it with an actual Fanuc motor attached. (Though I saw a tempting one on eBay)
Looking at the code, I think I have overlooked something, and bldc always tries to switch to using the encoder at the first Gray-code transition. This won't work with the encoder not connected. It's a bug, and I will fix it, but a workaround ought to be to change the bldc config.I'm far from an expert on this, but rotating the motor by hand with the encoder powered, the 4 Fanuc signals are read by the computer as changing but the hall output signals never change.
change: loadrt bldc cfg=fH
to: loadrt bldc cfg=fHT
This will work a bit, though as 6 into 16 doesn't go, there will be some Hall segments that are longer than others.
if you look in the HAL file there are a number of commented-out (#) lines that are related to wiring up the encoder.
Thanks Andy. I'll try that tonight.
CNC mill build thread: http://www.cnczone.com/forums/vertical_mill_lathe_project_log/110305-gantry_mill.html
No luck. The hall signals still do not change on the output of the parallel port when I rotate the motor shaft after changing the bldc config.
CNC mill build thread: http://www.cnczone.com/forums/vertical_mill_lathe_project_log/110305-gantry_mill.html
Do the rotor angle and phase angle change?
No, they don't change. See the above 3 screen shots in post 203 where I turned the motor shaft between each screen shot. The rotor-angle and phase-angle parameters don't change. When I added trapezoidal output last night, they behaved the same way.
CNC mill build thread: http://www.cnczone.com/forums/vertical_mill_lathe_project_log/110305-gantry_mill.html
Thanks to Andy's help, I got a motor running tonight. Here's a video:
Fanuc AC servo run with EMC2 - YouTube
The motor works with two hall patterns specified in the emc2 setup - 9 and 36. One gives the reverse rotation of the other. There are two things I'm wondering about currently. One is that the motor's rotation does not sound perfectly smooth. I don't know if that's the motor (it's used), the drive, the computer (I still have trapezoidal output specified), etc. The other is that at rest, the motor shaft is easy to turn by hand - it's not locked up. I think that's because I have the drive in current mode and it's not trying to control the position of the motor though, so that should be okay. So from talking to Andy, I probably need to figure out a way to hook up the rest of the encoder signals to the parallel port (find a pin configuration that will let me read them all).
CNC mill build thread: http://www.cnczone.com/forums/vertical_mill_lathe_project_log/110305-gantry_mill.html
I am glad it works. I always thought that it should, but thanks for proving it.
The roughness probably is due to the fact that the 4 fanuc codes give 16 angular positions, and the hall signals switch at 6 positions, so the lead-angle is going to vary quite a bit due to the miss-match.
The shaft will be free at zero speed, because you basically have an open-loop torque request from the potentiometer to the drive, rather than a speed or position request. There is at the moment no feedback in the system at all.
The next stage would be to add a PID component into the system, which swaps the potentiometer for a PWM output, and which compares actual to requested encoder position to calculate the torque request. At that point you should find that the shaft starts fighting back if you move it more than an few encoder counts from the requested position.
If you do add a PID loop, clamp the motor down, that thing will jump of the bench and break things if the PID tuning goes wrong.
Thanks guys. I will get it clamped down before I do more testing. I do have limited current feeding the motor (3A), so I'm protected a bit from its full power but I will still get it secured.
Thanks for the explanations Andy. That makes sense to me. I think I'll work on getting my pwm to analog circuit working next and then try to set up reading the rest of the encoder and implementing a PID loop. If you guys know of any good tutorials on how to do that in EMC2, I'm all ears. Then I'll test out the rest of my motors. It looks like I'm also going to have to build a proper power supply for the brakes on the 30F motors I have. They require a bit more voltage than the power supply I'm using at the moment can supply. I'm also going to have to do some work to mount incremental encoders on those motors in order to test them. That will all be enough to keep me busy for the next few months.
CNC mill build thread: http://www.cnczone.com/forums/vertical_mill_lathe_project_log/110305-gantry_mill.html
I wrote this years ago for work. I saw a post by Andy elsewhere describing EMC2's PID loop and think EMC2 uses the same PID layout, so the ideas should transfer.
PID Tuning: Step Behavior - Overshoot Criteria
Erik
I found another good page on PID:
Tuning servomotors with PID loops | There are two types of servomotors that engineers commonly use for positioning applications.
You can ignore the autotuner, relay section for your work (even though it is interesting). The author mentions Control System Design Guide by George Ellis (I work with him). I think it is the best beginners controls book out there. It's lighter on proofs and academic math and really heavy on practical information.
Thanks Erik. Those should be helpful. I've been doing some EMC2 specific reading as well and it doesn't look too bad to get a servo going. However tonight I spent some time working on the last motor I bought, a Fanuc 30F. It had a pinion gear on the output shaft that was a bit tough to get off. I had to buy a 27mm wrench to get part of it off, but then I was left with half the gear still stuck on the taper. I ended up having to cut through part of it over the key slot in it with an angle grinder in order to get it to release enough to be able to pull it off with a 3 jaw gear puller. The finished result is shown below. I'm currently planning on using the two of these I have on the X and Y axes and two of the 10S motors on the Z axis. As long as they all test out okay, I now have all my motors and all the connectors for them.
CNC mill build thread: http://www.cnczone.com/forums/vertical_mill_lathe_project_log/110305-gantry_mill.html
Hi,
That is only true for some of the Fanuc encoders, such as the Serial A encoders on my 30F motors. Those I will replace with Heidenhain incremental encoders as I talked about a while ago. On the 10S motors I have, those have incremental encoders that also have the commutation signals that I just tested with Andy's bldc code for EMC2. On the S series motors, generally if the part number ends with BX01-BX10, those are incremental encoders with various pulse rates. Most of mine have 2000 to 2500 pulses per revolution. Numbers in the BX30-50 range are typically absolute encoders and numbers in the 70's are typically serial encoders.
CNC mill build thread: http://www.cnczone.com/forums/vertical_mill_lathe_project_log/110305-gantry_mill.html