| Electronics > Projects, Designs, and Technical Stuff |
| Value for money rotary encoder? |
| (1/1) |
| 741:
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. |
| rhodges:
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. */ --- End quote --- |
| ehughes:
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. |
| 741:
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. |
| Navigation |
| Message Index |