I have a few Opto-endstops, "optical interrupter's" and would like to use them along with my mill to make a nice Encoder for a Lathe Spindle.
I am not sure you can do this.
Do you need to detect the motion in two directions or just one.
One is easy you just count the number of pulses, maybe even with an interrupt.
To what purpose do you want to put the count information you get?
Don't know how many counts per revolution you want...
But for the simplest encoder - you would want a segment (paper of thin sheet metal) attached to the spindle that would block the optos for 180 degrees of rotation. place the 2 optos 90 degrees apart. This wold give you 4 transistions per revolution - 00 - both off. 01 - A on B off. 11 - Both On. 10 - A off B on. and repeat.
The important thing is that however many counts you want that you can get the 00, 01, 11, 10 pattern out of your encoder.
What kind of lathe are you using this on? Using it for speed control or threading?
I have a few Opto-endstops, "optical interrupter's" and would like to use them along with my mill to make a nice Encoder for a Lathe Spindle.
I am not sure you can do this.
Do you need to detect the motion in two directions or just one.
One is easy you just count the number of pulses, maybe even with an interrupt.
To what purpose do you want to put the count information you get?
I'd only need one direction to start, really just something simple.
I want the count for threading, the lathe I'm thinking about adding this to is a "Unimat-3" either that or I build something.
So I'm probably safe assuming that there is much more to the circuit, but for the purpose of learning and "re-inventing the wheel" I'm just looking for a simple .dxf of an encoder wheel maybe 100mm in dia, and a simple sketch for the Opto-interupter.
No need for a dxf file, it is just a disc with a hole in it.
The sketch to is trivial, either use the standard interrupt count example or simply count the pulseIn the relevant part of the sketch.
Grumpy_Mike:
No need for a dxf file, it is just a disc with a hole in it.
The sketch to is trivial, either use the standard interrupt count example or simply count the pulseIn the relevant part of the sketch.
I'd like the DXF so I can cut the disk using a mill.
The sketch I'm thinking of using is the one provided here: Redirect Notice
Just, how do I adjust the sketch to suit the 100mm encoder disk?
Also the Opto won't work without breaking the beam, so I'm pretty sure the disk needs a number of breaks/ holes, and the sketch counts the number of interruptions to determine shaft location.
Is this correct?
You don't have to do anything to adjust the sketch for any size encoding disc, you are counting revolutions. You only need one hole in the disc, having more gives more pulses per revolution.
I'm not sure what you are having difficulties with, you might be over thinking things.
Grumpy_Mike:
You don't have to do anything to adjust the sketch for any size encoding disc, you are counting revolutions. You only need one hole in the disc, having more gives more pulses per revolution.
I'm not sure what you are having difficulties with, you might be over thinking things.
Seriously! Just one hole?
Maybe I am over thinking things, I've just seen more complex encoder disks when searching online.
How does the arduino know the location of the disk with just one slot?
If you want to know how many turns the shaft has made then yes only one.
How does the arduino know the location of the disk with just one slot?
It doesn't know the position of the shaft it just knows how many rotations it has made to the nearest rotation, If you want to know how many to the nearest quarter turn then have four holes. Encoders like this are incremental, that is to say they only tell you about the movement of the shaft but then I think this is all you need for your project.
If you want to know the angle of your shaft then you need something like an absolute shaft encoder. These are very expensive if they are optical. Hoverer there is a cheap magnetic one:-