1HCL Closed Loop Joint Shaft Encoder (not motor shaft)
-
Hi!
The background
I have a 1HCL expansion board driving a Nema17 stepper motor. I also have a CUI AMT102-V 2048 PPR (8192 CPR) encoder hooked up to the output shaft of the mechanism the Nema17 motor is driving. The encoder is NOT attached directly to the stepper motor shaft, but further down the mechanical linkage at the output. The output shaft only rotates through 180 degrees of motion.The reason the encoder is mounted on the output shaft and not on the motor shaft is that there's a significant amount of backlash in the mechanical system that is hard to compensate for (the amount of backlash varies with the load and orientation of the end effector).
Efforts
But due to the backlash in the system I can't seem to get the motor into closed loop mode. When trying to perform a Quadrature Shaft Encoder Calibration moveM569.6 P##.# V1
, it fails due toinconsistent movement
(I'm assuming this is because the backlash present in the system makes it seem like the encoder is faulty). I tried to bump theE
param of the569.1
command up to fairly large values to try and 'bypass' the backlash but it didn't seem to work.Setup
6XD & 1HCL running 3.5.0-rc.1
Encoder is configured to use2048 PPR
(or 8192 CPR)
I have the A and B lines from the encoder hooked up to A and B on the 1HCL along with 5v and GND
Stepper Motor is1.8 deg/step
, with a mechanical reduction that results in0.1930 degs/step
at the wrist
The driver is configured withM569.1 P54.0 T2 C2048 R100 I0 D0
- Note:
- I'm fairly certain
C
is incorrect here, but I've tried many different values with no luck - It won't accept anything less than
C400
(throwsError counts/rev must be at least 2 times steps/rev
)
- I'm fairly certain
The mechanism has a full-steps / deg value of
M92 V5.1812500
Then placed into closed loop mode with
M569 P54.0 D4
A Potential Solution
I was wondering if there is a closed loop mode of operation that essentially maps encoder values to rotational angles and will just blindly drive the motor in the direction necessary until the encoder position/value is reached. Or if there is a way to trick an existing drive mode into behaving this way?Any help / suggestions would be greatly appreciated!
Photos
I've linked some photos of the robot arm & mechanism in question if you happen to be curious.
The mechanical linkage / mechanism in question (J5 - driven by a Nema17 ballscrew at the rear of the forearm)
This picture shows the Nema17 ballscrew driving a mechanism that pulls a belt
The belt drives a toothed pulley further down the forearm at the wrist of the robot
The encoder is mounted to the wrists shaft directly so the actual/real position can be measured
- Note:
-
@toms a closed loop contfoller such as the 1HCL needs an accurate low backlash encoder on the motor shaft to perform commutation, in other words so that it knows how to apply current to the motor phases in order to apply torque in the required direction. So a setup such as yours requires two encoders to be used.
The firmware on the 1HCL does support two encoders if you select the quadrature linear axis encoder configuration. The motor shaft encoder has to be a Duet3D magnetic shaft encoder, because the 1HCL can only read one quadrature encoder.
-
@dc42 Thanks for the info!
The quadrature linear axis encoder configuration sounds like what I need! The only issue it that I'm limited on the number of wires I can string back to the control board and the 10 pin SPI header is quite a bit of cable, also the path back to the control board is further than the recommended 200mm
Also, I just realized that this setup is basically a servo, just replacing a potentiometer with an encoder. Is there a mode in RRF that allows you to drive a stepper motor in open loop mode targeting a potentiometer / encoder value? Essentially turning a stepper motor into a servo?
Thanks again for the help!