Go Down

Topic: Mouse Scroll Wheel Encoder to Arduino (Read 9820 times) previous topic - next topic

rency0722

And seriously, can I debounce it by getting the encoder0Pos value and then if the last is not equal to current minus 1 (for clockwise-increasing) or current plus 1 (for C/CW-decreasing value)... something like that...

retrolefty

#16
Aug 16, 2011, 07:07 pm Last Edit: Aug 16, 2011, 07:08 pm by retrolefty Reason: 1
Quote
Is it possible to debounce the encoder just like a pushbutton switch? if ever?


Possible, contact debouncing is either done with hardware using external resistor/caps or in software using delays. but I can't tell you specidic hardware values of caps and resistors or how to wire it up. And software delay() doesn't work inside of ISR routines because all interrupts are disabled at that time.

Not sure what further help I can give you. I first played around with a cheap mechanical encoder switch a couple of years ago and never was happy with it's performance. I finally found a cheap optical encoder at a surplus dealer and that worked great.

Dealing with contact bounce and using interrupt inputs is a difficult task at best.

Lefty

rency0722

Oh I see... so its quite a hard task to debounce this dumb mech encoder... i'm now wondering where will I get a mouse that has an optical encoder with it.. geez...

To my desperation, I got to have it ordered online since I'm from the Philippines. Here, they don't have any rotary encoders for mouse scroll wheels.

Can you suggest where can I get one on your place, so I can place order online or through my close relatives abroad? It was a bad decision but for good since I got to have it working by the end of this week.

retrolefty

Quote
i'm now wondering where will I get a mouse that has an optical encoder with it.. geez...


Not a clue. I would suspect most mouse descriptions wouldn't state what kind of encoder their scroll wheel uses?

rency0722


Quote
i'm now wondering where will I get a mouse that has an optical encoder with it.. geez...


Not a clue. I would suspect most mouse descriptions wouldn't state what kind of encoder their scroll wheel uses?



yes.. and its hard to buy mice without knowing that it doesn't have an optical encoder in it.. argh. fail mechanical encoder..

by the way, I read again Steve Kamerman's blog (http://www.stevekamerman.com/2010/12/understanding-a-mouse-scroll-wheel/) and he used his dumped Microsoft Mouse...

EmilyJane

Quote
i'm now wondering where will I get a mouse that has an optical encoder with it.. geez...


There may be some reason why you have to disassemble a mouse to get an encoder but you could just buy one outright:

http://dkc3.digikey.com/PDF/US2011/P2364.pdf

rency0722

Here's what we did:

Since we dumped using the mechanical encoders that come from mouse scroll wheel, we've tried to have a gear that is connected to the scroll wheel's body.

The gear has 24 punched dots right around it, simulating 24 detents on the mechanical encoder, so it has grills on it. It has a laser pointer pointed on the gear with dots and has phototransistor in the other end. We've made an optical encoder out of it! :)

And here's the next problem, how can we now go into our new program? Can you give me a good code that counts when it detects light into the phototransistor as the wheel rotates clockwise? Thanks.

Go Up