encoder not working

More
04 Feb 2019 21:09 #125687 by Ianw
encoder not working was created by Ianw
Hi, This is my first forum post since EMC2 changed to Linuxcnc! I'm in the process of converting a 7x14 chinese mini lathe to cnc in a similar fashion to this chap 7xcnc.com/hardware/my-conversion/ using the latest version of linuxcnc and one of the cheap chinese 5-axis breakout boards. I have the motors working fine but I'm having great difficulty getting the encoder to work. I have used a couple of the optical slot switches as here .. www.ebay.co.uk/itm/Infrared-Slotted-Opti...SwpP9Y5E0d:rk:3:pf:0 to give the spindle index signal on pin 10 and the phase a signal on pin11 . Using a voltmeter on the cable going in to the parallel port I can see the voltage change as the teeth of the encoder pass the opto switch and so I an fairly sure something is going in to the computer... I have set up a basic lathe with stepconfig and included the Pyvcp spindle speed widget. However, I can't persuade it to show me the spindle speed. When I look at Hal Meter, I don't see the parport pins or the encoder signals changing so, after 2 days of steady fiddling, I have to admit that I'm stumped and ask if anyone here can offer any advice please. Thanks.

Please Log in or Create an account to join the conversation.

More
04 Feb 2019 22:20 #125696 by Todd Zuercher
Replied by Todd Zuercher on topic encoder not working
The inputs on a lot of those cheap breakout boards can be problematic. Especially for an encoder input (because of slow optos.) The couple of those boards I have on my desk in front of me have sourcing inputs. They get about 10v (regulated from the 12-24v supply) and that has to be switched to ground to activate the input. So what ever you are trying to trigger the input with, has to ground the pin to activate it (needs to be a sinking output.)

My use of these boards has been further complicated by the fact that on the parallel port side of the breakout board the inputs do not have a pull-up resistor and that gave problems with the parallel port on the computer I was trying to use. Most parallel ports have the input pins pulled up internally.

Please Log in or Create an account to join the conversation.

More
05 Feb 2019 00:30 #125709 by Ianw
Replied by Ianw on topic encoder not working
Thanks Todd, The opto switches give a TTL output from the built-in LM393 comparator chip which goes from 0 to 5 volts. When I put my voltmeter on the relevant plug pins computer end of the parallel cable, I see this voltage swing as I rotate the spindle so I think it is getting through the breakout board OK. I have only measured the voltage between signal and ground so, if it needs to pull down I'll have to check between VCC and the signal. Are you suggesting that I need to do something else to the signal before it hits the computer - perhaps a pull-down resistor or something?

Please Log in or Create an account to join the conversation.

More
05 Feb 2019 10:11 #125722 by Ianw
Replied by Ianw on topic encoder not working
Todd, I just found your posts on the same subject to another user and there is one thing I’m not sure about. When you say the board needs providing with ‘12-24 volts at the other side’ are you referring to the motor supply or the relay output supply? Thanks.

Please Log in or Create an account to join the conversation.

More
05 Feb 2019 11:19 #125723 by Ianw
Replied by Ianw on topic encoder not working
OK, I have connected 24v to the other side of the board, connected all the grounds together and put 1k resistors between the signal pins and ground. What I now find is that, using the Hal config indicators, when I put power to the board, the inputs to the parport pins and encoder phase a and index are low but, as soon as I move the spindle so that a slot passes the opto, the inputs go high and stay there - they don't return to low when the opto is occluded again. Trawling the web hasn't helped so now I'm stuck again.....

Please Log in or Create an account to join the conversation.

More
05 Feb 2019 14:55 #125736 by Todd Zuercher
Replied by Todd Zuercher on topic encoder not working
There are two places voltage needs to be supplied to these boards, 5v via the USB cable (or one of the 5v terminals) and the terminal marked 12-24V(in) (near the relay)

I'm am not certain that the inputs on this board can work with TTL signals. Maybe you just need to try a higher resistance for the pull down resistor? Hopefully you have not hurt your encoder switches.

You may just need to buy a better quality breakout board. (I've had good luck with the C10 boards from CNC4PC).

Please Log in or Create an account to join the conversation.

More
06 Feb 2019 12:33 #125799 by Ianw
Replied by Ianw on topic encoder not working
I have partially solved the problem by taking out the opto isolators on the couple of inputs and am getting some response on the Pyvcp spindle speed readout, but only up to about 400 revs. So more investigation is needed.... thanks

Please Log in or Create an account to join the conversation.

More
06 Feb 2019 13:50 #125807 by Todd Zuercher
Replied by Todd Zuercher on topic encoder not working
How many slots do you have on your disk (pulses/rev)? What is your base thread speed?

You have to remember that reading an encoder with a parallel port is limited by the sampling frequency (base thread).

Please Log in or Create an account to join the conversation.

More
06 Feb 2019 15:28 #125814 by hatch789
Replied by hatch789 on topic encoder not working
I don't want to hijack this thread from the OP, but I'm having a similar problem accept my issue involves 2 encoders. One works fine and it's brother (identical from what I can see) does not register at all on my 7i48 MESA card. I tried swapping the 8-pin blocks between ENC0 and ENC1 on my MESA card and the working encoder works just fine now registering movements on the other axis. So I know my board is fine.

What's confusing is that I examined the A and B channels on both encoders when making a similar speed move and they both behave and look the same on my 2-channel oscilloscope. I should have taken a pic of the sweep screen but it looks great on both encoders. So I don't understand why my 1 encoder is not picking up on the MESA card?

Please Log in or Create an account to join the conversation.

More
06 Feb 2019 16:36 #125823 by Todd Zuercher
Replied by Todd Zuercher on topic encoder not working
I don't have much except for checking the obvious, make sure the both encoders are wired the same. I have had encoders fail where the led seems to dim to the point that they don't work reliably. (This could be compounded by a weak 5v supply.)

Please Log in or Create an account to join the conversation.

Time to create page: 0.155 seconds
Powered by Kunena Forum