Author Topic: Quadrature outputs signals (of an incremental shaft encoder) decoder  (Read 4187 times)

0 Members and 5 Guests are viewing this topic.

Offline skYfIrETopic starter

  • Contributor
  • Posts: 23
  • Country: fr
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.
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4567
  • Country: dk
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #1 on: July 24, 2020, 04:20:55 pm »
you just want the direction?
 

Offline julian1

  • Frequent Contributor
  • **
  • Posts: 745
  • Country: au
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #2 on: July 25, 2020, 11:29:41 pm »
A stm32 timer can do quadrature decoding using two separate input channels for phase relationship. counter direction up/down is the motor direction.

Quote
Example: Timer 3 as a Quadrature encoder counting input from a motor or control knob.
rcc_periph_clock_enable(RCC_TIM3);
timer_set_period(TIM3, 1024);
timer_slave_set_mode(TIM3, 0x3); // encoder
timer_ic_set_input(TIM3, TIM_IC1, TIM_IC_IN_TI1);
timer_ic_set_input(TIM3, TIM_IC2, TIM_IC_IN_TI2);
timer_enable_counter(TIM3);
...
int motor_pos = timer_get_count(TIM3);

http://libopencm3.org/docs/latest/stm32l1/html/group__timer__file.html
 

Offline SparkyFX

  • Frequent Contributor
  • **
  • Posts: 676
  • Country: de
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #3 on: July 26, 2020, 01:46:20 am »
This kind of decoder stops to work upper than 180kHz, does anyone know an another solution for 1MHz or more ?
The 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).
Support your local planet.
 
The following users thanked this post: skYfIrE

Offline Dave8266

  • Contributor
  • Posts: 35
  • Country: us
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #4 on: July 28, 2020, 07:08:02 pm »
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?
 
The following users thanked this post: skYfIrE

Offline skYfIrETopic starter

  • Contributor
  • Posts: 23
  • Country: fr
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #5 on: August 14, 2020, 11:06:32 am »
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.
 

Offline kmike

  • Regular Contributor
  • *
  • Posts: 59
  • Country: de
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #6 on: August 14, 2020, 11:43:52 am »
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
 
The following users thanked this post: skYfIrE

Offline skYfIrETopic starter

  • Contributor
  • Posts: 23
  • Country: fr
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #7 on: August 14, 2020, 12:38:58 pm »
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 µcontrollers :-/O 12MHz ^-^
Do you use your tm4c for quadrature signal processing ?
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4567
  • Country: dk
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #8 on: August 14, 2020, 12:51:17 pm »
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.

if all you need it direction a D-flipflop will do, just connect one channel to CLK and the other channel to D

 
The following users thanked this post: Ian.M, Tom45, skYfIrE

Offline skYfIrETopic starter

  • Contributor
  • Posts: 23
  • Country: fr
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #9 on: August 14, 2020, 01:34:02 pm »
Hi langwadt,
Could you give me a reference of a component ?
 

Offline Quarlo Klobrigney

  • Frequent Contributor
  • **
  • Posts: 968
  • Country: pt
  • This Space For Rent
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #10 on: August 14, 2020, 07:28:43 pm »
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.
« Last Edit: August 14, 2020, 07:36:12 pm by Quarlo Klobrigney »
Voltage does not flow, nor does voltage go.
 

Offline kmike

  • Regular Contributor
  • *
  • Posts: 59
  • Country: de
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #11 on: August 14, 2020, 08:34:03 pm »
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 µcontrollers :-/O 12MHz ^-^
Do you use your tm4c for quadrature signal processing ?

Yes, I used the tm4c several times for motor and motion control, and often had to use both quadrature inputs.

br,
mike
 

Offline Tom45

  • Frequent Contributor
  • **
  • Posts: 556
  • Country: us
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #12 on: August 15, 2020, 05:08:26 pm »
if all you need it direction a D-flipflop will do, just connect one channel to CLK and the other channel to D

Hi langwadt,
Could you give me a reference of a component ?

In 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.

 

Offline chris_leyson

  • Super Contributor
  • ***
  • Posts: 1542
  • Country: wales
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #13 on: August 15, 2020, 06:14:43 pm »
The state machine approach works well, for example https://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.
« Last Edit: August 15, 2020, 06:30:59 pm by chris_leyson »
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 12993
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #14 on: August 15, 2020, 07:41:38 pm »
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
« Last Edit: August 16, 2020, 06:07:47 am by Ian.M »
 

Offline wizard69

  • Super Contributor
  • ***
  • Posts: 1184
  • Country: us
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #15 on: August 16, 2020, 05:14:37 am »
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.
 

Offline Sal Ammoniac

  • Super Contributor
  • ***
  • Posts: 1747
  • Country: us
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #16 on: August 17, 2020, 06:52:20 pm »
You can easily implement a fast QEI in a CPLD with just a few lines of VHDL or SystemVerilog.
"That's not even wrong" -- Wolfgang Pauli
 

Offline skYfIrETopic starter

  • Contributor
  • Posts: 23
  • Country: fr
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #17 on: August 21, 2020, 06:44:26 am »
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.
 

Offline Tom45

  • Frequent Contributor
  • **
  • Posts: 556
  • Country: us
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #18 on: August 21, 2020, 02:19:04 pm »
Hi all,

Thanks for your messages. For your info, my encoder isn't a cheap one, it's a 20K rpm (max speed) / 0,011° (resolution) encoder.
The question of the noise (and probably the length/shielding of cables) is a significant parameter.

Does 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.
 

Offline skYfIrETopic starter

  • Contributor
  • Posts: 23
  • Country: fr
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #19 on: August 21, 2020, 02:31:23 pm »
Hi Tom45,

I have A+, A-, B+, B-, R+, R- (R is used for 0 position).
 

Offline Tom45

  • Frequent Contributor
  • **
  • Posts: 556
  • Country: us
Re: Quadrature outputs signals (of an incremental shaft encoder) decoder
« Reply #20 on: August 21, 2020, 03:52:31 pm »
Hi Tom45,

I have A+, A-, B+, B-, R+, R- (R is used for 0 position).

Good. 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.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf