good point on the multiple browser tabs…
so I have the sled sitting on my kitchen table next to my laptop with the shield/mega and raspberry pi all connected (minus the chain motors) trying to figure out if it is a wiring problem in the shield / TLE9201 chip or the motor. All indications from mega wiring through to the shield output pins are that everything matches up. Firmware function still needs to be verified though I thought it worked with my other shield fine, but I may be mistaken since I’ve tested 6 different shields and two motors.
I tested the encoder. After removing the router, a caliper was placed between two easy to measure pieces, set both software z position and caliper to zero and moved the gantry up and down by hand (cranking the motor pulley) and the micrometer span measurement matches the z position indicated by the software.
Conclusion:
Encoder is fine.
Tuning the PID.
Setup:
- All PID values set at 0 for z axis for velocity and position as shown in screen shot in my previous post.
- movement set to 10 mm
Action:
pressed z up and z down
Result:
no movement up or down.
Speculative Conclusion:
must have needed a reboot of mega because last time after setting PID values to 0, it just went down and didn’t stop. In makerverse, close and open the connection here to reboot the mega after each change:
or us the reset button here:
after some messing with it, the reset button works just fine. I accidentally hit the set home button, so once I reconnect the sled I’ll have to use webcontrol and reset the chains, but the calibration should still be valid.
I checked firmware assignments for motors 1, 2, and 3. All function the same with similar pin layouts. the difference is the gearing in the motors, not the communication.
pin assignments in system.cpp
motor setup in motor.cpp
stopping motor movement in motor.cpp
setting motion in motor.cpp
my read of the tle9201GS datasheet says the disable pin (#11) is low for enable and high for disabled and for the z axis tlc chip (MP2) is connected to mega pin 8 as digital IO. PWM input to the tle is pin 12 and appears to be connected to mega pwm pin 9 as pwm analog output for the z axis movement speed. (maybe the motor speed is wrong?).
back to PID:
step 1: set p for both (z pos and z vel ) higher and higher until it moves…
-
10, 10 - nothing
-
100, 100 - nothing
-
1000, 1000 - nothing (this is wrong… double check connections — power not connected to shield. it will never work)
-
0, 0, 126 max rpm - nothing
-
10,10, 126 - stuttered movement up and down. very slow. 10 mm ask moves about 4 mm
-
10, 10, 80 - same but only moves about 3 mm
-
100, 100, 80 - same stuttered movement, but moves about 9 mm
-
100, 100, 40 - higher frequency stutter. moves about 8 mm
-
100, 100, 20 -
-
100, 100, 5 - just moves slower about 8 mm but still stutters back and forth the whole way during the movement.
z axis pwm is pin 9 so its pwm frequency for the tle 9201 is max of 20 kHz as per the data sheet
values to choose from shown in the firmware comments:
I’ve tried 2,3,4 at 100,100,20 and it doesn’t seem to matter.
set pwm value from 2 (
The expectation is that the motor will turn on and run to its setpoint and then start oscillating, not oscillate all the way to it.
going to set rpm to 100 and try bumping the P values more. after a an hour of several different values. I had it working slow but smooth until I reset it and and went back to the stuttering. I’m thinking I damaged the z chip on the board or it is the motor. I need to get another shield to compare with it.
I had it at 150, 2, 100 for the p values at a frequency of #6, but things got weird and it didn’t work for a while until I changed the z axis proportion value from 1 to 0, but that doesn’t make any sense.
today’s conclusions:
this is crazy. based on the fact that the motor moves the correct direction and changing the numbers makes it better or worse, it is a tuning issue, but I still think there is more to it than that… a simple oscillation around the setpoint position would be one thing but the velocity appears to be oscillating as well, so the direction of movement changes when the position is trying to tune, so the one change confounds the other. Changing 2 sets of PID values at the same time is a bad idea. the TLE9201 is rated at 6Amps. I doubt it is pulling that much, but if the motor is bad and the chip is hitting max amps, it will freewheel and then turn back on, so that could be the stuttering…
could the chip be short circuit detecting and that is why the motor stutters? I don’t have a scope to check this, just a multimeter.