Author Topic: Value for money rotary encoder?  (Read 634 times)

0 Members and 1 Guest are viewing this topic.

Offline 741Topic starter

  • Frequent Contributor
  • **
  • Posts: 402
  • Country: gb
    • Circuit & PCB Design (small PCB quantities OK)
Value for money rotary encoder?
« on: August 19, 2019, 09:29:20 am »
I am looking for alternatives, on cost grounds, to the Bournes PEC11.

Say 12 detents (not critical) and a push-button (ideally). I'd tend to look on eBay and I hope to avoid really poor quality types by asking for recommendations here.

Offline rhodges

  • Frequent Contributor
  • **
  • Posts: 331
  • Country: us
  • Available for embedded projects.
    • My public libraries, code samples, and projects for STM8.
Re: Value for money rotary encoder?
« Reply #1 on: August 19, 2019, 12:37:28 pm »
I like this Alps rotary encoder. It goes on sale for fifty cents from time to time:
https://www.goldmine-elec-products.com/prodinfo.asp?number=G20056

I have code for the STM8 here:
https://github.com/unfrozen/stm8_libs/blob/master/lib_rotary.c
https://github.com/unfrozen/stm8_libs/blob/master/lib_rotary.h

Quote
/******************************************************************************
The ALPS rotary encoder switch has 30 detent positions, each one spaced 12
degrees apart. The three (encoder) pins are A (left), Common, B (right).
Pins A and B should be pulled up to Vcc; 10K resistors are recommended to
keep current under 1mA. Here, the input pins have internal pull-ups of
about 40K.
Both A and B are stable at detent position, and both A and B will have
the same output. When the encoder is rotated clockwise, B will change
first, then A. For counterclockwise, A will change first, then B.
Instead of using Interrupt On Change, poll at a rate often enough to
catch the fastest transitions. One full revolution in half a second
might be a good starting point, which gives 60 pin changes per second,
or one every 16 milliseconds. Oversampling by 4 would give one poll
every 4 milliseconds, which is probably already a timer interrupt.
0.      Read pins A and B, save starting status.
Polling procedure:
1.      Are pins A and B the same?
        NO: Which changed from saved status? Set direction flag. Exit.
        YES: Continue to 2.
2.      Are A and B equal to last saved status?
        YES: Encoder at same detent position. Ignore. Exit.
        NO:  Save new status. Eval direction flag and indicate rotation.
*/
Currently developing STM8 and STM32. Past includes 6809, Z80, 8086, PIC, MIPS, PNX1302, and some 8748 and 6805. Check out my public code on github. https://github.com/unfrozen
 

Offline ehughes

  • Frequent Contributor
  • **
  • Posts: 410
  • Country: us
Re: Value for money rotary encoder?
« Reply #2 on: August 19, 2019, 12:50:00 pm »
Just posting this so it is not forgotten:

http://www.mkesc.co.uk/ise.pdf


Probably the most robust and simplest decoder I have seen. 
 
The following users thanked this post: techman-001

Offline 741Topic starter

  • Frequent Contributor
  • **
  • Posts: 402
  • Country: gb
    • Circuit & PCB Design (small PCB quantities OK)
Re: Value for money rotary encoder?
« Reply #3 on: August 19, 2019, 01:19:38 pm »
Thanks all.

It is good to know of a "value for money supplier" more stable than eBay, a known make too.

I'm currently using firmware incorporating the very neat 'mkesc' code as part of its design.


What do you use for pulse cleanup? I found the Bournes RC circuit not so useful, and am using one which recognises the fact that 'noise' = brief signals opposite to switch closed level.

That is, for an open switch I do not expect much in the way of spurious closed contacts. However, for a closed swich, the scraping will joggle the wiper to open-circuit in an erratic, noisy manner.

Thus far, I have found the attached RC network to be better than that on the PEC11 datasheet.


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf