Machsupport Forum

Mach Discussion => General Mach Discussion => Topic started by: jimglass on June 03, 2012, 12:00:05 PM

Title: Need Encoder for threading
Post by: jimglass on June 03, 2012, 12:00:05 PM
I tried to do a search on "Encoder" but had no results.

Anyway, I'm doing a retrofit on a Denford CNC lathe.

Retrofit almost done (http://img.photobucket.com/albums/v30/jglass/CNC%20projects/CNC%20Lathe/VFDLarge.jpg)

To cut threads I mounted a stepper motor to the spindle.
Stepper motor setup (http://img.photobucket.com/albums/v30/jglass/CNC%20projects/CNC%20Lathe/stepperthreading.jpg)

 For normal turning the timing belt needs to be removed from the stepper. It works great for theading plastic but lacks the power to thead steel.
see it cut threads (http://smg.photobucket.com/albums/v30/jglass/CNC%20projects/CNC%20Lathe/?action=view&current=CNCthreadingshort.mp4)

Can somone recomend a source and part number for a encoder that can be used with Mach3 for threading?   I should be able to mount the encoder
where the spindle stepper motor is.    I'm using a Bob Cambell breakout board.

I have already read the Mach3 download about threading.   The download did not mention the encoder used.

Thanks   Jim Glass
Title: Re: Need Encoder for threading
Post by: Hood on June 03, 2012, 12:17:36 PM
I wouldnt bother with the stepper for threading, if your normal spindle motor is half decent you can use that. What you need (if using the parallel port) for an index pulse is not an encoder but rather something like an optical switch or a proximity switch. I used the parallel port I used an opto with a slotted disc, the one I used was an Optek OPB917B.
Hood
Title: Re: Need Encoder for threading
Post by: jimglass on June 03, 2012, 06:30:50 PM
Hi Hood;

Pleasure to communicate with you again.   The last time was 2006 when I was doing my Bridgeport CNC retrofit.    That thing has worked out very well
for me.

For the Optek OPB917B to work do I need to make a disk with holes or slots?   If so is 100 holes or slots what I need.  The Optek OPB917B is only $9 so the price is right.

Jim
Title: Re: Need Encoder for threading
Post by: Hood on June 03, 2012, 06:38:27 PM
A disc with one slot is what you need. Disc size I used was approx 100mm dia with a 10mm wide slot and it worked well.
You will also need a 220 ohm resistor to limit the current to the LED of the opto.
Hood
Title: Re: Need Encoder for threading
Post by: jimglass on June 04, 2012, 03:47:49 AM
Will the Optek OPB917B connect easily to the Bob Cambell breakout board?   I thought I saw the Optek OPB917B ran on 35 volts.   Did I read that
right?

The Breakout board uses connector J23 for the encoder.
PIN 1  Isolated  GND
PIN 2  Isolated  GND
PIN 3  Isolated  to PIN 12 Parllel port (IN1)
PIN 4  Isolated  to PIN 13 Parllel port (IN2)
PIN 5  Isolated  to PIN 15 Parllel port  (switch)
PIN 6  Isolated  to +5V

A one slot disk should be easy enough to make.
Thanks,
Jim
Title: Re: Need Encoder for threading
Post by: Hood on June 04, 2012, 04:33:43 AM
The OPB 916B or 917B need a voltage from 4.5v to 16v, if I recall, so 5v is fine.
Take the 5v from Pin 6 and connect the white wire to it, also connect the resistor tothe 5v and then the red wire to the other side of the resistor. The Black and Green wires go to Pin 1 or 2 and finally use one of the inputs to connect the blue wire to and it should work fine.
In Mach go to Ports and Pins, Inputs and set the index up to the  port and pin number you connected the blue wire to. Even if you do not use Mach to control the spindle you will need to enable the spindle relays ( only needed if using the parallel port) You will find that option on  the Spindle setup page(from Ports and Pins)
 On General Config page make sure the Index Debounce is zero or near to it.
For the index to work you need to tell Mach the spindle has started so even if you dont have Mach controlling the spindle you still need to have a M3/M4 in your code or press the spindle button in Mach, that is so that Mach knows to look at the index signal.
Hood
Title: Re: Need Encoder for threading
Post by: angel tech on June 04, 2012, 05:52:30 AM
jim, was the original denford optical switch missing from the lathe
Title: Re: Need Encoder for threading
Post by: RICH on June 04, 2012, 06:45:36 AM
Jim,
I also would not recommend a stepper motor to be used on the spindle for threading.
The single slotted disc works fine. I use Halls affect for the index. It will be more expensive than a OPB but it suited my needs better
for mounting.

RICH
Title: Re: Need Encoder for threading
Post by: jimglass on June 04, 2012, 08:37:25 AM
jim, was the original denford optical switch missing from the lathe

Yes, I bought the lathe on Ebay from a guy that was parting out Denford lathes.    I bought the lathe bed with ballscrews, and purchased
the original spindle motor, chuck and tailstock separately.   Right or wrong, it was what I was looking for.    I was told the Denford
is the same or similar to an EMCO 8.

I'm also working on a toolchanger for my Denford.   I built this indexer as a prototype now thinking of building another one that is  smaller.     I found a way to address the backlash issue with worms and worm gear setups.
http://www.chaski.org/homemachinist/viewtopic.php?f=9&t=93146

The guy I bought the lathe from was using a stepper motor on the spindle for cutting threads so I copied his idea.    I had a stepper motor, timing belts and pulleys on hand so it cost only some time to set up.   Plus I learned how to have a stepper move in angular steps thinking that knowledge would be used on my CNC indexer.

The stepper motor on the spindle for cutting threads was rather impressive to see work.   All my experience has been cutting threads on geared lathes.    I used delrin plastic to cut my first CNC threads.    But the stepper failed miseralbly cutting a 5/8-18 in steel.   The stepper did not have the power and lost steps.    The stepper might work well on 10-32 and smaller threads but I'm not going to bother
trying it.

Thanks,  Jim

Thanks,  Jim
Title: Re: Need Encoder for threading
Post by: angel tech on June 04, 2012, 10:40:23 AM
cncdoctor does an index pulse board that works well with mach, which is a break beam device.
Title: Re: Need Encoder for threading
Post by: jglass on June 28, 2012, 07:39:54 PM
Hood;

I purchased 2 of those OPB 916B sensors to be used as an encoder for my lathe threading project.   I connected one of them up
to a 5VDC powersupply and got it working so I connected the second to my breakout board.    There does not seem to
be 5VDC between PIN #6 and PIN #1 or #2.   Seems like voltage should be there if the computer is turned ON.

I ran the spindle motor from the computer and still no voltage.

Any ideas?
Jim
Title: Re: Need Encoder for threading
Post by: Hood on June 29, 2012, 02:53:20 AM
Dont know what BOB you have but if there is meant to be 5v and Gnd on these pins maybe you need to set some jumpers or something?
BTW hope you are remembering the resistor between the 5v and the LED of the OPB?
Hood
Title: Re: Need Encoder for threading
Post by: jglass on June 29, 2012, 05:51:16 AM
Hood;

Yep, the 220 ohm resister is in the circuit.   I'm using a "Sound Logic Breakout board Plus" from Bob Cambell designs.
I also sent them an email with the same question.   He has been very helpful so far.

This breakout board is made for Mach2 and Mach3 users.
Thanks,  Jim
Title: Re: Need Encoder for threading
Post by: Hood on June 29, 2012, 01:35:08 PM
Ok I am not familiar with the BOB, I do know of them but have never used one.
Will see if I can download the manual and have a look but hopefully Bob will get back to you.
Hood
Title: Re: Need Encoder for threading
Post by: jglass on June 29, 2012, 06:22:47 PM
Hood;

Here is a link to the user manual.

http://campbelldesigns.net/files/breakout-user-guide-1-8.pdf

The ENCODER is J23 on page #4.   J23 is a 25 pin connector.   I was able to identify the PIN numbers by using another cable I happened to have on hand where the pins are numbered.

Bob Cambell told me to use a separate 5V power supply which I have done with a USB cable connected to the computer.    However, the input from the sensor is connected to PIN 5 which is optically connected to PIN15.   Going to the Mach3 "diagnostics window"  I see no change at the "INDEX" PIN 15 when I rotate the spindle past the sensor.

I doubt the PIN 15 input is working.    I did run a -5V wire to PIN 1 which should be GND.   Maybe that is a mistake?   Maybe a
+5V wire should be connected somewhere on J23?

I have verified the sensor is working but the computer does not see it as wired.

I think this is a simple fix for someone that has done this before.   Jim
Title: Re: Need Encoder for threading
Post by: Hood on June 29, 2012, 06:34:42 PM
Just out of curiosity what do you have the Index Debounce set to on General Config page? I found anything above 0 gave me poor readings although others have found they need maybe 10 or so.
Hood
Title: Re: Need Encoder for threading
Post by: Hood on June 29, 2012, 07:00:04 PM
I just had a quick read as its getting late here but I see it says the encoder inputs are connected to pin 12, 13 and 15 but also the  Y, Z and A home share the same pins. Do you have home switches connected to these inputs? If so that may be your issue.
Will look back in the morning and see what you say then we can take it from there.
Hood
Title: Re: Need Encoder for threading
Post by: jglass on June 29, 2012, 10:29:03 PM
The only pins I have assigned are for the 3 steppers, the charge pump and the reset

I checked the Debounce settings and they were quite high.

I'm beginning to think I should run +5V to PIN 6.   After that I may run the sensor output directly to PIN 15.

Will I be able to tell if the INDEX input is working from the diagnostic screen
Jim
Title: Re: Need Encoder for threading
Post by: Hood on June 30, 2012, 08:26:11 AM
Can you attach your xml as it may be a config issue.
Hood
Title: Re: Need Encoder for threading
Post by: jglass on June 30, 2012, 08:29:44 AM
Hood;

I got it working!!!     I tried evrything to wire the sensor to J23 so I gave up and used the terminals for "A Home" since I don't plan to use homing.    "A Home" has terminals for +12v, GND, Sensor.   No longer need the 5V power source.   My  electrical cabinet just got a lot cleaner.

Went to ports and pins and set INDEX to  PORT  1 and PIN 15  and then ACTIVE LOW and it works.   I just checked the
tachometer reading with a handheld tach and they agree to better than 1%.

Now I'm reading to try threading.  

Thanks,   Jim
Title: Re: Need Encoder for threading
Post by: Hood on June 30, 2012, 09:25:02 AM
Thats good to hear Jim :)
Hood
Title: Re: Need Encoder for threading
Post by: jglass on July 02, 2012, 09:09:05 AM
I'm now cutting threads and love the way this works.

Encoder:
(http://img.photobucket.com/albums/v30/jglass/CNC%20projects/CNC%20Lathe/Lathetachometer.jpg)

Tachometer:
(http://img.photobucket.com/albums/v30/jglass/CNC%20projects/CNC%20Lathe/TachDisplay.jpg)

First thread:
(http://img.photobucket.com/albums/v30/jglass/CNC%20projects/CNC%20Lathe/CNCthreads.jpg)

Video of thread cutting (http://smg.photobucket.com/albums/v30/jglass/CNC%20projects/CNC%20Lathe/?action=view&current=CNCthreading4.mp4)
Jim
Title: Re: Need Encoder for threading
Post by: Hood on July 02, 2012, 09:35:43 AM
Looking good, better do a long thread before John S says its not really working ;D

Hood

Edit
Too late I see he already has ;D
Title: Re: Need Encoder for threading
Post by: jglass on July 02, 2012, 11:34:36 AM
How did you know John was going to do that.   He already said it wouldn't work. ;D

I ran a test piece with 10 TPI and cut threads 5" long.    I measured with an eyeglass and steel rule and the last of 50 threads was off about .010".  Much better than I expected actually.   Not bad for a $5 encoder and $175 for Mach3 program.

I did calibrate my "Z" axis.     Before I calibrated Z, I was off 1/2 thread in 5".
Jim
Title: Re: Need Encoder for threading
Post by: Hood on July 02, 2012, 01:19:01 PM
May have been your chamfer amount that you were seeing the discrepancy in the last  thread.
Hood
Title: Re: Need Encoder for threading
Post by: jglass on July 02, 2012, 09:38:24 PM
Here is my test result.    This  was after two passes.   I thought Mach3 did a great job, better than I expected.    The thread pitch is consistant and the second pass proves Mach3 is repeatable.

(http://img.photobucket.com/albums/v30/jglass/CNC%20projects/CNC%20Lathe/CNCThread.jpg)

Jim
Title: Re: Need Encoder for threading
Post by: Hood on July 03, 2012, 02:58:09 AM
Saw your pic on the other forum and I think your issue with the last turn being off pitch, is due to the slow acceleration that steppers have. Try setting a chamfer angle of maybe 360 or more and see. I am sure Grahame sorted the macro about 3 or so years ago so that the chamfer worked correctly, it should start pulling out at the value you set, ie 360 degrees before the last rotation, that should help things be cleaner at the end.
Hood