Synchronous Motion with Aux Encoder

Firstly, nice work on this firmware.

I have a small 3 axis mill and would like to do some tapping. Currently using firmware-cnc-latest.bin as of 7/14/20 and have an encoder on the spindle to track the position. Standard 2 channel (using 1 channel now) single ended 360 cpr. In the spindle module I have set the spindle.feedback_pin and spindle.pulses_per_rev but would need a way to access the count to tie it to the Z axis. Is this possible to do currently?

Thanks

1 Like

I don’t (yet) have a spindle encoder but have wondered about this myself…

The spindle module uses one pin to count ticks to obtain the speed of the spindle. Some spindles have an encoder ( two pins ) so you can count the speed and know the direction.
If you don’t need to know the direction, then you can use the spindle module with only one of the encoder pins wired, and it will act exactly like a “counter”/tick pin, and allow you to measure the rotation speed.

Does that make sense?

I don’t see G331.1 or G33 at all in http://forum.smoothieware.org/supported-g-codes — are the docs out of date, or is spindle-synchronized movement including rigid tapping not currently implemented?

Oh that’s indeed not implemented! The current code uses the tick/speed input to monitor speed and adjust PWM using PID so it stays constant ( even as loads change ).

We don’t have spindle-sync movements. I’ve been planning to implement it for ages, but never have the time, and nobody’s ever sponsored that work, so it’s not in there yet.

Thanks for the replies.

I assumed the feedback pin was to close the loop on the spindle, thought I might get lucky with a quick and dirty hack to access the count.

Think it would be best if we could define an [encoder] with A,B & I channels to get quad counts and the index channel for lathe threading. Could unused EN, STEP & DIR axis pins be used for this? Willing to help.

G33/G76 for lathe and G74/G84 for mill.

Great work, thanks.

1 Like

If you are ready to implement lathe synched movement, I have a plan on how to do it, and I can walk you through it. It would be extremely appreciated if you worked on this.

The short version is:

  • Implement encoder reading using the LPC1769’s on-board single encoder reading peripheral
  • Implement a variant of the current timer-based step generation code where steps are generated not based on a timer, but based on ticks of the encoder.

This should work, and depending on your programming skills, might not even be that much work.

( on your question about pins, any pins could be used as step/dir pins )

Very happy to help. I’ll look over the file structure and the LPC1796’s docs and let you know if I have questions.

I have a “working” Arduino sketch for the mill tapping that looks at the spindle counts over a definable time and calculates the speed based on variables (Desired thread pitch, Z axis steps per unit, Spindle encoder count) and updates the pulse train.

As far as the step/dir/en pins, I was curios about the other way around. Can the pins for M5 be redefined as inputs for the encoder? It would be very convenient as they are all together. Feel free to email me any info you think might be helpful.

Cheers.