My guess is that either model above might work, though I don’t have enough info to be sure (links to the device specs would be nice). It’s important that the output(s) be able to go both Arduino logic levels, high and low. The 1’st device doesn’t explicitly say that, but that could be because it’s got a variable voltage supply or perhaps has open collector type output(s). I’ll assume you want to use the device to dial up a position by hand that the stepper then follows. If so be aware you want what’s known as a quadrature encoder. It has 2 outputs that are phased so you can tell what direction the twist is (CW or CCW). And if you don’t need that level of position resolution, there are quadrature encoders that are mere switches that will also work (though at only 12 or 24 ppr) that are much less $$s.
If the link above is correct I’d shy away from using the LTD-002. It’s output circuit is an 26LS31 which is an RS-422 driver, meant to push 20 mA into a proper termination and 'LS32 receiver. It might be made to work with an Arduino digital input but the LTD-100 is an open collector type output and, if run off 5V, will certainly work. I still note that it’s not sure whether either is a quadrature encoder.
Now here’s a similar part, less $$ too, that appears to be the same and appears to be a quad encoder. I say appears because while it has A and B outputs, they don’t show the relationship btw A and B. Perhaps it’s just a given ?
THANK YOU for the help! I suspected there could be a problem with the Hi/low levels of the two MPGs I listed, (one was high @0.7v, and the other was high @2.5v.) The MPG you found for me on ebay has a high level of 4.5v, which I hope is high enough for the arduino (which should be around 5v??) I ordered one tonight.
I am totally new to arduino, but at least the wiring end of it shouldn’t pose TOO much of a problem for me, (I am an electrician by trade.) --The programming end of it on the other hand, is anouther matter. At least now I know the MPG should work for my project, once I get the programming figured out.
Thank you Mee n Mac, and sethcim, for your input. It is much appreciated.
THANK YOU for the help! I suspected there could be a problem with the Hi/low levels of the two MPGs I listed, (one was high @0.7v, and the other was high @2.5v.) The MPG you found for me on ebay has a high level of 4.5v, which I hope is high enough for the arduino (which should be around 5v??) I ordered one tonight.
I think the high level spec on the LTD-001 was supposed to be Vcc - 0.7v, which makes some sense as it has a Vcc range of 5v - 24v. For an Arduino anything above Vcc/2 (= 2.5v for a 5v Arduino) is a logic high. Anything < 0.7v is a logic low. So your MPG should work. As for coding, there should be a number of examples of reading in quadrature encoder data. One thing to be aware of is that the simplest method (using 1 input as a clock and the other as a direction indication) is probaly not a good way for your application. You can build up small errors if you twist the control back and forth a small amount, as you might expect to do to fine tune a position. Good code is a bit more complicated though not overly so. Read this from the comments on an [encoder SFE sells. Again I hope the one you bought was a quad encoder.
jepler| about a year ago 4 The “example code” does not count quadrature correctly. It makes the common mistake of looking for an edge on one channel and then counting up or down depending on the state of the other channel. It’ll look good when the shaft is being turned steadily in one direction, but it won’t work when the shaft is moving back and forth by small (1/200-revolution) angles. When the encoder shaft is being moved steadily in one of its directions, it repeats the sequence 00 –> 01 –> 11 –> 10 –> 00. In the other direction, the sequence is reversed: 00 –> 10 –> 11 –> 01 –> 00. But a reversal can happen at any time in the sequence, e.g: 00 –> 01 –> 11 –> [reversal] 01 –> 00. The shortest pattern with a reversal is 00 –> 01 [reversal] –> 00 (repeating). Now imagine that the second bit is the one being treated as a rising-edge interrupt. Rising edges of this pin will be seen repeatedly, and the “other bit” will always be 0. That means that with this input waveform, the count will always increase even though there is no net motion on the motor shaft. Another way to look at it is: you can have one lost count at every reversal. In CNC positioning applications, this is unacceptable. Depending on your application, the inaccuracy may be less important than the speed or the “load” on your microcontroller (e.g., speed control applications)… scharkalvin| about a year ago 1 You are correct. I wish I had a dollar for every quadrature interface example that used one of the outputs as a clock and the other as a direction! The correct way is to configure the processor with TWO interrupts, one for each pulse and to trigger on change (ie BOTH rising AND falling edges). Then use a state machine to read the new state of the two inputs and based on the previous state decide if the direction was forward or reverse. AVR micros have an interrupt on pin change (by port) which can be used for this rather than using two discrete interrupt inputs. Another way to do it is to poll the two inputs and if the new state is different from the last process as described above. You can set a timer to establish the poll rate, which would be determined by the number of pulses per revolution and the max expected speed of rotation. BTW this encoder looks like it’s designed for coupling to a motor, there are better units (and cheaper!) for use as digital panel pots with knobs.](Rotary Encoder - 200 P/R - COM-10790 - SparkFun Electronics)