Quadrature outputs signals (of an incremental shaft encoder) decoder - Page 1
Forum section: electronics / general

author: skYfIrE
author_rank: Contributor
timestamp: July 24, 2020, 02:54:53 pm
content: Hi,For a rotative bench, usually I use a decoder from US Digital to detect the rotation direction. This decoder uses the quadrature outputs (chans a & b) of an incremental shaft encoder to proceed :This kind of decoder stops to work upper than 180kHz, does anyone know an another solution for 1MHz or more ?Thanks for your help if you can suggest sthg.

author: langwadt
author_rank: Super Contributor
timestamp: July 24, 2020, 04:20:55 pm
content: you just want the direction?

author: julian1
author_rank: Frequent Contributor
timestamp: July 25, 2020, 11:29:41 pm
content: A stm32 timer can do quadrature decoding using two separate input channels for phase relationship. counter direction up/down is the motor direction.Quotehttp://libopencm3.org/docs/latest/stm32l1/html/group__timer__file.html

author: SparkyFX
author_rank: Frequent Contributor
timestamp: July 26, 2020, 01:46:20 am
content: Quote from: skYfIrE on July 24, 2020, 02:54:53 pmThe max frequency of most of these encoders is like 100kHz. Either you need a transmission of some form (belt, gears, wheel) or use a lower resolution encoder (or use two encoders).

author: Dave8266
author_rank: Contributor
timestamp: July 28, 2020, 07:08:02 pm
content: When you say "using a decoder from US Digital", do you mean one of the chips made by LSI Computer Systems?Unless you happen to need extremely high precision in addition to speed, I would second the advice above to solve this mechanically rather than electronically. US Digital sells incremental encoders that support counts as low as 32 cycles per revolution, with shaft speeds as high as 10,000 RPM. If your rotating platform is >10,000 RPM, and you don't specifically need to know the direction, maybe just a singular magnet and a single hall-effect sensor could read the platform speed?

author: skYfIrE
author_rank: Contributor
timestamp: August 14, 2020, 11:06:32 am
content: Hi all,I'll try to answer to all your comments.I just need to recognize the direction of rotation. For all other functions, I have a high precision encoder to manage.Hmmm STM32 can manage this kind of frequency. I need to check...I can't use a lower resolution encoder."Using a decoder from US Digital" means the use of the chip made by LSI yes.US digital encoders are not suitable for my application.I think my demand is too specific. I'll have to find a specific company expert in encoders signal processing.

author: kmike
author_rank: Regular Contributor
timestamp: August 14, 2020, 11:43:52 am
content: Hi,so you are using the LS7083 / LS7084 from US Digital?You need the position or speed or just the direction?Texas instruments has a lot of microcontrollers with dedicated quadrature signal input, they can work up the 12 MHz if I remember correctly (I have used the tm4c123gh6)br,mike

author: skYfIrE
author_rank: Contributor
timestamp: August 14, 2020, 12:38:58 pm
content: Hi kmike,I'll use a LS from US digital yes, if I can't find better.As previously mentioned, I need only the direction information.I don't this family of TI µcontrollers12MHzDo you use your tm4c for quadrature signal processing ?

author: langwadt
author_rank: Super Contributor
timestamp: August 14, 2020, 12:51:17 pm
content: Quote from: skYfIrE on August 14, 2020, 11:06:32 amif all you need it direction a D-flipflop will do, just connect one channel to CLK and the other channel to D

author: skYfIrE
author_rank: Contributor
timestamp: August 14, 2020, 01:34:02 pm
content: Hi langwadt,Could you give me a reference of a component ?

author: Quarlo Klobrigney
author_rank: Super Contributor
timestamp: August 14, 2020, 07:28:43 pm
content: Not mine but an example from Lewis Loflin and the video to go with it just like many found on the web. I made a PDF just in case of questions like posted here. I hope it's what you were asking about. A 74HC14 & 74HC74 or other Flip-Flop can be used with the resultant speed. I don't think you're going anywhere quickly with a 1µF cap that he has there, so try other values.

author: kmike
author_rank: Regular Contributor
timestamp: August 14, 2020, 08:34:03 pm
content: Quote from: skYfIrE on August 14, 2020, 12:38:58 pmYes, I used the tm4c several times for motor and motion control, and often had to use both quadrature inputs.br,mike

author: Tom45
author_rank: Frequent Contributor
timestamp: August 15, 2020, 05:08:26 pm
content: Quote from: langwadt on August 14, 2020, 12:51:17 pmQuote from: skYfIrE on August 14, 2020, 01:34:02 pmIn through hole: 74LS74 dual D flip flop or equivalent. Good for > 20MHz. You only need one of the two D flip flops in the package.You can get more speed, a wider voltage range, and a single flip flop in SMD. For example: SN74LVC1G175 good for > 100MHz.

author: chris_leyson
author_rank: Super Contributor
timestamp: August 15, 2020, 06:14:43 pm
content: The state machine approach works well, for examplehttps://chome.nerpa.tech/mcu/reading-rotary-encoder-on-arduino/It really is bullet proof and has a good deal of noise immunity. Obviously the software approach isn't going to work at 1MHz but it demonstrates the operating principle. A pair of D type flip flops connected sequentially and an xor gate will detect an edge and use that signal as a clock enable for an up down counter. You would have to reverse engineer Oleg Mazurov's state machine algorithm and turn it into hardware and at most it would probably boil down to an octal flip flop and some decoding logic. BTW the Lewis Loflin circuit ain't going to work very well as it has no noise immunity.

author: Ian.M
author_rank: Super Contributor
timestamp: August 15, 2020, 07:41:38 pm
content: Three years ago, I posted a hardware 74HCT LSI/MSI logic full QEI encoder state engine (as a LTspice sim) that is self-clocked off the input pulse edges. With some tweaks to the time constants, I've confirmed the sim will work at count rates up to 2MHz, so I wouldn't expect significant issues pushing the count rate past 1MHz in real hardware. If you used faster logic, and e.g. a 10MHz external clock, you should be able to push it up to count rates where the response times of the photosensors in the encoder are the limiting factor (i.e. the input signal drops out).It also contains an encoder simulator - including index pulse generation, you can specify the resolution, and it is controlled by a voltage 'poz' representing the position, scaled 1V/turn. There's also an integrating charge pump to convert the FWD and REV count pulse outputs back into an analog close approximation of the shaft position to make it easier to check the sim for dropout at high count rates.Edit: I was confusing it with a later version that had the encoder signal generator, and charge pump & integrator. The one linked is just the state engine and some PULSE sources to supply fixed rate quadrature test signals.See:https://www.eevblog.com/forum/projects/quadrature-rotary-encoder/There are some good suggestions in that topic from other posters

author: wizard69
author_rank: Super Contributor
timestamp: August 16, 2020, 05:14:37 am
content: I suspect you may have a bigger problem finding an encoder (at a reasonable price) that will put out mega hertz signals. While the tech might be dated the high data rate encoders and interferometers that I'm familiar with put out an AC signal that required significant signal conditioning.

author: Sal Ammoniac
author_rank: Super Contributor
timestamp: August 17, 2020, 06:52:20 pm
content: You can easily implement a fast QEI in a CPLD with just a few lines of VHDL or SystemVerilog.

author: skYfIrE
author_rank: Contributor
timestamp: August 21, 2020, 06:44:26 am
content: Hi all,Thanks for your messages. For your info, my encoder isn't a cheap one, it's a 20Krpm (max speed) / 0,011° (resolution) encoder.The question of the noise (and probably the lenght/shielding of cables) is a significant parameter.

author: Tom45
author_rank: Frequent Contributor
timestamp: August 21, 2020, 02:19:04 pm
content: Quote from: skYfIrE on August 21, 2020, 06:44:26 amDoes your encoder have differential outputs? Rather than just A and B signals, does it have A A', B B'? The differential signals really helps with noise immunity.

author: skYfIrE
author_rank: Contributor
timestamp: August 21, 2020, 02:31:23 pm
content: Hi Tom45,I have A+, A-, B+, B-, R+, R- (R is used for 0 position).

author: Tom45
author_rank: Frequent Contributor
timestamp: August 21, 2020, 03:52:31 pm
content: Quote from: skYfIrE on August 21, 2020, 02:31:23 pmGood. In that case, feeding each +- pair into a differential receiver will give you substantial immunity against noise and interference. Data sheets sometimes use A+ A- and sometimes use A A'. Both ways denote differential signals.