Pages: 1 [2]   Go Down
Author Topic: Ways to improve optical mouse sensor tracking  (Read 3330 times)
0 Members and 1 Guest are viewing this topic.
Montreal
Offline Offline
Faraday Member
**
Karma: 29
Posts: 2590
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Optics fast enough to transmit 100 GB/s over optical cable, something wrong with your hardware configuration. Can you post your schematic/drawings?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am not sure the optics network guys use exactly the same photocells as I do...

I attach the diagram, hope it is clear enough.

The code is:

Code:
int PinA = 2;
int PinB = 3;
int Last = 0;
int n = 0;
unsigned long timeold;
int delta;
int distance;

void setup() {
Serial.begin(9600);
digitalWrite(A2, HIGH);
digitalWrite(A3, HIGH);
timeold = millis();
}

void loop(){
 
n = (analogRead(PinA) > 505);
if ((Last == 0) && (n == 1)) {
if (analogRead(PinB) > 500) {
distance++;
delta =  millis() - timeold;
timeold = millis();
}
else
{
// reverse
}
}
if (n == 1) {
Last = 1;
}
else
{
Last = 0;
}
Serial.print (analogRead(PinA));
Serial.print ("/");
Serial.print (analogRead(PinB));
Serial.print ("/");
Serial.println (delta);
}


* Bike_optics.jpg (36.88 KB, 701x882 - viewed 19 times.)
« Last Edit: July 27, 2011, 02:12:06 am by Jabberwock » Logged

0
Offline Offline
Shannon Member
****
Karma: 206
Posts: 12169
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You must use photodiodes or phototransistors.  LDRs are incredibly slow.
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I use this:

http://nettigo.pl/product/Fotorezystor,photocell#

Is this the slow kind?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Great news for a change!

Hall sensors and magnets work perfectly! No skipping, no delay, no need for debouncing. They are so precise I just placed two sensors next to each other and I can detect the change of direction with just one pass of a magnet...

I've placed eight magnets around the wheel (the glued encoder chart from the previous solution was quite useful for this smiley ). I think I could do even sixteen, but for now this is good enough - the time between the pulses is below 100 ms, which is comparable to analog game controllers.

Funny thing is, I've almost had another solution - I've recovered an IR phototransistor and emitter from an old mouse and wanted to count the teeth on the wheel. I've got the wiring part all done when the magnets have arrived...

Anyway, thank you all for invaluable help, I've learned heaps doing this!
Logged

Pages: 1 [2]   Go Up
Jump to: