Welcome, Guest. Please Login.
Surveyor Corporation Surveyor SRV-1
Home Help Search Login

Surveyor Robotics Forum

Welcome to the user support forum for Surveyor SRV-1 robots, SRV-1 robot controllers and SVS stereo vision systems. To register for this forum, please send an email to support@surveyor.com which includes your desired forum user name, your registration email address, and a brief explanation of why you wish to join, and we will create a forum account for you.

Please note that there is a Search button in the forum toolbar for forum topics. Another effective search method for the entire surveyor.com site is to use Google, e.g. "xyz site://www.surveyor.com" where "xyz" is the search topic.



Pages: 1 2 3 4 5 
Send Topic Print
Adding optical mouse sensor for dead reckoning (Read 53844 times)
Lefteris
Senior Member
****




Posts: 274
Re: Adding optical mouse sensor for dead reckoning
Reply #30 - 08/17/08 at 11:08pm
 
Hello all, I think I have ruled out the possibility of the wire being the problem of reading since I dumped the PS/2 wire of the mouse which was quite long and used some small jumper wires for the connection. Still no luck with reading from the sensor though.  Smiley
 
I have mounted it on the robot with velcro for now, it can keep it on and the robot can move with the sensor mounted in a normal(not very rough) surface. For later I will be looking for someting more permanent for mounting ... such as gluing it on with silicon ... or making some small holes to the chassis and mounting it on with bolts and nuts.

 
The problem with how it is now is that I will need something on the far edge of the sensor's chip to keep it a little lower. I mean some kind of weight ... something to make the edge of the chip(right where the sensor is .... ) one inch closer to the ground. Any idea what could be used for this?
In the next image I am showing you where I think such weights could be placed.
What could be used as "weights"?
 
If this is solved I think I will have the mounting on the SRV problem solved. The "small" remaining problem will be to figure out why I can't read from the sensor though ... but .. anyway! Smiley
 
Back to top
 
« Last Edit: 08/17/08 at 11:11pm by Lefteris »  

http://www.realintelligence.net - The real intelligence project || http://lefteris.realintelligence.net - My blog
  IP Logged
Lefteris
Senior Member
****




Posts: 274
Re: Adding optical mouse sensor for dead reckoning
Reply #31 - 08/25/08 at 12:36am
 
Okay I came back around to messing with the robot. I took some time off to write the chapters of the thesis thinking I would come back and look at the problem with a fresh mind but I guess I was wrong.
 
Still I can find no logical explanation as to why the hell I can not read from the sensor but at the same time I can write to it. Adn the problem is that I do have some kind of deadline and being stagnant like this really does not help me. Maybe I should scrap the optical sensor altogether. I am not sure. Anyone managed to interface such a sensor with the SRV?
 
To make matters worse out of the blue my source code does not compile. I get the error:
 
make: ldr.exe : command not found. Error 127
At this point of the compile : ldr.exe -f -T BF537 -c srv1-c.ldr srv1-c.bin , creating the loader.
It worked at the end when I wrote that last line of code by hand into the console. Super strange ...
I changed nothing in the makefile nor in the directory. Suffice to say that ldr.exe is already in there. I did not remove it ofcourse. Everything has to go wrong, doesn't it? Sad
Back to top
 
« Last Edit: 08/25/08 at 12:42am by Lefteris »  

http://www.realintelligence.net - The real intelligence project || http://lefteris.realintelligence.net - My blog
  IP Logged
NickK1066
Senior Member
****




Posts: 299
Re: Adding optical mouse sensor for dead reckoning
Reply #32 - 08/25/08 at 3:15am
 
If you've installed something it could have altered the search path for executables.
 
Back to top
 
 

  IP Logged
Lefteris
Senior Member
****




Posts: 274
Re: Adding optical mouse sensor for dead reckoning
Reply #33 - 08/25/08 at 4:06am
 
yes I did indeed install some programs since then but it is quite strange since I thought that LDR = ldr.exe in the makefile meant to search for ldr.exe in the same directory the makefile is.
 
I guess this was not the case. Which search path was altered? I changed the makefile from LDR = ldr.exe to LDR = ./ldr.exe and it worked fine. But I am not sure which path got changed.
 
Still that is not the true problem I have, this is but a small discrepancy, the real problem is this darn optical sensor. I can't see how to make the blackfin read from the sensor's registers. The code is very very simple , I have checked it again and again every day but it does not seem to be wrong.
Back to top
 
 

http://www.realintelligence.net - The real intelligence project || http://lefteris.realintelligence.net - My blog
  IP Logged
henryhallam
Junior Member
**




Posts: 76
Re: Adding optical mouse sensor for dead reckoning
Reply #34 - 08/25/08 at 7:24am
 
The datasheet for the ADNS-2610 says that it's a 5V part, and you have the data line connected to an ordinary GPIO pin on the Blackfin (PH15) which is not 5V-tolerant.  According to the datasheet (http://cp.literature.agilent.com/litweb/pdf/5988-9774EN.pdf page 8 SDIO pin Output high voltage) the pin will output a *minimum* of 0.8*5 = 4V.  The Blackfin is only designed to handle inputs of up to 3.3V, with 3.6V as an "absolute maximum".  So.. you might have blown up that pin on the Blackfin.  Inside the Blackfin is a clamping diode from the pin to the 3.3V rail, which should stop the actual voltage on that pin rising above about 3.6V when it is connected, but a high current will flow and could have destroyed the input driver circuit.
 
As a test, disconnect the mouse.  Connect PH15 first to 0V, then to 3.3V, and see what the Blackfin reads.  If it reads the same value then this is the problem.
 
It's quite easily fixed with two resistors and a Zener diode.  Connect the anode of a 1N4620 Zener diode to ground.  Connect a 2.2k resistor from the cathode to the Blackfin GPIO pin (obviously use a different pin if you've blown up PH15) and another 2.2k resistor from the cathode to the ADNS-2610 SDIO pin.
 
Back to top
 
« Last Edit: 08/25/08 at 7:29am by henryhallam »  
hhchicken2   IP Logged
Lefteris
Senior Member
****




Posts: 274
Re: Adding optical mouse sensor for dead reckoning
Reply #35 - 08/25/08 at 7:43am
 
Thanks for the advice henry but if the pin was blown up shouldn't I be unable to write to the sensor too? I can still use PH15 to write to the sensor. I am using PH15 as data dual-way line and PH14 as clock.
 
So it might still be functional but the blackfin can't handle the 5V? I will do the pin test when I get back and will try and fix it. I so so so so SO much hope that will be the thing to correct everything and allow me to read. Problem is I had the same exact problem with the Atmega8 but Atmega can handle 5V. I guess I will have to go back and try it.  
 
Thanks again for the advice. Will post back with the results.
Back to top
 
 

http://www.realintelligence.net - The real intelligence project || http://lefteris.realintelligence.net - My blog
  IP Logged
henryhallam
Junior Member
**




Posts: 76
Re: Adding optical mouse sensor for dead reckoning
Reply #36 - 08/25/08 at 8:37pm
 
It's quite possible for the input driver to be damaged or destroyed while the output driver is still functional.
 
I hope that does solve the problem.  If it doesn't, don't give up.  The learning curve is steep at first but in a few months you'll be a hotshot embedded troubleshooter Smiley
 
Another possibility is that the sensor IC is damaged somehow - does the mouse still work when connected to a computer?
Back to top
 
« Last Edit: 08/25/08 at 8:47pm by henryhallam »  
hhchicken2   IP Logged
Lefteris
Senior Member
****




Posts: 274
Re: Adding optical mouse sensor for dead reckoning
Reply #37 - 08/26/08 at 1:53am
 
Thanks for the encouraging words henry. I tested the pin and it seems to be okay. It can read both 3V and GND as 1 and 0 respectively. I then proceeded to add the zener as you suggested. What I got is something like this circuit :
 

 
The difference is that I have got another R1 from the diode's cathode to the 3V logic in and that R1 is 2.2K Ohm.
 
The problem now? While previously everything I read used to be FF , hence all 1 now everything I read seems to be 0. I tried to measure with a voltmeter but ofcourse the time between writes and reads are so small that the voltmeter can't catch them. I see very small fluctuations of 0 to 1.4 V , but that has to be the blackfin sending out the register's address and not the sensor responding. I will try to experiment until I get some new idea.
 
As for the sensor's ic I can not check if it functions as a mouse anymore since I have removed the mouse's microcontroller :p
Back to top
 
 

http://www.realintelligence.net - The real intelligence project || http://lefteris.realintelligence.net - My blog
  IP Logged
Lefteris
Senior Member
****




Posts: 274
Re: Adding optical mouse sensor for dead reckoning
Reply #38 - 08/26/08 at 2:21am
 
Actually something does not seem right. I measured with a voltmeter the voltage that seems to be reaching the sensor and it seems to go to 1.6 V maximum. I don't think this was supposed to happen. Maybe I made a mistake at the connection.
 
I can still write to the sensor's registers but it is strange. I should not have been able to. I mean ADNS2610 datasheet says input high voltage minimum is 2V. Very strange. For that same reason the blackfin might not be seeing the voltage rising and lowering as logical 1s and 0s but only 0s ... since as I said that is the only thing I read.
 
This is a picture of how it looks:

 
Maybe somethign wrong with the connections?
Back to top
 
 

http://www.realintelligence.net - The real intelligence project || http://lefteris.realintelligence.net - My blog
  IP Logged
spikey
YaBB Newbies
*




Posts: 43
Re: Adding optical mouse sensor for dead reckoning
Reply #39 - 08/26/08 at 2:58am
 
You could try using a voltage level shifter such as PCA9306
Back to top
 
 
  IP Logged
NickK1066
Senior Member
****




Posts: 299
Re: Adding optical mouse sensor for dead reckoning
Reply #40 - 08/27/08 at 12:26pm
 
I've just found an old Logitech MX mouse I thought I'd thrown away. After digging out the optical sensor I found this: http://www.oru.se/oru-upload/Institutioner/Teknik/Dokument/Exjobb%202004/rapport 21.pdf
 
I can't believe someone basically reverse engineered a mouse optical sensor for their Masters thesis (A2020) when the chips are easily available (A2030+)..
Back to top
 
« Last Edit: 08/27/08 at 12:33pm by NickK1066 »  

  IP Logged
Lefteris
Senior Member
****




Posts: 274
Re: Adding optical mouse sensor for dead reckoning
Reply #41 - 08/28/08 at 7:11am
 
Kind of a strange thesis that one. I recognized many of the diagrams coming from the ADNS2610(might be the same for the whole family of sensors) datasheet.
 
I come bearing good news! Today I managed to read from the sensor at long last. The problem is I am not 100% sure what did the trick. It can have been two things mainly. I changed many PortH pins , tried another mouse's sensor, checked the circuit of the mouse thorougly e.t.c.
 
But what I think did the trick was : Reducing the waiting time between the register's adress and the data sent by the sensor. The datasheet said at least 100us (100us min ) . And since the datasheet said so I never questioned it. I dropped it at 80us. It then worked like a charm. Could have been only this change or some changes I made on the sensor's circuit ( connecting the wires directly to the sensor IC instead of a nearby pin.
 
The 2 main registers I am now interested in are ofcourse DeltaX and DeltaY (and finding a nice way to mount the sensor on the SRV). In the datasheet it says that the register contains :
Data Type: Eight bit 2’s complement number.
 
Which means? It has a small diagram in there from which I can not make much sense. Bits 7-6-5-4 are for the negative change in X/Y and Bits 3-2-1-0 for the positive?
Back to top
 
 

http://www.realintelligence.net - The real intelligence project || http://lefteris.realintelligence.net - My blog
  IP Logged
spikey
YaBB Newbies
*




Posts: 43
Re: Adding optical mouse sensor for dead reckoning
Reply #42 - 08/28/08 at 7:31am
 
Here's the definition of two's complement form
 
Basically bit 7 (the left most) represents wether the number is positive or negative (0->positive, 1->negative)
If the number is negative it's counted "backwards":
 
-1 = 1111 1111
-2 = 1111 1110
-3 = 1111 1101
and so on...
to convert a negative 2's complement number to a positive number, just subtract 1 and invert it.
Back to top
 
 
  IP Logged
Lefteris
Senior Member
****




Posts: 274
Re: Adding optical mouse sensor for dead reckoning
Reply #43 - 08/28/08 at 7:49am
 
Oh that's two complements. I see , I see I am used to the greek definition. Yep I know that form, thanks for pointing it out spikey. Should have googled >_< ,
Back to top
 
 

http://www.realintelligence.net - The real intelligence project || http://lefteris.realintelligence.net - My blog
  IP Logged
henryhallam
Junior Member
**




Posts: 76
Re: Adding optical mouse sensor for dead reckoning
Reply #44 - 08/28/08 at 7:52am
 
In C, declare a variable of type char and it should "just work" - the Blackfin, like most processors, stores negative numbers internally in 2's complement form.
e.g.
char deltaX, deltaY;
deltaX=readMouseRegister(some_address);
deltaY=readMouseRegister(some_other_address);
printNumber(10,4,1,' ',deltaX);
printNumber(10,4,1,' ',deltaY);
 
 
You'll also need to slightly change the declaration of printNumber in uart.c and uart.h, change "unsigned int number" to just "int number".
Back to top
 
 
hhchicken2   IP Logged
Pages: 1 2 3 4 5 
Send Topic Print