jschoch / ESPels

ESP32 electronic leadscrew for a lathe
Apache License 2.0
19 stars 4 forks source link

Math question #38

Closed defazioa closed 9 months ago

defazioa commented 10 months ago

Hello again. I have been using your project for a couple weeks and I believe it works as you intended. I have a strange issue with the math with regard to feed per rev. When I dial up 25mm in the move sync mode with backlash out of the system, I only move 24.840. It's repeatable and linear so it stacks up over distance. The puzzling thing is that I thought if I was off it would be by a multiple of something or a reasonably round percentage, but it's this oddball number. There are some things I had wrong out of the gate; the encoder I was sent was 600 cpr not 360 as I thought, which was exacerbated by the fact that the encoder runs at 2:1 vs. the spindle due to gearing. I also failed to factor in the 4:1 ratio of the servo to the leadscrew, but these were the dumb errors I was expecting, not to come up .6% short. Any ideas? The only thing approaching a glitch I've found is that when you cancel a bounce move early, it still runs the entire return cycle at speed. This can cause some excitement and happens just when you start to trust the thing. I had a hell of a time with hardware this time as never before with the ESP32. I had some transients or similar causing flash corruption and hangs on boot. I have moved the pulse and direction pins to 22 and 23, there's some talk in the documentation about GPIO 12 causing serious misbehavior if pulled high during boot and causing this, and it seems better. I've mitigated noise as much as possible but there's a couple switching supplies sharing the enclosure which makes it a challenge. It's behaving now, I am getting used to the web interface but I wish the buttons were bigger. It is very responsive with a robust connection. Thanks again, it works a treat.