I managed to decode a rotary encoder using an arduino to read the input signal but I noticed other than the interrupts, the code is mainly made up of lines similar to: "IF this AND that OR that AND that" which can be easily implemented using 74LS logic chips.

So I decided to make a circuit to do that, but I need to design something to detect the rising/falling edge of each signal. I did a bit of research but most of the recommended circuits are fairly complex so they can't be easily implemented.

Someone recommended using not gates and taking advantage of their gate delays to detect the edge but I can't come up with a good idea. If anyone has a circuit suggestion that can be easily implemented on a small PCB, I would love to hear their idea.

EDIT: I'm using a 600 Pulse per revolution optical encoder so it is noise free. It's quadrupled in software to get an effective 2400 pulses per revolution.

I DO NOT WANT TO USE AN ARDUINO FOR READING THE SIGNAL. it is easily overloaded in my application.

  • \$\begingroup\$ Have you searched yet \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Jun 28 '18 at 0:12
  • \$\begingroup\$ If you have bounce suppression caps your code can be as simple as one XOR expression, or as "complex" as 3 IFs. It is about the same as you need to process externally decoded direction \$\endgroup\$ – Maple Jun 28 '18 at 1:35
  • 1
    \$\begingroup\$ (1) Your question says nothing about using the encoder as a tachometer (RPM calculator) and this is critical to the solution. (2) You will need a counter and timer, a latch and a display. You'll need to edit your question again and add some sort of specification for your requirements. (3) This should include the fact that you don't require direction information (which would normally be required in an encoder application). 10000 RPM x 2400 pulses = 400,000 counts/s. (4) What is your required accuracy? (5) What is your preferred logic family? \$\endgroup\$ – Transistor Jun 28 '18 at 22:01
  • 2
    \$\begingroup\$ First, you need to explain what you want the output of this circuit to be. Is it supposed to be a parallel binary value from 0 to 2399? Is it supposed to calculate speed directly? If so, how is it supposed to present that value to the micro? Second, you need to separate requirements from implementation. A requirement may be to offload position tracking from your micro, but that shouldn't state how that is to be accomplished. With the right requirements, you don't care how it's done if they are met. Using 74LS chips is implementation, not requirement. \$\endgroup\$ – Olin Lathrop Jun 29 '18 at 17:38
  • 1
    \$\begingroup\$ circuitelec.blogspot.com/2009/03/… thought this will be useful \$\endgroup\$ – Umar Jun 29 '18 at 17:40

I'm using a 600 Pulse per revolution optical encoder so it is noise free

If your encoder is noise free then you don't need "edge detection circuit", the interrupt pin already does that.

I'm trying to get the arduino to read a 600 Pulse per revolution encoder with quadrupled pulsing (effective 2400 Pulse per revolution) and use it as an accurate RPM calculator. The motor spins 1500 to 10000 RPM

if you don't need a direction, only RPM then:

  • you can use only one output channel of the encoder, cutting the interrupts in half.
  • you can program interrupt pin to detect only one edge of the signal, either rising or falling, cutting interrupts in half again.
  • if that is still too fast for your code you can use Counter or D-trigger chips to divide the frequency to any acceptable range. Cost-wise it is the same as 74LS gate logic but with simplicity of using a single IC.
  • \$\begingroup\$ I am trying to do it using HARDWARE. I've explained it over and over, just read the question ... \$\endgroup\$ – OM222O Jun 30 '18 at 21:45
  • \$\begingroup\$ "I'm trying to get the arduino to read ..." make up you mind and edit your question. Where the output of that hypothetical hardware will go and in what format? You don't make any sense now. \$\endgroup\$ – Maple Jun 30 '18 at 21:54
  • \$\begingroup\$ I've already built everything else, the outputs are handled the way they should be. I just need an edge detection circuit to analyze signals A and B on both rising and falling edges. This is a pretty simple question to understand. \$\endgroup\$ – OM222O Jul 1 '18 at 22:35
  • \$\begingroup\$ That is gibberish. What is "analyze signals"? Measure slew rate? Measure amplitude? What are you connecting "edge detection circuit" to? What output from it do you expect? You refusing to answer simple questions and expecting people to give you advice without knowing what you want. \$\endgroup\$ – Maple Jul 1 '18 at 23:51

This would be for step up/down outputs

With suitable noise suppression...

timing / schematic

Edge detection in hardware is simply XOR’ ing the input with a small time delay.

In software it is the same.

  • sample input, save Sample XOR both results for a change. Then input level (if noise free) plus transition detect determines direction of edge. Thus input frequency max and noise free are requirements to determine max sample interval delay.
  • \$\begingroup\$ ... which would make no sense whatsoever, since those outputs will go into the same arduino \$\endgroup\$ – Maple Jun 28 '18 at 1:00
  • \$\begingroup\$ It makes sense if you know how to code an up/down counter by If last state =0 and present state Up =1 increment counter \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Jun 28 '18 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.