SnapAmp is a Multi-purpose Multi-Axis Amplifier board for KFLOP
|SnapAmp Plotting Example|
Peak Current Settings
When SnapAmp Powers up the Peak Current settings will not be set and consequently the boards will be in Current Fault mode with the Fault LED on. Some C Code is required to set the Peak Current Limits and bring the board out of fault mode. See: Approximate Peak Current Thresholds here.
Drive Enables - Axis Drift with Zero Current Commanded - PWMC Commands
The SnapAmp PWMC command goes into PWM switching mode attempting to regulate zero current by measuring the current (an analog signal) and adjusting the voltage (PWM). This is a problem with any analog signal/drive. Analog signals are imperfect and will always have bias, nonlinearities, noise, etc. The SnapAmp Current measurement/control range is +/-35 Amps (a 70 Amp full range). With such a large range extreme precision is required to control exact zero current. ie even a 0.1% error = 0.07Amps. SnapAmp wasn't designed for that high of accuracy as it isn't needed to control a motor well. Once the servo is enabled the servo will command whatever current is required to hold the motor in position.
3-Phase Brushless Motor Control - AutoPhaseFind.c
In order for SnapAmp to correctly operate a 3-phase brushless motor it must be able to properly commutate the motor. This involves utilizing the encoder position to determine the rotor position so that the motor poles can be energized appropriately for proper torque generation. KFLOP+SnapAmp performs sinusoidal commutation based on the encoder position (Hall sensors are not required)
As the motor rotates the coil currents need to by cycled through the coils once per pair of motor poles. For example with a 10 pole motor there will be 5 full cycles of current for each full rotation of the motor/encoder. KFLOP has an axis parameter called invDistPerCycle that it multiplies by the encoder position to advance the commutation angle.
The phase of coil currents must be correct as well in order to generate optimal torque in the correct direction. The KFLOP Axis Parameter CommutationOffset is the amount of encoder counts to shift the commutation in order to create optimal torque. Note that the commutation is sinusoidal. If the commutation is off by 1/4 of a cycle then no torque will be generated. If commutation is off by 1/2 cycle then reverse torque will be generated.
Note that energizing a coil with a fixed voltage/current will (if the rotor is free to move) cause the rotor to align with the pole which is the position where the torque gain is zero. Maximum torque will be generated if the rotor is moved by 1/4 of a cycle in either direction. This is how stepper motors operate. Energizing the coils in a sinusoidal manner can cause the rotor to advance in a manner similar to micro-stepping a stepper motor.
In order to determine the necessary two axis parameters to perform the commutation a test program called AutoPhaseFind.c is provided. This test program cycles the coil currents in a way to advance the motor rotor first in the forward direction until two index marks are found, and then two index marks in the reverse direction are found. It then displays a report of the encoder positions and phase angles of the motor currents where the index marks were found. There are #define statements at the beginning of the program which need to be changed by you as appropriate for your system.
Note that if the test is successful then the 4 measured encoder positions should all be different by the number of quadrature counts of the encoder per revolution. Problems that can occur:
- Encoder not counting properly. In this case check the encoder wiring, grounding, shielding. Verify proper operation by moving the encoder away from and back to the same physical position and verify the same encoder counts are displayed on the KMotion.exe Axis Screen
- Noise on the index pulse. This will cause the test to capture positions other than (sooner) than after a full revolution of rotation. Check wiring and shielding.
- Index pulse not detected every motor rotation. In some cases the index pulse is too narrow to be reliably detected. The AutoPhaseFind.c program samples the Index signal every 1ms and advances the commutation cycle 1/1000th of a cycle each sample. If you have this problem there is another example AutoPhaseFindFast.c that samples the Index signal every 180us and advances by 1/10000th of a cycle that may work for your system.
- If the same position is being sampled twice instead of waiting for an entire motor/encoder revolution the "ignore" value can be increased in the program. See the code: ignore=300; this sets how long to ignore looking for the next index pulse (1000 would be a full phase cycle). In some cases even though the magnetic poles have reversed/advanced by 300 due to friction the rotor may still remain on the Index mark. Increase this value and see if you can get the test to succeed.
Once successful you should be able to determine the invDistPerCycle and CommutationOffset for your system. Note the invDistPerCycle needs to be an exact value. It should be computed based on the exact number of encoder counts per revolution and motor poles. The reported value may have small measurement errors.
On power up a method of phase finding is required to determine the rotor position relative to the encoder count. Normally this is achieved by rotating the motor (as a stepper) until the index mark is found and then the encoder count can be zeroed. At that point utilizing the invDistPerCycle and CommutationOffset should provide proper commutation.