Forum 2005-2010 (read only)
Rotary encoder woes!
Topic: Rotary encoder woes!
(Read 1 time)
Rotary encoder woes!
Jun 30, 2010, 07:03 pm
I've been fiddling about with a rotary encoder and my Arduino with pretty hopeless results. I've done plenty of Googling and tried various different approaches including the basic one detailed in the Playground page for rotary encoders, using interrupts and a very clever one that used some analog pins and some seriously indecipherable code!
The various problems I've been having include detection in one direction only, no response at all, too many turns needed than is practical and of course some horrendous bouncing!
First of all it's worth saying that the encoder I've used may well be rubbish or even faulty. It was salvaged from a dead Akai Sampler. So I've ordered an Alps STEC12E08 which is specifically named in some examples as working well and hopefully that'll be Ok.
We'll see but first a few questions.
1. Is the use of cheap mechanical rotary encoders just a nightmare full stop or can I expect to get good results if applied properly?
2. Should I be hardware debouncing even if the example code I use attempts to debounce in software?
3. If so then what do I use for hardware debouncing?
4. I'm using the rotary encoder only as a user interface device to scroll through and select a series of values on an LCD. I don't care about it's position only whether it turns left or right. If it does I want to effectively trigger an "event" and allow the software to increase or decease a value accordingly. Many of the code examples I've seen seem more complex than this. What's the best approach for this simple task?
Location: Manchester (England England)
Solder is electric glue
Re: Rotary encoder woes!
Jun 30, 2010, 07:29 pm
1) Yes the two knobs on this project are both very cheap mechanical rotary encoders used without interrupt.
2 / 3) Yes I would, I have used this:-
Although you can just use the capacitors the Schmidt input inverters clean things up and the 74LS74 gives you simple step and direction pulses without any software at all.