Pages: 1 [2]   Go Down
Author Topic: Mouse Scroll Wheel Encoder to Arduino  (Read 6875 times)
0 Members and 1 Guest are viewing this topic.
Quezon City, Philippines
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Philippines' Digital TV Advocate
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Left Coast, CA (USA)
Online Online
Brattain Member
*****
Karma: 331
Posts: 16468
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: August 16, 2011, 12:08:38 pm by retrolefty » Logged

Quezon City, Philippines
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Philippines' Digital TV Advocate
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Left Coast, CA (USA)
Online Online
Brattain Member
*****
Karma: 331
Posts: 16468
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Quezon City, Philippines
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Philippines' Digital TV Advocate
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Dallas, Texas
Offline Offline
God Member
*****
Karma: 0
Posts: 861
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Quezon City, Philippines
Offline Offline
Newbie
*
Karma: 0
Posts: 20
Philippines' Digital TV Advocate
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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! smiley

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

Pages: 1 [2]   Go Up
Jump to: