Welcome! Log In Create A New Profile

Advanced

Positional feedback with rotary encoder: is it possible?

Posted by rollingdice 
Positional feedback with rotary encoder: is it possible?
May 17, 2017 01:46PM
So, I stumbled on this part on aliexpress.
You could attach a GT2 tooth there. The signal is transmitted via twisted pair interface, so quite immune to noise IMO.
I am going to try develop a positional feedback feature on Marlin. My plan is to create feedback module on cartesian (Prusa-style) printer first, because I have no experience on inverse kinematics.
Have anyone tried/thought about this before?
Since the main.cpp file contains 12k+ lines, could anyone suggest on where to look first?
Re: Positional feedback with rotary encoder: is it possible?
May 17, 2017 05:41PM
It depends on what you are trying to accomplish. If you want to use the encoder to position an axis, you probably need to be working down in the Stepper.cpp module. But if you just want an independent report of where an axis is positioned, you can do that pretty high up, maybe as an M command in Marlin_main.cpp.
Re: Positional feedback with rotary encoder: is it possible?
May 18, 2017 03:00AM
The real question is, does the mega have enough CPU power to do a closed loop/ PID controlled motion control with error correction?
A few month ago someone made a separate closed loop controller, sitting between RAMPS and motor driver ( IIRC, it was for DC-motor ).
But still there was no error correction, in case a stepper would skip steps. It would only take care of " position-signal equals input steps", but the timing could be all wrong.
Re: Positional feedback with rotary encoder: is it possible?
May 18, 2017 12:26PM
Well... The various extruders and the heat bed are all done with a PID algorithm.

The stepper motors are not PID, but there are a fair amount of calculations being done to get all the motors to accelerate and track together.
Re: Positional feedback with rotary encoder: is it possible?
May 18, 2017 01:46PM
Right, there is room for more math on a cartesian printer, but don't forget the Deltas and CoreXY.
Re: Positional feedback with rotary encoder: is it possible?
May 18, 2017 01:54PM
Ink jet printers have obtained super resolution
by using linear encoders
Optical strips on axis read by sensors provide very accurate measurement

So even though you sense that the position is in error
what will you do when the hot polymer has all ready shot out the extruder?

encoder resolution and stepper resolution? will you be able to control to get better resolution?

Chasing unobtainium?

confused smiley
Re: Positional feedback with rotary encoder: is it possible?
May 19, 2017 12:25AM
First, I'm not trying to get better resolution out of it. I just want to prevent layer misalignment in case of hotend hitting obstacle.
My plan is implementing feedback at low enough level that it should be agnostic to implemented kinematics. The math should be simpler, too.
I haven't take a look at stepper.cpp yet, but I think it sits at low enough level. Thanks for any feedback, will report later.
Re: Positional feedback with rotary encoder: is it possible?
May 19, 2017 03:30AM
Cozmicray is right, the encoder resolution has to be better than the steppers. Which means tons of interupts to deal with. ( You can't try to poll the encoder ).
The better way is a separate cpu that reads encoder and steps and only in case of skipped steps, sends an alarm interupt to the printer-cpu.
Re: Positional feedback with rotary encoder: is it possible?
May 19, 2017 06:33AM
Quote
o_lampe
Cozmicray is right, the encoder resolution has to be better than the steppers. Which means tons of interrupts to deal with. ( You can't try to poll the encoder ).
The better way is a separate cpu that reads encoder and steps and only in case of skipped steps, sends an alarm interrupt to the printer-cpu.

I'll use Due this time. Mega 2560 can't accommodate enough interrupt pins for rotary encoder output.
I found this count_position variable in stepper.h module that count position of the stepper in steps. Currently, it is set by set_position in Planner::set_position_mm.
If count_position is set every time the rotary encoder give out pulses, this could result in LESS math and calculation than before because you don't have to derive stepper position in planner module.
I could be wrong, though... so any feedback will be appreciated smileys with beer
Re: Positional feedback with rotary encoder: is it possible?
May 20, 2017 11:47AM
If the probability of hotend hitting an obstacle is high
perhaps
you should home the extruder prior to starting new layer

perhaps the layer misalignment mechanism lies elsewhere?


confused smiley
Sorry, only registered users may post in this forum.

Click here to login