Machsupport Forum

Mach Discussion => Mach4 General Discussion => Topic started by: krigby on August 13, 2024, 01:42:05 PM

Title: Mach4 ESS Spindle Encoder Configuration
Post by: krigby on August 13, 2024, 01:42:05 PM
Hello,
I could use some help/advice on getting my spindle encoder set up to display spindle speed and ultimately to use for threading.

I have an Omron E6B2-CWZ1X encoder.
it is connected to a CNC4PC C10 BOB.  Output A is on Pin 2, Output B is on Pin 4 and Output Z is on Pin 6
The BOB is connected to a Warp9 ESS Smoothstepper.
I have attached a document showing the Pin assignments in the ESS Plugin and under Configuration -> Control
I looked in Diagnostics and I don't see any change when I spin the encoder.

Any advice on my setup, and also on how to troubleshoot will be greatly appreciated.

For the record, I am not a machinist, an electrician, or well versed in electronics, so please use layman's terms with me.  Sorry for my ignorance, but I am a hobbyist trying to use a lathe to turn and thread simple parts
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: Rimmel on August 15, 2024, 08:55:32 AM
post pics of the spindle tab in ess and spindle pin assignments. I cant open docs
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: Cbyrdtopper on August 15, 2024, 11:27:14 AM
It looks like it is setup correctly. 
Check the wiring to your BOB and get the signals to read on your diagnostics.
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: krigby on August 15, 2024, 01:10:30 PM
I can't figure out how to insert/post an image.  When I click on Insert Image I just get the {img} tags but I can't copy and paste an image in between those tags.

The document is a Microsoft Word document.  I hope that helps you Rimmel.
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: Cbyrdtopper on August 15, 2024, 01:11:40 PM
Weird... but just take a screen shot. (Press "Print Screen")  then paste it into paint.  Then save that as a .jpg.  Then you can post it here.
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: krigby on August 15, 2024, 02:12:47 PM
No luck on posting the image.  I've tried everything.

But, in other news, I am not getting signals in ESS Diagnostics from all three pins when I spin the encoder.  Yay!  I think my DB9 connector came loose without me noticing.

But....  the RPM is all over the place.  Jumps up and down, says 6000 revs when it's really spinning at about 120.  I read somewhere that electrical noise can cause that.  I am using an 8 conductor shielded cable, 2 conductors each for A, B and Z + and -.  The shield is connected to a pin on a DB9 connector, but honestly I don't know what I should connect the shield to.  Like I said, I'm clueless on this kind of stuff (kind of surprised I've made it this far).  So does it get connected to mains ground, the ground for the 5v power supply, the ground on the BOB and if so I think the C10 BOB has grounds for each pin and an isolated ground also, just going off menory.
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: Cbyrdtopper on August 15, 2024, 02:22:02 PM
Connect it to earth. Whatever your machine ground is. And only connect it on one end of your cable.
I did notice your sampling is set to 1 second. Being that waaaayyy done.
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: krigby on August 15, 2024, 03:32:23 PM
cbyrdtopper, you say " your sampling is set to 1 second. Being that waaaayyy done."
Did you mean 'bring that way down"?  should I be in the .01 sec or lower range?
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: Cbyrdtopper on August 15, 2024, 03:56:05 PM
Yes.  That's what I meant to say.  That was probably sent from the phone and it autocorrected those words. 
I don't remember the speeds on the Smoothstepper.  Try 0.01 see what it does.  I don't remember what we had ours set to when we had the ESS.
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: arturod on August 16, 2024, 08:20:04 AM
Here are some thoughts on what you are trying to do:

- The C10 should be good for this, but make sure that the encoder signals go directly to inputs on the C10 and that the signals are not shared with anything else.
- The C10 handles the inputs using the pull-down option.
- The C72 is a very good option as it can buffer the signals: https://cnc4pc.com/c72-differential-line-driver.html

Arturo Duncan
https://cnc4pc.com
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: krigby on August 16, 2024, 09:28:42 AM
Thank you Arturo.  I will check to see if I have the inputs configured as pull down.

I changed the sampling to 0.001 seconds (the lowest setting it allows) and I see the spindle speed in Diagnostics.  The spindlw speed is steady up to about 800 RPM and then it starts jumping all over the place, increasing to as high as 6000 RPM at times.

I reviewed all the settings again and I see on the ESS Configuration screen Spindle tab that it says I need to assign some output pins. I don't know what pins to assign to that.  the only outputs I have are for the motor drivers.

I am not able to insert images but I am attaching images of the Spindle Tab and the Output Signal tabs.
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: krigby on August 19, 2024, 02:29:21 PM
I did some reading.  my encoder has a resolution of 2000 PPR.
I wonder if that is too high and it is overwhelming the ESS at higher speeds?
I am going to try changing the prescaling and effective PPR to 40 and 50 respectively.
Thoughts.  See the attachment for my Spindle tab in ESS config.
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: arturod on August 20, 2024, 09:26:44 AM
I see what you are saying, but it is not clear to me exactly what is the problem you are having.
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: krigby on August 20, 2024, 12:45:10 PM
Mach4 reports the spindle speed if the spindle is running slowly, but as soon as it gets up to about 800 RPM the reported speed is all over the place, going as high as 6000 RPM.  I thought maybe it was the prescaling, but that is a guess.
To be honest, this may be a question for Warp9 since the spindle is connected (indirectly) to an ESS.
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: arturod on August 20, 2024, 01:35:28 PM
The ESS can read the encoder crazy fast.  Please tell me more:
- What breakout board are you using?  Make sure it can handle the pulse rated.
- Check the ESS kernel speed.  Make sure to set it to run fast enough.
- You may be able to set the encoder output to a resolution that works better.  For reading the spindle position 500 should be good enough. Maybe less would also work.

Arturo Duncan
https://cnc4pc.com
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: krigby on August 20, 2024, 03:23:36 PM
I am using a C10 BOB on port 2 of the ESS.  The C10 is configured to use 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15 as inputs.
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: arturod on August 21, 2024, 07:46:09 AM
That is good.  Here are some thoughts:
- Please comment on what I said about the ESS speed.
- Test this at different speeds and monitor the encoder position in the ESS diagnostics, understand at what speed you lose it.
- Maybe the encoder signals are weak.  Maybe the C72 may help you buffer the signals: https://cnc4pc.com/c72-differential-line-driver.html
- We do have a board that is specially designed for this, but may be a overkill for your application: https://cnc4pc.com/ess-third-expansion-board-enco.html
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: krigby on August 21, 2024, 11:35:01 AM
I can't find a setting for Kernel Speed.  Was that a Mach3 setting, what I found online seems to suggest that was a Mach3 setting and is not configurable in Mach4.
Attached are screenshots of the ESS and Control tabs.
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: arturod on August 21, 2024, 12:25:47 PM
Here it is.  Play with that value.
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: MN300 on August 21, 2024, 06:04:22 PM
The Omron E6B2-CWZ1X encoder used has a differential line driver output so the C72 board is not needed. It would simply duplicate what the encoder already does. However the encoder is now being used as a single ended output device. To take full advantage of the differential feature a C46 - Differential to Single Ended Converter could be installed close to the C10 BOB board. That way the transmission would use the more noise resistant differential mode for most of the path.
https://cnc4pc.com/c46-differential-ended-converter.html
You would also need a ethernet cable and an rj45 breakout adapter like this at the encoder end.
https://www.amazon.com/jujinglobal-Breakout-Board-3-81mm-Terminal/dp/B09K41TPQL/
The breakout adapter could be skipped if you have the skill to cut the cable, identify the wires and connect directly to the encoder.
This modification would only be a benefit if you actually are having a noise problem so it should probably be your last resort.

 
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: arturod on August 26, 2024, 06:13:16 AM
Please let me clarify, I suggested the C72 because of its buffering, not for the differential output.  Yes, it would be ideal to use the C72 with the C46.  It has helped many clean encoder signals.  The C46 will also help isolate the encoder signals, which many times end up being common with the mains of the motor.

Arturo Duncan
https://cnc4pc.com
Title: Re: Mach4 ESS Spindle Encoder Configuration
Post by: krigby on August 30, 2024, 10:29:21 AM
Per Arturo's suggestion I changed the frequency from 40 HZ to 20 HZ.  it did not change anything.  I have not tried any other frequency yet, it's been a crazy busy month.
I took the encoder off the lathe and hooked it up at a 5V power supply then measured the outputs of the A, B, and Z channels.  A and B fluctuate as the spindle turns, but Z stays at a constant 3.9 V as the spindle turns.  Is that normal?  I have not changed the pin to Pull Down yet, when I get a minute I will try that.

Can someone please explain prescaling to me?  I read the ESS article on prescaling here https://documentation.warp9td.com/Hardware/ESS/33_Inputs__Encoders.htm
but I don't understand it.  All I know is that my encoder has a resolution of 2000 ppr..  Can someone please explain how to configure the prescaling for an encoder of that resolution?