geekhack

geekhack Marketplace => Great Finds => Topic started by: The_Ed on Wed, 05 June 2013, 22:52:17

Title: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Wed, 05 June 2013, 22:52:17
:llama: http://www.kickstarter.com/projects/1034145369/high-speed-laser-optical-sensor (http://www.kickstarter.com/projects/1034145369/high-speed-laser-optical-sensor) :llama:

If you have an old trackball that needs a DPI boost, then you're in luck right now. The Avago ADNS-9800 is an 8200 DPI laser module that is used in a lot of high end gaming mice right now. It just has to be connected to a teensy to work. I plan to mod a Microsoft Trackball Optical with the one I ordered.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 4 days left]
Post by: dorkvader on Thu, 06 June 2013, 11:23:13
:llama: http://www.kickstarter.com/projects/1034145369/high-speed-laser-optical-sensor (http://www.kickstarter.com/projects/1034145369/high-speed-laser-optical-sensor) :llama:

If you have an old trackball that needs a DPI boost, then you're in luck right now. The Avago ADNS-9800 is an 8200 DPI laser module that is used in a lot of high end gaming mice right now. It just has to be connected to a teensy to work. I plan to mod a Microsoft Trackball Optical with the one I ordered.
Excellent! I have a few opto-mechanical trackballs that I would like to modify like this.

Does Teensy code exist to control the sensor? I don't know any programming, so I fear making it myself will be beyond my skill.

Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 4 days left]
Post by: alaricljs on Thu, 06 June 2013, 11:32:15
As far as a I can tell there is an extremely simple Arduino sketch that can run on the teensy linked to from the page.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 4 days left]
Post by: The_Ed on Thu, 06 June 2013, 11:42:57
There is a test trackball code on github for it. I will have to modify it to have adjustable levels of DPI, and work with the other 4 mouse buttons. But first I'm gonna have to learn how to do that...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 4 days left]
Post by: metalliqaz on Thu, 06 June 2013, 11:49:14
Very interesting indeed.  Not sure what I would do with it, though
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 4 days left]
Post by: alaricljs on Thu, 06 June 2013, 11:53:43
I use a TrackMan Marble... I would very much like to improve the tracking/DPI :)

Of course this basically means building a work-alike replacement, not just swapping in parts.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 4 days left]
Post by: The_Ed on Thu, 06 June 2013, 11:59:50
It should be just as easy as swapping the internals and programming it. Why would you have to build a "work-alike replacement"?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 4 days left]
Post by: alaricljs on Thu, 06 June 2013, 12:04:59
I've been inside, there's not that much space for that sensor, it's bigger.  Then add in the teensy and what not.  Then also I could make the outer casing more comfy for my hand, another good excuse.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 4 days left]
Post by: The_Ed on Thu, 06 June 2013, 12:23:23
I may have to flatten some sides of the PCB to make it work in my Microsoft Trackball Optical (There shouldn't be any traces at the edge right?).
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 4 days left]
Post by: alaricljs on Thu, 06 June 2013, 12:26:12
You may be able to separate the sensor PCB from the round one he put together with the necessary caps and so forth.  I don't know how integral that is to the lens assembly.  That would shrink things down nicely in one dimension.  The pins on the sensor PCB can't be bent because they apparently have something to do with the lens assembly distance as far as I can tell.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 4 days left]
Post by: dorkvader on Thu, 06 June 2013, 13:19:42
fwiw, there's tons of room in all the ITAC trackballs I'm proxy-selling for another GH'er here.

The CST looks like it has plenty of room, too, though you'll have to mount the sensor sideways on a little stand, or cut a hole for it in the bottom of the casing. Either is a good solution for me.

I sort-of want to build a mouse out of this with a teensy, some hall effect switches, etc. (or cherry, if the HE proves to be too tall.)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 4 days left]
Post by: The_Ed on Thu, 06 June 2013, 13:44:04
I'm not really worried about it fitting, I'll just MAKE it fit. I'm worried about being able to modify that code to my needs. I've never coded for hardware before, just website languages and C++. That teensy code looks similar to C++, so I understand some of it at least.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 4 days left]
Post by: dorkvader on Thu, 06 June 2013, 16:51:18
I'm not really worried about it fitting, I'll just MAKE it fit. I'm worried about being able to modify that code to my needs. I've never coded for hardware before, just website languages and C++. That teensy code looks similar to C++, so I understand some of it at least.

It's going to be you and I in this together. I dont' know any coding at all, but I'm happy to help test. I have a few trackballs I'd like to put this in, but there's one in particular that I think I will use (it also has lots of room underneath for a whole PCB.)

Do you think there's any way to combine the optical reading teensy code with a "small keyboard matrix" reading code? said trackball also has a tenkey on it, and I would love to get it working with one one USB device.

Anyway, I'll join this kickstarter once I have internet again and we can make a MST topic about the build process.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 4 days left]
Post by: metalliqaz on Thu, 06 June 2013, 17:20:00

Do you think there's any way to combine the optical reading teensy code with a "small keyboard matrix" reading code? said trackball also has a tenkey on it, and I would love to get it working with one one USB device.


Absolutely.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 4 days left]
Post by: The_Ed on Thu, 06 June 2013, 21:21:13
The trackball motion, DPI stages (5-8 should be good), mouse buttons, and keyboard buttons should all be possible with the right code. Hell even macros and layers should be possible as well.

I will be using a teensy 3.0 to keep up with the times. Will you be using the 3.0 as well dorkvader?

It's good that I'm not gonna have to figure out the code alone. How many trackballs are you thinking of modding dorkvader?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 4 days left]
Post by: The_Ed on Thu, 06 June 2013, 22:04:21
It seems like I'm gonna have to contact Avago to get their C8051F347 Firmware... That way we will have a bunch of stuff coded already, and just have to change it to our needs. From the PDF's I can find it looks like it already has dpi and liftoff changing button code. Do you think they'll give it to me?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 3 days left]
Post by: alaricljs on Thu, 06 June 2013, 22:39:41
Maybe ask John if he has it available?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 3 days left]
Post by: blueSmoke on Thu, 06 June 2013, 22:42:56
Is this for a mouse? If so, hew do you reverse/switch the Y-axis for a trackball?

Software? Hardware?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 3 days left]
Post by: blueSmoke on Thu, 06 June 2013, 22:45:15
Kickstarter? by John Kicklighter? is that a real name? interesting...

that rhymes.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 3 days left]
Post by: blueSmoke on Thu, 06 June 2013, 22:51:18
Is this for a mouse? If so, hew do you reverse/switch the Y-axis for a trackball?

Software? Hardware?

Never mind. He shows a trackball in the demo. So it is possible. Only issue may be side mounting in trackballs that have large balls and need to be side mounted as well as the adjustment algorithm. We will see...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 3 days left]
Post by: alaricljs on Thu, 06 June 2013, 22:56:37
Avago's own docs say mouse/trackball.  Haven't even bothered figuring out how to switch the axis since the example was of a trackball, it can't be that hard.

ed: Time to reload tabs before I read them... going a little slow this late at night.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 3 days left]
Post by: The_Ed on Thu, 06 June 2013, 23:04:00
ed: Time to reload tabs before I read them... going a little slow this late at night.

What? I don't understand...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 3 days left]
Post by: alaricljs on Thu, 06 June 2013, 23:09:47
late night lazy - ed == edit
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 3 days left]
Post by: MrJohnK on Thu, 06 June 2013, 23:40:35
Flipping the axis (X or Y) is easy.  Just multiply the value retrieved from the SPI port by -1.  That is how I did it in the video.

-JK
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 3 days left]
Post by: dorkvader on Fri, 07 June 2013, 00:14:44
Flipping the axis (X or Y) is easy.  Just multiply the value retrieved from the SPI port by -1.  That is how I did it in the video.

-JK

Welcome to geekhack and thanks for posting.  For what its worth I can't help code at all. I will buy whatever teensy works best for this and ill want to mod at least two trackballs with this. Maybe I'll get a good arcade trackball or a penny and files and mod That as well.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 3 days left]
Post by: MrJohnK on Fri, 07 June 2013, 00:33:16
I don't mind at all to help you out on the programming side as it relates to a Teensy 2.0.  I can donate what is already up on Github as well as my full implementation of the trackball I made with all the bells and whistles.  I don't mind sharing.

As for mod'ing existing trackballs, my old trackman marble wheel remains intact as it was in the early '90s when I bought it.  I didn't see any great way to mod it for adding a new sensor to it.  As was noted earlier in this thread, this sensor does require more room than I saw available in the existing body.  I ended up printing an entirely new trackball body of my own design to get what I wanted.  I look forward to seeing how creative people can be by ripping out the guts of their existing trackball and equipping it with a new high-resolution sensor. 

JK
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 3 days left]
Post by: The_Ed on Fri, 07 June 2013, 19:34:15
I don't mind at all to help you out on the programming side as it relates to a Teensy 2.0.  I can donate what is already up on Github as well as my full implementation of the trackball I made with all the bells and whistles.  I don't mind sharing.

As for mod'ing existing trackballs, my old trackman marble wheel remains intact as it was in the early '90s when I bought it.  I didn't see any great way to mod it for adding a new sensor to it.  As was noted earlier in this thread, this sensor does require more room than I saw available in the existing body.  I ended up printing an entirely new trackball body of my own design to get what I wanted.  I look forward to seeing how creative people can be by ripping out the guts of their existing trackball and equipping it with a new high-resolution sensor. 

JK

Did you write the entirety of that code on github? Which pins did you use on the teensy 2.0? I wonder if the same pins work for the 3.0. It would be cool if you could explain the code on github in its entirety.

Do you have a copy of the Avago C8051F347 Firmware that they supply to people who are going to make mice with their ADNS-9800 laser sensors? That way it should be much easier to change the code to my purposes since it already has code for:

the ADNS-9800 pointer movement
a scroll wheel
3 mouse buttons (I would add support for 2 more)
3 LEDs roughly indicating DPI (I would alter them to light up the socket when the mouse is being moved)
and 2 buttons to increment/decrement the DPI by 200 (they can also be used to increment/decrement the liftoff distance by 0.3mm) (I would alter it to change between 5-8 defined DPI levels)

(This is in the PDF sheet for Avago's C8051F347 Firmware Version 2.8 from 11JAN12)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 3 days left]
Post by: MrJohnK on Sat, 08 June 2013, 01:10:38
Indeed, I do have a copy of the C8051F347 files.  When I asked for it, they even sent me the source code, which surprised me.  Collectively, the chip refers to this as the "A4" code version.  I formatted the binary hex compiled file from the A4 firmware into the Arduino sketch there on my Github, so it is there for everyone to get. 

I didn't write all of the code that appears there, especially around the start-up procedures.  There were a couple of other copies of similar code already up on Github for both the ADNS-9500 and ADNS-9800 that I was able to adapt.  There is quite an elaborate set of hoops to jump through upon each startup in order to get the firmware uploaded and all the right ports reset and ready to run.

On the Teensy, you just connect up the four lines for the SPI port, which are 0, 1, 2, 3 (SS, SCK, MOSI, MISO respectively) along with power, ground and the interrupt line, which could be any one of pins 5, 6, 7 or 8 as they all handle hardware interrupt functions.  In the Arduino software, you just use the SPI standard library to interact with the chip.

The operation of the chip is relatively simple.  You attach an interrupt to one of the interrupt pins as "falling".  When that pin goes low, the interrupt routine runs that simply reads a specific register inside the chip.  This register contains the X and Y movement delta.  Once this is read, the interrupt line goes high again until motion is detected.  The X and Y delta data is in 2s complement format, so you'll need to convert that.  I wrote a little formula in my source code that does this.  Usually, you end up with a 1, -1 or 0 after you read that information.  That indicates how far to move the related axis.  Conceivably, you could receive a larger number, but I think the chip is so fast it reports just a string of 1s.  Those report faster the more you move the ball.

As for setting the resolution, there are 41 steps from the slowest resolution to the fastest.  I choose to make a capacitive touch button on my trackball that steps from one end to the other, one at a time so I can get just the right speed for any job from CAD work to gaming.  You could also just choose a few reasonable step values and tie those to physical buttons.  All you do is write a single hex value into a register on the chip to change the resolution on the fly.

Mouse buttons, keyboard strokes and scrolling can be handled with the Teensy and it's easy to use USB HID capability as a mouse and keyboard composite driver under any operating system.  It just works.  Paul at PJRC did an outstanding job with that.  I've not tried his Teensy 3.0 yet...I've only ever played with the 2.0 and 2.0++ versions. 

Hope that helps.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 3 days left]
Post by: The_Ed on Sat, 08 June 2013, 07:21:48
Indeed, I do have a copy of the C8051F347 files.  When I asked for it, they even sent me the source code, which surprised me.  Collectively, the chip refers to this as the "A4" code version.  I formatted the binary hex compiled file from the A4 firmware into the Arduino sketch there on my Github, so it is there for everyone to get.

Thanks for that explanation, that helps a lot. But in C++ there is a "Main ()" function that calls the rest of the voids when needed, so I don't understand how your code is called...

Are you saying that the "ADNS9800_SROM_A4.ino" file is the C8051F347 Firmware? So what firmware version 2.8 had all those features that I listed above in it's code?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: MrJohnK on Sat, 08 June 2013, 09:33:40
Since this is interrupt driven, the call to the subroutine that reads from the chip is not called from the main loop like most other subroutines.  Near the top of my source code, look at this statement:

attachInterrupt(0, UpdatePointer, FALLING);

Using this, you don't need anything in the main loop to get functionality of the chip.  The UpdatePointer subroutine calls each time the interrupt 0 pin goes low.  My code is an Arduino sketch, not C++.  In my full trackball code, my main loop is dedicated to scanning buttons to see if any of them have been pushed and dealing with those events.

When I asked for the firmware, they sent me the "A4" text file that just has a string of hex values, one per line.  Also included in their response was a folder named:
A5059M_NRD1101_V2_8_Full_Spd-1ms_hardwareSPI_9800_(with TCL N SROM hardcode)

Inside this folder is another subfolder labeled:
C8051F347

Inside of that is all the C source code.  I have not done anything with the source code.  I just took the A4 file they sent and reformatted that for my Arduino sketch and use that to upload to the chip each time it boots.  It works.  I'm not sure how I would go about cross compiling the source code for that chip as I'm not sure what architecture it uses.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: metalliqaz on Sat, 08 June 2013, 10:49:51
I jumped on this just to have one.  If I get project together I will make some proper firmware
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: The_Ed on Sat, 08 June 2013, 11:07:12
Since this is interrupt driven, the call to the subroutine that reads from the chip is not called from the main loop like most other subroutines.  Near the top of my source code, look at this statement:

attachInterrupt(0, UpdatePointer, FALLING);

Using this, you don't need anything in the main loop to get functionality of the chip.  The UpdatePointer subroutine calls each time the interrupt 0 pin goes low.  My code is an Arduino sketch, not C++.  In my full trackball code, my main loop is dedicated to scanning buttons to see if any of them have been pushed and dealing with those events.

When I asked for the firmware, they sent me the "A4" text file that just has a string of hex values, one per line.  Also included in their response was a folder named:
A5059M_NRD1101_V2_8_Full_Spd-1ms_hardwareSPI_9800_(with TCL N SROM hardcode)

Inside this folder is another subfolder labeled:
C8051F347

Inside of that is all the C source code.  I have not done anything with the source code.  I just took the A4 file they sent and reformatted that for my Arduino sketch and use that to upload to the chip each time it boots.  It works.  I'm not sure how I would go about cross compiling the source code for that chip as I'm not sure what architecture it uses.

Can I have your full code and everything they sent you? I need that C source code (it is for the C8051F347 chip that they use in the place that we are using a teensy).
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: MrJohnK on Sat, 08 June 2013, 12:10:52
Sure thing, I can send it along.  When I got it, I did ask them if I could distribute it to my customers.  They said that would be no problem.  Feel free to request copies via inet2xtreme{at}yahoo{dot}com. 

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: MrJohnK on Sat, 08 June 2013, 12:18:30
On a tangent to the source code, I wanted to get the opinion of the group regarding a small extra feature that one person requested that I'm working for this board.  I've got a prototype of this board coming that should allow you to operate it at either 3.3V or 5.0V.  It will have a set of solder bridges on the bottom to switch it from 3.3V to 5V to better accommodate just about any MCU situation.  The one currently featured works just fine at 3.3V only.  The 5V capability adds resister dividers on the SCK, MOSI and SS pin to level shift them down to 3.3V.  There is already an LDO regulator in the current design that will take care of the power up to 6V.

Does that sound like something you all would like to see?  It would not change the size of the board, but just take up some of that blank space and fill it with a few extra resistors.  Any negative implications you can think of?

Thanks.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: metalliqaz on Sat, 08 June 2013, 12:34:58
^ yes. want
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: alaricljs on Sat, 08 June 2013, 12:36:40
Color me confused, but if you're using a Teensy 2.0 or ++2.0 then you're already using it at 5v IO levels.  Have you just gotten lucky and not burnt it out?

Proper 5v support would be a really good idea for anyone using the Teensy 2.0/++2.0
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: MrJohnK on Sat, 08 June 2013, 12:46:02
Quote
Color me confused, but if you're using a Teensy 2.0 or ++2.0 then you're already using it at 5v IO levels.  Have you just gotten lucky and not burnt it out?

Proper 5v support would be a really good idea for anyone using the Teensy 2.0/++2.0

A Teensy can be converted for 3.3V operation by soldering a 3.3V LDO regulator onto the bottom of the board.  See below:

http://www.pjrc.com/teensy/3volt.html
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: alaricljs on Sat, 08 June 2013, 12:54:47
I always forget that part since I never use it.  So now I'm left wondering what use case 5v has, nothing I do is voltage sensitive.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: The_Ed on Sat, 08 June 2013, 14:21:16
I will send you an email for the code in just a sec, thanks!

What's the point of allowing it to work at 3.3v or 5v when anything between 3.3v and 6v is already converted to 3.3v with your current PCB? BTW the teensy 3.0 works natively at 3.3v if I remember correctly.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: alaricljs on Sat, 08 June 2013, 14:24:09
There's 2 different voltage considerations.  Power to the device (his 3-6v range)  and power level of the IO.  Right now the IO is at 3.3v and he is considering a 5v mod for IO.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: The_Ed on Sat, 08 June 2013, 14:28:00
Ah, so power to the laser will always be fine, it's the IO voltage to the controller that matters. A teensy 2.0/++ would have to be downclocked to work at 3.3v, but a teensy 3.0 would be just fine.

And now I must patiently await that source code...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: The_Ed on Sat, 08 June 2013, 16:31:28
Holy crap!... 77 files...

A good thing about being a student is that I can get ****loads of free licenses to software/operating systems. Time to fire up Visual Studio 2010 Ultimate for the first time this year.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: The_Ed on Sat, 08 June 2013, 18:24:43
My god... There is even commented out code for different purposes... This will take quite a while...

There are so many functions and variables... It's just a USB mouse, why the hell is there so much code?!

OK, so code in real life is WAY different than in books and class... Everything is shortened, so it is hard to follow...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: MrJohnK on Sat, 08 June 2013, 18:56:40
Good luck with that?  If you make something useful of it, let me know. 

Indeed, programming code from real programmers looks nothing like my professors taught me in college.  What you learn in college computer science classes lays a good foundation of the base concepts, but it is really fundamental compared to what is really out there in production work. 

I noticed a fair bit of assembler code in there along with the C code...interesting.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: The_Ed on Sat, 08 June 2013, 19:06:25
Good luck with that?  If you make something useful of it, let me know. 

Indeed, programming code from real programmers looks nothing like my professors taught me in college.  What you learn in college computer science classes lays a good foundation of the base concepts, but it is really fundamental compared to what is really out there in production work. 

I noticed a fair bit of assembler code in there along with the C code...interesting.

-John

I found where you got some of your code from - joshuajnoble

Arduino code is quite different than Avago's code.

Can you give/link me your full trackball code?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: The_Ed on Sat, 08 June 2013, 19:43:49
I think I'm gonna have to learn from the ground up with Arduino... I don't know enough of it to just copy/paste/alter and presto. Hopefully I have enough freetime to get it figured out before the sensor arrives. I think I'm done at looking at code for today... My head hurts... It's probably the white background...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: alaricljs on Sat, 08 June 2013, 20:01:46
Arduino is something of a wrapper language so that "sketches" can be added to each other to get a functional whole and run on different MCUs without intimate knowledge of the hardware.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: MrJohnK on Sat, 08 June 2013, 20:31:10
Quote
Can you give/link me your full trackball code?

The code running on the Teensy 2.0 in my current trackball is posted up to Github here:

https://github.com/mrjohnk/Trackball2

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: The_Ed on Sat, 08 June 2013, 21:14:16
Am I right in my thinking here?

"void setup()" runs and initializes everything.
"void loop()" then runs continuously.
When the ADNS-9800 senses movement it sends an interrupt.
"void loop()" is then paused and the mouse pointer is updated (moved).
"void loop()" is then resumed.

"void loop()" would contain (or call functions for) button pressing (including those to change DPI and liftoff distance), scrollwheel scrolling, and things with LEDs.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: MrJohnK on Sat, 08 June 2013, 21:18:09
Yep, that all sounds about right. 
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: The_Ed on Sat, 08 June 2013, 21:25:46
Yay! I'm not incompetent! Now that I know the structure, the next step is learning the code, and after that is coding what I need it to do.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: daerid on Sun, 09 June 2013, 11:48:55
If be all over this if it was an optical and not laser sensor
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: alaricljs on Sun, 09 June 2013, 13:35:51
Feel free to splain the difference ?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: dorkvader on Sun, 09 June 2013, 13:51:43
Feel free to splain the difference ?

He is talking about having an optical or led versus laser or laser diode there is some evidence suggesting laser mice are worse in some respects though I can't currently recall the specifics.

I forgot to buy this when I was at work and still had internet so well see how easy it is to use kickstarter from a phone.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: alaricljs on Sun, 09 June 2013, 14:27:39
I get that laser vs optical IS different... It's the how/why it matters that I was interested in :)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 2 days left]
Post by: The_Ed on Sun, 09 June 2013, 14:36:15
There are SOME people that say that laser sensors have a ~1.5% acceleration, but even if they do there is no way you'd be able to notice it and it wouldn't affect you.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 25 hours left]
Post by: The_Ed on Sun, 09 June 2013, 17:59:37
...

There are MULTIPLE versions of firmware for the ADNS-9800... A4, A5 (89), and A6...

I think I'm gonna use A6 because it is the newest version contained in the folder. It was made 31 days after A4, and thus it probably has any bugs fixed. Though it was still made in 11/21/2011... Maybe the computer was off by exactly a year because I didn't think these were produced in 2011. Or maybe they were, but not commercially released.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 18 hours left]
Post by: blueSmoke on Mon, 10 June 2013, 12:26:25
Anybody know how to pledge for more than one? Somehow I can't understand how this works. I just ordered one and find there is no way to select more than one. The only option is increasing the pledge amount in the 'manage pledge' screen, but does doubling the pledge amount make it two sensors?

I have 4 hours left. Hopefully somebody know about this... John?

thanks.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - 18 hours left]
Post by: alaricljs on Mon, 10 June 2013, 12:56:47
As John (the organizer) states somewhere in the KS verbiage, they took a stance of not allowing more than 1 buy-in to a specific reward.  There are work arounds, however John's method is:  If he get's more than $28 from any 1 individual he will "do everything possible to bring the most value to your complete contribution to this project"

So, if you hand over $56 I'm sure he'll either send along 2 sensors, or contact you for arrangements.  He also stated that he would be able to sell on further stock after the KS fulfillment.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Mon, 10 June 2013, 17:47:48
This has now ended and we are now playing the waiting game.

I will be using a teensy 3.0, and I am currently trying to code for:

Trackball and mouse movement
7 buttons (2 of them for changing the DPI)
Scrollwheel scrolling
LEDs that light up the ring around the trackball when it is moved
Liftoff distance
5-8 DPI levels
(And any others that I end up wanting later on)

I will release my code when it is done. Anyone can use it as is, or add any additional features they want.

I am gonna need 2 small mountable buttons that I can put microswitches in for the 2 DPI buttons. Anyone know where to look?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: metalliqaz on Tue, 11 June 2013, 00:16:55
What is liftoff distance?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Tue, 11 June 2013, 00:28:39
What is liftoff distance?

How far away the laser sensor is from the surface it is reading before it halts updating pointer movement. The ADNS-9800 has a cutoff distance from 1mm to 5mm in 0.3mm steps as far as I can tell.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: alaricljs on Tue, 11 June 2013, 09:15:23
What's the point of liftoff distance w/ a trackball?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Tue, 11 June 2013, 14:57:34
The ball socket is thick on the MTO, so the liftoff distance will likely have to be increased. The default is only 2.4mm if I remember correctly, so it won't work (at least for me) without changing the liftoff distance.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: MrJohnK on Sat, 15 June 2013, 16:51:04
Hey guys, I was out of town last week.  I'm back and had time to test the new revision that includes the 3.3V and 5.0V option today.  It works great at both voltages using a 5V and 3.3V Teensy 2.0.  I've still got a few pre-order spots left over at Tindie.Com until Monday the 17th for these if you want to get in on it.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Sat, 15 June 2013, 17:02:06
Hey guys, I was out of town last week.  I'm back and had time to test the new revision that includes the 3.3V and 5.0V option today.  It works great at both voltages using a 5V and 3.3V Teensy 2.0.  I've still got a few pre-order spots left over at Tindie.Com until Monday the 17th for these if you want to get in on it.

-John

Hey John, how many millimeter's is the PCB width and height (including the lens)?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: MrJohnK on Sat, 15 June 2013, 17:08:10
Using my desk calipers, I measured 31.55mm diameter and 8.4mm tall from the bottom of the lens to the top of the optical chip.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: alaricljs on Sat, 15 June 2013, 17:41:58
Is Tindie a good way to hop on a 2nd device after having already done the KS thing?  :)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: MrJohnK on Sat, 15 June 2013, 17:48:48
Yes, that is the idea.  I put a limit in it though to make sure I don't get too overwhelmed with orders.  There are about 27 shown in stock there at Tindie.  Overall price should be about the same.  The Kickstarter units included shipping and Tindie adds shipping after you put it in the cart.  These are still pre-orders and will be filled after the Kickstarter rewards go out.  I don't anticipate a long delay between both groups though.  After Monday, I'm closing the gates on all pre-orders until they are filled.  Afterwords, I plan to keep them in stock over at Tindie for the long haul.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: Bullveyr on Sat, 15 June 2013, 18:01:56
There are MULTIPLE versions of firmware for the ADNS-9800... A4, A5 (89), and A6...
The newest FW should also fix the smoothing/lag issue.

There are SOME people that say that laser sensors have a ~1.5% acceleration, but even if they do there is no way you'd be able to notice it and it wouldn't affect you.
It's more like 5%, easy to test for, A9800 didn't really improve in that regard over the A9500.
Certainly an issue for gaming but outside of that (especially with a trackball) much less problematic.
Ofc, saying "Laser has accel." is simplifying the whole thing.

The various performance parameters of a mouse sensor are a tricky thing.


And we are still pretty much on the same hardware as 10 years ago.


Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Wed, 03 July 2013, 14:31:13
I think it should be safe to split some 5v off from the VUSB pin on the teensy 3.0, or am I wrong on that? And if it is safe then do I have to make sure that the load drops the 5v to 3.3v or lower before going to the GND pin?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: MrJohnK on Wed, 03 July 2013, 14:38:13
I'm not quite sure what the goal is.  Looks like Teensy 3.0 is a 3.3v system.  The optical sensor has a voltage regulator on it to handle up to 6V and outputs 3.0V to feed the ADNS-9800.  Does that help or did I miss your point?

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Wed, 03 July 2013, 14:54:55
I am trying to get 5v to power other things. Take a look at the teensy 3.0 schematic below. It looks like I should be able to split some 5v off from the VUSB pin. If it is safe to do that then I also wonder if it will harm anything if a load doesn't drop the voltage down to at least 3.3v when going back to the GND pin. I personally think it will work just fine, but I'm just asking first so I don't make a stupid mistake.

(http://pjrc.com/teensy/schematic3.gif)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: MrJohnK on Wed, 03 July 2013, 15:09:52
It looks like that VUSB comes right off the 5V rail on the USB port, so that should be a good place draw some 5V power.  In the schematic, it shows that ahead of the 500mA fuse.  You should be able to pull up to about 1 amp or less out of that sort of arrangement.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Wed, 03 July 2013, 15:49:46
The 4 LEDs (1 DPI indicator, 1 liftoff indicator, 1 ball socket, and 1 ball socket [movement]) and scrolling up/down (which uses IR LEDs and sensors) are what will most likely need 5v to work properly. I don't have a 3.3v meanwell power supply yet (I should order that soon...), which means I can only do tests with my 5v meanwell.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: SeriouSSpotS on Wed, 03 July 2013, 15:53:11
Cool piece of kit.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Wed, 03 July 2013, 16:08:42
Cool piece of kit.

Yeah well I have to:

Source and order all the parts (some have already been ordered)
Get the 9800 and the rest of the parts to interface to a 3.3v teensy 3.0
Code everything to work both as a trackball and a mouse (trackballs don't need adjustable liftoff distance, but I'm putting it in there for other people)
Hook everything up outside the trackball to make sure it works
Remove a lot of plastic and try to cram everything inside
If everything cant fit inside I will likely have to extend the bottom with a thick piece of rubber with some cavities hollowed into it.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Fri, 05 July 2013, 03:09:00
I believe I will be the first person to use a ****ing toggle switch to change the DPI and liftoff distance on a mouse. I will be trying to mount it just ahead of the ball on the left side, and it will toggle horizontally as that will make it much easier to use. And ahead of it will be the 2 5mm RGB indicator LEDs. To change the toggle switch from changing the DPI to changing the liftoff distance both the forward and backward buttons will have to be held down simultaneously.

(http://www.allelectronics.com/mas_assets/cache/image/2/d/d/a/11738.Jpg)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: dorkvader on Fri, 05 July 2013, 04:06:26
Just remember to get a mom-on-mom switch to be easier to use.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Fri, 05 July 2013, 14:53:50
That specific toggle switch I linked is (on)-on-(on). It's SP3T! I never knew those existed until a few days ago.

(on) = momentary
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: dorkvader on Fri, 05 July 2013, 17:52:47
That specific toggle switch I linked is (on)-on-(on). It's SP3T! I never knew those existed until a few days ago.

(on) = momentary
All the SP3T toggle switches I know have the functionality through a customer installed jumper. What switch is it, if I may ask? it looks nice, such switches are usually in the $8-$10 range.

--Edit --
Wow, only $3!
http://www.allelectronics.com/make-a-store/item/MTS-79/DPDT-ON-ON-ON-MOMENTARY-TOGGLE-SWITCH/1.html
and according to the datasheet (http://www.allelectronics.com/mas_assets//spec/MTS-79.pdf) it does need a jumper for SP3T

I might get one, or several!
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Fri, 05 July 2013, 23:20:32
Yeah they need a jumper for SP3T mode, and they are only $2.75 apiece.

The info on allelectronics seems to be wrong on at least 1 count. According to C&K the toggle handle should be 0.84" long, not 0.76".
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: wcass on Fri, 05 July 2013, 23:25:22
i am coming to this thread late. i want one with the 5v option. it would go well as the sensor for this project:
http://deskthority.net/workshop-f7/custom-trackball-t4773.html

the keyboard uses a teensy with Soarer's code for matrix translation - should be able to combine the code ... right?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Fri, 05 July 2013, 23:34:36
I will make teensy 3.0 code available when I've completed it. It will work for both trackballs and standard mice. A few values will have to be changed by the end user for their specific application, but there will be notes for those sections.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Tue, 09 July 2013, 03:54:07
I think a ULN2803 using the VUSB pin as it's 5V power should make the LEDs work with the teensy 3.0. Teensy PWM is 256hz 488.28hz, and I assume that should work just fine with a ULN2803. Can anyone think of a reason that it wont work before I order some ULN2803 ICs?

It's stupid that the teensy 3.0 is 3.3v, that's too low for a lot of things to interface without a logic level converter in-between. Or in the case of LEDs a transister IC like the ULN2803 because of the higher current needs.

I wonder how much the final modded trackball will have cost me once I'm done... And how much taller it'll have to be to accommodate all the parts...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Tue, 09 July 2013, 22:54:12
Keith says my epoxy resin trackballs are finally being shipped to him from Belgium. I wonder how much my credit card is going to be charged when he ships them to where I used to live... Just the product price for 3 of them is $39.84, and shipping prices have gone up dramatically...

Almost all of the parts have been decided upon at this point. A LOT of teensy pins are needed... I believe some of those pin pads on the back of the teensy 3.0 will have to be used...

EDIT: $63.43 just showed up on my credit card. So it looks like $23.59 to ship them from Belgium to Keith, and then from Keith to me. I wonder when they'll arrive, he hasn't sent a tracking number yet.

EDIT2: They arrived?!!

(http://i.imgur.com/8fHBcgy.jpg)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: MrJohnK on Fri, 19 July 2013, 14:38:22
Nice balls Ed. 

While stumbling around Google trying to find out more about what an ADNS-9818 is, I found a link to a PDF that had some information regarding what is required to compile the firmware, such as what compiler it is made for (see below).

http://www.avagotech.com/docs/AV02-3326EN

Anyone know what an ADNS-9818 model is?  My guess is it is the same as the ADNS-9800, but just a specific part number for a manufacturer as it seems to have the same specs as far as I can tell.

I managed to get about a dozen of these sensor boards put together and tested last night.  The PCBs finally showed up a couple of weeks late, but at least they are here and things can start moving forward.  I hope to have the rest of them together this weekend and off to their homes early next week as long nothing unforeseen comes up.

-John

Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Fri, 19 July 2013, 20:27:48
Firstly, where did you get those trackballs? I looked around, and all I could find in 2.125" were some steel ones from iowa. Ideally, I'd be able to get some excellent ceramic or hard polymer or something.

The epoxy resin trackball balls are from Belgium (Keith will hook you up, but only certain sizes are available). The 316 stainless steel and 52100 chrome steel trackball balls are from a guy on ebay (toolsupply). To work as a trackball ball their "grade" has to be 100 or lower (lower is better).

Secondly, what trackball are you modifying again? I'm trying to figure out exactly which of my trackballs I'd modify. I'm leaning towards an old kensington, as it has good ball bearings, but my best trackballs is probably a  penny & giles, though it has no case or buttons, so it'd be more work to fabricate a case for it.

I'm modding my own and my Dad's Microsoft Trackball Opticals.

ON to the meat of my questions, I notice you posted about driving LED's from the teensy 3.0 PWM pin? I'm looking into doing that myself, and I wanted to know if you knew more about it than
I think a ULN2803 using the VUSB pin as it's 5V power should make the LEDs work with the teensy 3.0. Teensy PWM is 256hz 488.28hz, and I assume that should work just fine with a ULN2803. Can anyone think of a reason that it wont work before I order some ULN2803 ICs?

It's stupid that the teensy 3.0 is 3.3v, that's too low for a lot of things to interface without a logic level converter in-between. Or in the case of LEDs a transister IC like the ULN2803 because of the higher current needs.

A teensy pin will send current to open a gate on the ULN2803A darlington transistor IC to let the power sink from an LED (that has its own resistor). I believe I will be using 7 of the 8 gates, but only 1 of those 7 gates will be controlled by a PWM pin. Resistors are a much easier and more reliable method to control the brightness, you only need PWM if you need to vary the brightness. The ring around the trackball ball will get brighter when you move the cursor with the 2 LEDs attached to that PWM controlled gate.

Hmmm... I guess I could use 2 more resistors and the eighth gate instead of PWM... I'll decide later...

So you are driving the LED's from the PWM pin of the teensy. From what I know about transistors this makes sense. I am wanting to power an LED matrix I have with some form of brightness control, so I am wondering if a similar scheme would work. I need to know about the power requirements of the transistors. How do I calculate how much power they waste as heat? I want to do some accounting to ensure I don't go over my limit for a USB device. Would it be better to have a few transistors in parallel acting as one, or having each "group" of LED's driven by a transistor?

All you have to do is make sure that upon startup you are drawing less than 100ma. Then you negotiate for a 500ma load, and after approval you can turn everything on and use up to 500ma without a problem. You don't have to be anal about efficiency, half an amp is already a measly amount. But there's always spec sheets and your trusty fluke if you want to go that route.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Fri, 19 July 2013, 20:36:33
To make the scroll wheel work it looks like a TX-IR IC and 4MHz ceramic resonator need to be added...

I'm also gonna have to add a 32.768KHz crystal and a 10uf capacitor to the teensy... (I hope 10uf doesn't cause too much inrush current...)

To have enough room for the components my Dad came up with the "cutting board" idea... A 0.75" piece of black HDPE routered to the shape of the mouse and hollowed for the components to fit inside. It'll be stupidly tall, but functional damnit!

I'm just gonna combine my shipping with my dad's (Lunzer) for the ADNS-9800, I'll send that info in a bit.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Sat, 20 July 2013, 03:16:35
Anyone know what an ADNS-9818 model is?  My guess is it is the same as the ADNS-9800, but just a specific part number for a manufacturer as it seems to have the same specs as far as I can tell.

I think the "ADNS-9818"/"ADNS-S9818" are just typos that have been perpetuated throughout the internet... That happens quite often as people are too lazy to do research on what they are reporting on or reviewing. They just copy, paste, add some comments, annnd done.

I believe I'm going to have to layer 2 PCBs of components vertically with interconnecting pins, making a "core" for the mouse. Then ribbon cables will attach everything else to that "core". The PCB sandwich will drastically cut down on the cabling clutter that would be needed if the components were free floating.

I still can't believe how many components are needed...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: The_Ed on Mon, 22 July 2013, 16:01:42
Quote
Ed,
I dropped your package of sensors off in the mail this morning.  I put yours in with your dad's.

-John

Thanks for combining the shipping to my Dad's, they'll be here by the end of the week right?

It looks like I won't need the 32.768KHz crystal, and it wouldn't have worked anyway... You can only get whole seconds with a RTC...

I will be using the new "IntervalTimer" function that has been added to Teensyduino to make the Trackball have 1ms (1000hz) reporting. It uses the 4 PIT timers in the teensy 3.0, and "supposedly" doesn't conflict with Tone() anymore. I don't want anything higher than 1000x as that would just take up unnecessary USB bandwidth.

It seems that I am making the majority of the posts in this thread... Am I really that boring? Or is it just that no-one has any input on the matter?

(http://i1.kym-cdn.com/photos/images/newsfeed/000/082/456/Okay.png)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: SpAmRaY on Mon, 22 July 2013, 16:09:55
We are just taking in all your awesome Ed!! I do look forward to seeing  your result, but your electronic speak is hovering just over my head!! ;)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Shipping Now]
Post by: alaricljs on Mon, 22 July 2013, 21:02:32
Received my unit today :)

Should we move this thread, start a new thread or migrate parts of this thread to the Making Stuff forum?  :)  Opinions?

Also, in answer to your question, The_Ed... If I'm lucky I'll get somewhere with this before 2014 ends.  Priorities, none of which are directly mine.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Shipping Now]
Post by: The_Ed on Mon, 22 July 2013, 21:42:28
It is my thread, so I should have the say of what happens to it.

I think once I receive My and my Dad's units I'll make a final post with a link to a new thread in "making stuff together!" for my continued project efforts, and then lock this thread. And then I'll put a link in the new thread to this old thread for posterity. Sound good?

Quite frankly I don't understand how John's code doesn't have errors reading the motion considering he doesn't read the upper 8 bits of X or Y... Maybe there'll only be errors when the ball is moved really fast?...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Shipping Now]
Post by: dorkvader on Mon, 22 July 2013, 22:57:35
To be honest, I haven't been posting because I don't want to get started on this until I have it in hand, then I can figure out which trackball I can use it with, then I'll do all the case modding and then hopefully I can do the hard part: programming the microcontroller to work.

So I'm sort-of hoping the_ed has working code by the time I start thinking about using said code. I check this topic first whenever there's an update and have been closely following it.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Shipping Now]
Post by: MrJohnK on Mon, 22 July 2013, 23:57:32
I've been to the post office every day for a week.  99% of the sensors are on their way to their homes. 

As for the code and upper/lower registers, I only ever receive a constant stream of 1 or -1.  Every so often when I really whail on the ball and move it super fast, it will deliver a 2 or -2, so the upper portion of the readings seems excessive when one byte of data can easily represent 1 or 2.  You can read that upper byte register, but I'm not all that sure what that will get you.  Reading the lower byte seems to be sufficient.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Shipping Now]
Post by: The_Ed on Tue, 23 July 2013, 00:16:46
My code is FAR from a 1.0 release... (Probably September before anybody will see that...)

I will not be using the motion pin interrupt (which has a maximum of 12khz?), I will be using a 1khz IntervalTimer PIT interrupt to read the motion. At 8200DPI and 150ips that's a maximum of 1230 pixels per cycle (far greater than the 127 you could get with only the lower 8 bits of X and Y). Thus you CAN have errors happen with the way you coded it, but if it works for your purposes it's fine the way it is. I will be gaming with my trackball so I can't afford to turn the opposite direction because I moved the ball too fast.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Shipping Now]
Post by: MrJohnK on Tue, 23 July 2013, 00:44:08
That sounds like fun.  I look forward to following your progress on that.  I might actually find a use for the all mighty Teensy 3.0 that I picked up recently.  I've not got it out to play with it yet though.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Shipping Now]
Post by: The_Ed on Tue, 23 July 2013, 01:13:57
Fun?... I don't like your definition...

Apparently the baud rate for USB serial is ignored for the teensy according to PJRC, so why does everyone set it? And everyone sets it to different amounts too... I spent all this time trying to figure out how to increase it because the data from the mouse would be more than that... But no, it's a little comment on a PJRC page...

Also, apparently even though the Teensy 3.0 runs at 48mhz, the SPI.setClockDivider() function doesn't divide from 48mhz... It divides from 16mhz "for compatibility with Arduino code"... That was a comment from PaulStoffregen in the PJRC forums...

EVENTUALLY I *may* get some code done that will work with a Teensy 3.0, Arduino 1.0.5, and Teensyduino 1.15... But I keep running into all these obstacles...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Shipping Now]
Post by: dorkvader on Tue, 23 July 2013, 10:04:57
My code is FAR from a 1.0 release... (Probably September before anybody will see that...)

I will not be using the motion pin interrupt (which has a maximum of 12khz?), I will be using a 1khz IntervalTimer PIT interrupt to read the motion. At 8200DPI and 150ips that's a maximum of 1230 pixels per cycle (far greater than the 127 you could get with only the lower 8 bits of X and Y). Thus you CAN have errors happen with the way you coded it, but if it works for your purposes it's fine the way it is. I will be gaming with my trackball so I can't afford to turn the opposite direction because I moved the ball too fast.
Do you mean you will be getting 1230 counts per rotation in your application? If so, that's roughly 5 times the number you'd be getting on most normal quadrature trackballs.

I just bought another one from the tindie store. I feel like I am now committed to making at least one of these. I also swapped out the ball in my ITAC for a denser (and new) one from a penny&giles and it's excellent! I never realized hchanging the ball for a new one would make this much difference. It's got to be at least half the reason I liked the penny&giles so much.

I think I will for sure be modifying one or both of my kensington turbo mouse's. I'm also looking into replacing the bearings with better (ceramic?) ones. Sadly the quotes I've got for 2" and 2.25" Al2O3 and other ceramic balls have been.... expensive, so it looks like I'll be going with polymer or maybe stainless steel on this one.

As for modifying the other trackball, it'd be more of a project, but I'd love to get the penny&giles working. It needs a case, buttons, etc, but I think it'll be worth it.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Shipping Now]
Post by: The_Ed on Tue, 23 July 2013, 11:02:44
No... At the MAXIMUM OUTPUT of the sensor, which is 8200DPI at 150ips, it can move 1,230,000 pixels in a single second. That's 1230 pixels per poll of the sensor at 1000hz. If only the lower 8 bits of X and Y are used in the movement calculation, you can only move a maximum of 127 pixels per poll before it glitches and you move the opposite direction. Thus you need to use both the lower AND upper bits of X and Y if you are going to game on it, or just plain move it too fast.

A 38.1mm silicon nitride ball is $192.12 apiece (minimum order 2) + shipping... But it's so damn purdy... If I ever win the lottery I'll get some (fat chance on that though...).

I did however replace the bearings with 2mm Grade 5 silicon nitride as that is affordable.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Shipping Now]
Post by: The_Ed on Tue, 23 July 2013, 13:09:34
Oh yeah and if anybody needs the parts to do a trackball mod I will end up with extras of almost everything. So instead of buying the parts from ~20 different sources around the world you could just buy my extras at cost. But I have to get both trackball mods done before I sell off those extras. I also don't use cheap parts, "good enough" is never good enough for me. I think when all's said and done each of the trackballs will be composed of over $200 in parts (that includes the original prices of the trackballs). Though that will probably dip below $200 if the extra parts are sold off at the end. You always have to buy more than you need as almost everything comes in packs.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Shipping Now]
Post by: damorgue on Tue, 23 July 2013, 13:18:36
I may be interested in teensy+avago+code and put it in a mouse instead. I like the idea of a mouse where I could Control things like liftoff distance, angle snapping, acceleration and other anoying things. I made a mouse Shell myself earlier but ripped the guts from Another mouse and put in it. This would be far nicer. I will be monitoring your progress. Good luck
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Shipping Now]
Post by: The_Ed on Tue, 23 July 2013, 14:15:43
Ah yes, Snap_Angle... I forgot about that one... Remind me if I have forgotten during the 1.0 code release as it should be a simple 1 line of code in setup().
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Shipping Now]
Post by: damorgue on Tue, 23 July 2013, 14:45:27
I still have that kickstarter page bookmarked intending to buy it later... never did. If anyone has an Avago to spare, please PM me.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Shipping Now]
Post by: The_Ed on Tue, 23 July 2013, 14:52:37
You can buy one from his Tindie store... https://www.tindie.com/products/jkicklighter/adns-9800-optical-laser-sensor/ (https://www.tindie.com/products/jkicklighter/adns-9800-optical-laser-sensor/)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Shipping Now]
Post by: The_Ed on Mon, 29 July 2013, 17:30:51
I'm too lazy to make a thread in "making stuff together!" today...

Me and my Dad received our ADNS-9800 sensors a few days ago. The parts list has been finalized upon, and will be ordered soon. If anyone else wants a drop-in Microsoft Trackball Optical controller, NOW would be the time to tell me so enough of certain parts can be ordered. I believe the parts are from 23 different sources (half of those being from ebay?) from countries all around the world.

Some interesting (and quite expensive...) headers will be used to make everything fit. I haven't been able to find them for cheaper than [$4.50 for 4]/[$5.60 for 8] for the 14 pin right angle SMT headers, and [$12.28 for 10]/[$19.95 for 20] for the dual insulator headers. Anyone else know where to get them for cheaper?

(http://i.ebayimg.com/t/4pk-14-Pin-SMT-Header-Right-Angle-/00/$(KGrHqQOKiYE3lCCOq3SBN7SbHp8b!~~_3.JPG)

(These are used to access the pins on the back of the teensy 3.0. Which means that the pins on the sides of the teensy 3.0 will be coming out of the top.)

(http://i.ebayimg.com/t/Pin-Header-Plug-2-insulator-strips-2-54mm-14way-10pcs-/16/!BuC9yLw!2k~$(KGrHqMH-EEEvrJ7FYH!BL-rTMZ+cw~~_12.JPG)

(These will be used to traverse the 2 PCB sandwich that houses all the components.)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: wcass on Tue, 30 July 2013, 19:33:15
Some interesting (and quite expensive...) headers will be used to make everything fit. I haven't been able to find them for cheaper than [$4.50 for 4]/[$5.60 for 8] for the 14 pin right angle SMT headers, and [$12.28 for 10]/[$19.95 for 20] for the dual insulator headers. Anyone else know where to get them for cheaper?

i always get header pins that you can cut to size with a razor knife.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Tue, 30 July 2013, 22:29:43
Yes I could probably save a few cents with the SMT headers by getting longer ones and cutting them to size. But the dual insulator headers are the ones I can't find for cheaper, period. The space between the PCBs has to be very small so that the dual PCB sandwich will fit inside. I don't want to have to go thicker than 0.75" for the hollowed out HDPE sheet attached to the bottom.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Sun, 18 August 2013, 17:41:22
To make the scroll wheel work it looks like a TX-IR IC and 4MHz ceramic resonator need to be added...

I'm also gonna have to add a 32.768KHz crystal and a 10uf capacitor to the teensy... (I hope 10uf doesn't cause too much inrush current...)

How will you make and place the scroll wheel? As a ring-type scroll or as a separate wheel?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Sun, 18 August 2013, 18:30:16
To make the scroll wheel work it looks like a TX-IR IC and 4MHz ceramic resonator need to be added...

I'm also gonna have to add a 32.768KHz crystal and a 10uf capacitor to the teensy... (I hope 10uf doesn't cause too much inrush current...)

How will you make and place the scroll wheel? As a ring-type scroll or as a separate wheel?


This info is old and incorrect. I will be using the new "IntervalTimer" function that has been added to Teensyduino which uses the 4 PIT timers in the teensy 3.0, and "supposedly" doesn't conflict with Tone() anymore. No TX-IR IC, 4MHz ceramic resonator, or 32.768KHz crystal needed. But I will still need the 10uf capacitor.

Because I am modding existing trackballs (Me and my Dad's Microsoft Trackball Opticals) the scroll wheel already has it's place. I will most likely post pictures of progress next weekend.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Sun, 18 August 2013, 19:22:37
To make the scroll wheel work it looks like a TX-IR IC and 4MHz ceramic resonator need to be added...

I'm also gonna have to add a 32.768KHz crystal and a 10uf capacitor to the teensy... (I hope 10uf doesn't cause too much inrush current...)

How will you make and place the scroll wheel? As a ring-type scroll or as a separate wheel?


This info is old and incorrect. I will be using the new "IntervalTimer" function that has been added to Teensyduino which uses the 4 PIT timers in the teensy 3.0, and "supposedly" doesn't conflict with Tone() anymore. No TX-IR IC, 4MHz ceramic resonator, or 32.768KHz crystal needed. But I will still need the 10uf capacitor.

Because I am modding existing trackballs (Me and my Dad's Microsoft Trackball Opticals) the scroll wheel already has it's place. I will most likely post pictures of progress next weekend.

The scrolling mechanism in the trackball you are modifying, does it work the same way as in regular mice, with a lattice which moves in between a LED and an optical sensor to gives pulses? I think the direction is determined by this priciple (http://en.wikipedia.org/wiki/Rotary_encoder#Incremental_rotary_encoder) or something similar. Is it the same in your trackball?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Sun, 18 August 2013, 19:43:10
It uses an IR LED and an IR sensor quadrature encoder (2-bit code -> 00, 01, 11, 10). But because the teensy 3.0 is 3.3v I have to use an Adafruit TXB0108 logic level converter (It's just easier to use a breakout board). That way the 3.3v teensy 3.0 and 5v scroll wheel components can communicate without killing each other.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: dorkvader on Sun, 18 August 2013, 23:11:52
The_ed: will your code support using the ball itself as a scrollwheel by (for example) pressing a button? I find this to be a good solution, especially if one plans to add buttons.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Sun, 18 August 2013, 23:19:11
The_ed: will your code support using the ball itself as a scrollwheel by (for example) pressing a button? I find this to be a good solution, especially if one plans to add buttons.

I don't quite understand what you mean... Can you elaborate? If I do do code for extra things it will be after both trackballs are modded and working with the 1.0 code (that is likely to be done LATE next month at the EARLIEST). The 1.0 code should have almost every standard feature already.

EDIT: BTW I don't even have all the parts in yet. Some things come in only a few days from China, others take up to ~5 weeks, it's weird.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: dorkvader on Mon, 19 August 2013, 12:06:14
This is a feature that the CST trackballs implement (poorly). You press (and hold) a button, and (after three seconds) it switches to "scroll" mode, where the cursor is frozen, and moving the trackball acts to scroll the page. This is useful for reading long documents and PDF's, as well as lists.

What I'd like to see is allowing a button to be used to turn the mode on and off, so you don't have to repurpose a button for this (though having functionality for both is likely doable) so you press the "scroll" button, then the cursor is frozen and the trackball becomes a scrollwheel. You press it again to unlock the cursor and it is back to being a normal trackball.

I am sure I don't recall the CST's behaviour perfectly, but I hope I've made my idea more clear.

---
I'm also not even close to starting this project, so I'm not affected much by any delays you may have, though I'm sure it's frustrating for you to have to wait so long.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Mon, 19 August 2013, 16:01:39
As long as there are free digital pins I can always add more buttons to the code (I need to count up how many are used already). You want a dedicated button, and also the ability to hold a specific button for 3 seconds, to change the trackball into a scroll wheel (without center click obviously). You would obviously have to un-comment out this feature and type the button ID into the function for holding a button for 3 seconds (that way you would get to choose which button it is instead of me) if you don't use the dedicated button. But this feature would likely be implemented in a future 1.1 release as it is not necessary for my trackball mods.

Remember that my code will only work on the teensy 3.0, and I don't plan on supporting the teensy 2.0/++ 2.0.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Mon, 19 August 2013, 19:36:51
I will wait until you get yours working before I commit to buying parts for my project. Hopefully everything turns out perfectly on your first try but my experience tells me that problems always rise, no matter how thorough you are. I'll let you take the risks :)

In all seriousness, I hope it turns out great. I will follow your project so please let us know how it goes when you receive your parts.

Edit: Let me know if there is anything I can do to help. I am afraid I don't know much about electronics and signals processing, but perhaps there is something I can contribute.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Mon, 19 August 2013, 19:53:48
I have most of the parts now, I'm just waiting on the stragglers.

I believe reading the "Motion Burst" data into variables and mounting the ADNS-9800 to the ball socket were what I was still trying to figure out. By using "Motion Burst" I'll be much more efficient with reading the motion data, and maybe be able to support more than 1000hz if people want that (but 1000hz will be what I set it to).
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Tue, 20 August 2013, 01:17:31
Damnit dorkvader! Now you have me thinking about how to implement your scroll ball... It should technically be possible to go all 4 directions because tilt-wheel mice exist. A certain amount of "counts" would be converted into a scroll command. I have also re-thought how the LEDs will give info because in my current method you wouldn't be able to tell when you were in ball scroll mode. The ball socket LEDs have to be incorporated (I'm using 2 to evenly light up the ball socket, but the signal is the same to both), which means if you don't have a light-up ball socket you'll have to put the LED elsewhere.

I'm thinking that the scroll ball should NOT be dependent on the DPI (meaning that whatever DPI level you are on it will still scroll the same amount). With 8 levels of DPI (it's technically possible to have 41) and a scroll ball mode that's all 9 combinations of the 2 RGB LEDs (excluding OFFs). When you hold down the forward and backward buttons simultaneously (that's what I'll have it set to) you'll go into liftoff distance mode. The ball socket LEDs will turn off and the RGB LEDs will show the liftoff distance level instead of DPI. But because there are 11 levels (it's technically possible to have 31) I'll have to include OFFs.

I think you've just delayed the 1.0 release for everyone, but you'll likely have your scroll ball support in 1.0... Why you make more work for me bro?...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Tue, 20 August 2013, 14:03:23
Looks like to get horizontal scrolling I'll need to figure out "WM_MOUSEHWHEEL"... So ball scroll will likely be only vertical in 1.0. There are some other things in my list of additions after 1.0 as well now. I think there will be exactly 0 free digital pins on the teensy 3.0 if I implement the code for everything in the list (yes, all 34 would be used...). Do people really need that many inputs on a mouse? Probably not, but they'll be able to hook any combination of things up, unless they really want a ****in' massive mouse.

EDIT: Maybe "MOUSEEVENTF_HWHEEL" instead... I don't know...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Tue, 20 August 2013, 15:13:48
I believe I missed that list. Could you summarize your firmware, or is this still valid?

Do you have a copy of the Avago C8051F347 Firmware that they supply to people who are going to make mice with their ADNS-9800 laser sensors? That way it should be much easier to change the code to my purposes since it already has code for:

the ADNS-9800 pointer movement
a scroll wheel
3 mouse buttons (I would add support for 2 more)
3 LEDs roughly indicating DPI (I would alter them to light up the socket when the mouse is being moved)
and 2 buttons to increment/decrement the DPI by 200 (they can also be used to increment/decrement the liftoff distance by 0.3mm) (I would alter it to change between 5-8 defined DPI levels)

(This is in the PDF sheet for Avago's C8051F347 Firmware Version 2.8 from 11JAN12)

Just trying to summarize it as it would be in a mouse. You mention scroll, 3 buttons+2 extra. Those would then be approximately this I suppose:
-Scrollwheel
-Middle mouse button (push scroll)
-Left mouse button
-Right mouse button
-Forward
-Backward

Then there are 2 more buttons who are not sent to the computer but just control the firmware internally (DPI and liftoff distance as you mentioned). Correct?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Tue, 20 August 2013, 15:24:50
Again, you are quoting old and incorrect information... There has been a lot of progress and changes since then.

Here's a little checklist I have that might give a little more insight.

Quote
Trackball and Mouse movement
9 buttons (2 for DPI)
Toggle (DPI and liftoff)
Vertical scroll (2-bit and buttons)
2 RGB indicator LEDs
2 Ball socket movement LEDs
11 Liftoff distance levels
8 DPI levels
Snap_Angle
Rest 1, 2, 3
Motion_Burst
500ma
1000hz IntervalTimer

Future:
Ball scroll
Profiles/layers
Horizontal scroll (2-bit and buttons) and center button
FPS button

Digital:
9 buttons
2 scroll
3 toggle
8 LEDs
5 laser

Future:
1 ball scroll
1-2? profiles/layers
3 horizontal scroll
1 FPS button

EDIT: Actually I could free up 2 of those Digital pins by commenting out like I did for others, so they won't all be used like I thought a little bit ago.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: dorkvader on Tue, 20 August 2013, 17:58:13
Lots of activity here since my last post.

First of all, I did not want to recommend implementing CST's horrible scrolling interface (unless you really wanted to) but just having vertical scroll functionality via a switch would be perfect for me. Multi-axis scroll would be great, but I think saving it for a later version would be better.

If you can really implement all that in version one, it'll be a pretty excellent piece of software. When I bulk-order parts (and teensys) next paycheck, I'll make sure to get a 3.0 just in case.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Tue, 20 August 2013, 21:50:31
There's gonna be a LOT in 1.0, with more after that. To use the code people will have to both un-comment out and comment out bits and pieces, and also set some things. Basically like a command line razer software if you get what I mean. It'll all be there for a simple setup, though I'll still probably have to make a guide for those that can't read the in-code comments...

But yeah it looks like only 2 digital pins will be left, which means I could change it to 11 buttons (2 for DPI) for those that like more buttons. And I could technically get a lot more if I make nothing dedicated, but all assignable.

...

Ah ****...

Why do I keep having ideas?... They just make more work for me...

OK, nothing dedicated it is. That will make it much more flexible, but increase the stuff the end user has to do to set it up.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Tue, 20 August 2013, 21:53:16
Thanks The_Ed, that is exactly what I was looking for. I'll probably order some parts myself soon.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: MrJohnK on Tue, 20 August 2013, 21:56:53
If you need a sensor, be quick.  I'm almost sold out.  I'm working on ordering more supplies, but I'll probably be out before the new supplies arrive.  Only 4 left.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Tue, 20 August 2013, 22:28:27
If you need a sensor, be quick.  I'm almost sold out.  I'm working on ordering more supplies, but I'll probably be out before the new supplies arrive.  Only 4 left.

-John

Thanks for notifying me. I am still contemplating getting a mouse and gutting it for parts instead though. I have a lot of Omron switches left over, but the cost of those are negligible. It will cost me $40 + $33 for Avago sensor and Teensy 3.0, it will require more effort and I will need a few more parts as well. It stands between that and  gutting a mouse which will give me a bit less versatility I guess.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Wed, 21 August 2013, 05:21:00
If you need a sensor, be quick.  I'm almost sold out.  I'm working on ordering more supplies, but I'll probably be out before the new supplies arrive.  Only 4 left.

-John

But after you get more supplies they will be in-stock again right? I was thinking of getting 2 more sensors after I complete the first trackball. I would still be able to do that right? I thought I remembered you saying you were going to stock these for the long haul.

Also, why did the price increase?

If you need a sensor, be quick.  I'm almost sold out.  I'm working on ordering more supplies, but I'll probably be out before the new supplies arrive.  Only 4 left.

-John

Thanks for notifying me. I am still contemplating getting a mouse and gutting it for parts instead though. I have a lot of Omron switches left over, but the cost of those are negligible. It will cost me $40 + $33 for Avago sensor and Teensy 3.0, it will require more effort and I will need a few more parts as well. It stands between that and  gutting a mouse which will give me a bit less versatility I guess.

But if you gut a mouse how will you use the sensor?... They don't come on breakout boards, they're soldered directly to the main PCB. If the mouse sensor isn't an ADNS-9800 you're gonna have to find the firmware elsewhere. If you don't use a teensy 3.0 you can't use my code, and if you use a teensy 2.0 you'll have to modify John's code, and if you use neither you'll probably have to code from scratch for whatever controller you're using.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Wed, 21 August 2013, 10:45:57
If you need a sensor, be quick.  I'm almost sold out.  I'm working on ordering more supplies, but I'll probably be out before the new supplies arrive.  Only 4 left.

-John

Thanks for notifying me. I am still contemplating getting a mouse and gutting it for parts instead though. I have a lot of Omron switches left over, but the cost of those are negligible. It will cost me $40 + $33 for Avago sensor and Teensy 3.0, it will require more effort and I will need a few more parts as well. It stands between that and  gutting a mouse which will give me a bit less versatility I guess.

But if you gut a mouse how will you use the sensor?... They don't come on breakout boards, they're soldered directly to the main PCB. If the mouse sensor isn't an ADNS-9800 you're gonna have to find the firmware elsewhere. If you don't use a teensy 3.0 you can't use my code, and if you use a teensy 2.0 you'll have to modify John's code, and if you use neither you'll probably have to code from scratch for whatever controller you're using.

i didn't make myself clear. I would use the entire internals then. I have done so in the past. That is what I meant by decreased versatility. I won't be able to adjust anything and would have to rely solely on their firmware, their hardware etc, which is why I would much prefer getting that Avago, Teensy and some sort of scroll mechaninic.

Edit: The scrolling mechanic is a bit of an issue for me as well and I'll have to figure it out. That issue won't be there if a butcher a mouse. I'll probably end up getting the avago+teensy+cheap mouse for scroll.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Wed, 21 August 2013, 14:06:21
Ah I see, but what would be the point of butchering a mouse when you couldn't customize anything? Making the shape of the mouse more ergonomic is all I can think of that you could do by purely butchering.

A cheap mouse will have a cheap scroll wheel, and you really want to get one that feels good. The way the scroll wheel is mounted and the parts used are also of concern. Older mice used 2 IR LEDs and 2 IR sensors mounted at different heights around the slotted wheel, and their signals had to be combined to make the quadrature code. Newer mice use a single IR LED and either a 3 or 4 lead IR sensor quadrature encoder around the slotted wheel. All 3 methods have to be hooked up to the microcontroller a different way. The way the scroll wheel is mounted can also be problematic as most mice have the scroll wheel mounted with plastic from the case. You would need to get a scroll wheel that mounts to the PCB (unless your modded mouse uses the case of the mouse you get the scroll wheel from).
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Wed, 21 August 2013, 14:30:34
Ah I see, but what would be the point of butchering a mouse when you couldn't customize anything? Making the shape of the mouse more ergonomic is all I can think of that you could do by purely butchering.

Sort of what I am doing. (http://geekhack.org/index.php?topic=47179.0) I didn't want to clutter down your thread.

Don't worry about it, the more the merrier. I'll read through it later, but it looks like I was right on the ergonomics!

BTW if you need any parts proxied I have proxied for some of your fellow Swedes already.

Oh and remember you'll need a logic level converter (like an Adafruit TXB0108 breakout board) to interface the 5v scroll wheel with the 3.3v teensy 3.0, and a ULN2803 because 3.3v isn't enough to drive most LEDs properly.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Wed, 21 August 2013, 16:17:50
If you need a sensor, be quick.  I'm almost sold out.  I'm working on ordering more supplies, but I'll probably be out before the new supplies arrive.  Only 4 left.

-John

Damn, they are sold out now. I didn't think they would sell out that fast. Any idea when new stocks may arrive?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: meowbots on Wed, 21 August 2013, 19:16:07
Could someone please send me the latest firmware version they have for this sensor? I have A4, as posted here: https://github.com/mrjohnk/ADNS-9800. However, I'm going crazy trying to figure out what's wrong. I have successfully uploaded the firmware, activated the laser, and am able to correctly read registers such as product ID, revision ID, and SQUAL. The problem is that the motion pin never changes from high, and delta x and delta y are always zero (plus the motion bit of the motion register is always zero). I have two of these sensors, and get the same result with both, so it likely isn't hardware. Please help! Is there perhaps some other register I have to set up in order to begin to sense motion? So far I've set up the sensor as shown using the sample code, and then tried to read the motion, x_l, x_h, y_l, y_h registers.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: meowbots on Wed, 21 August 2013, 20:01:55
Could someone please send me the latest firmware version they have for this sensor? I have A4, as posted here: https://github.com/mrjohnk/ADNS-9800. However, I'm going crazy trying to figure out what's wrong. I have successfully uploaded the firmware, activated the laser, and am able to correctly read registers such as product ID, revision ID, and SQUAL. The problem is that the motion pin never changes from high, and delta x and delta y are always zero (plus the motion bit of the motion register is always zero). I have two of these sensors, and get the same result with both, so it likely isn't hardware. Please help! Is there perhaps some other register I have to set up in order to begin to sense motion? So far I've set up the sensor as shown using the sample code, and then tried to read the motion, x_l, x_h, y_l, y_h registers.

Ahhh, the joys of wanting to use a PIC instead of Arduino... So apparently there was an ever so slight error in my code that was loading the SROM. My apologies for jumping the gun, I really thought I had wasted enough hours of my life trying to figure this out alone. Got me a working sensor now! :)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Wed, 21 August 2013, 20:04:33
I have two of these sensors,

Got me a working sensor now! :)

I might want the other if you don't need it. :)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: meowbots on Wed, 21 August 2013, 20:11:08
Unfortunately I need them both, plus I'm not sure the shipping from Canada would be worth it anyway... I started off buying this mouse: http://www.amazon.ca/Perixx-MX-3000B-Programmable-Gaming-Laser/dp/B00BM7NXMW/ref=sr_1_2?ie=UTF8&qid=1377133751&sr=8-2&keywords=avago+9800, which has the same sensor, but just requires you to connect more pins. May be an option if you are stuck.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: MrJohnK on Wed, 21 August 2013, 21:14:59
Those four sold out today.  I have two extra here I can list.  Past that, the only ones left might have to fill re-shipments to Israel and Italy.  I have those two customers that I shipped to about a month ago, but their package has not arrived.  They are both giving it a few more days since they know their post offices are slow.  Drop me a line if you decide you want one or two and I'll list them pronto.

As for restocking, that will probably be at least 3 weeks.  These sold out way faster than I anticipated, so I'm working with the vendors to source new stock.

-John
inet2xtreme{at}yahoo.com
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Wed, 21 August 2013, 23:22:31
Could someone please send me the latest firmware version they have for this sensor?

I got A4, A5 (89), and A6 from John. A6 is in my code that I will eventually try out, but A4 is known to work by at least 2 people (3 now including yourself).
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Thu, 22 August 2013, 01:12:05
The_Ed, will your firmware support calibration of X and Y axis? I was about to design a small rig which would allow me to adjust the rotation of the Avago PCB assembly on the bottom plate of my mouse, but it wouldn't be necessary if you could just set it in the firmware instead.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Thu, 22 August 2013, 01:35:09
Of course, all you have to do is times by -1 where necessary if the axes are off. You just can't have it at a diagonal, any of the 4 directions are fine though.

It's mounting the ADNS-9800 to the ball socket that's the hard part at this point... The code will eventually get finished, the rest of the parts will arrive, and the trackballs will be modded. But I'll just be stuck with bupkis if I can't mount the ADNS-9800 to the ball socket...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Thu, 22 August 2013, 01:50:31
I meant if it is off by a couple degrees. It would require some trigonometry to adjust it. Example:

Lets say you get a reading of 10 of whatever units positive X. If the sensor is rotated 5 degrees from the position you want it in, this will have to be converted to sin(85)*10 in X and cos(85)*10 in Y direction. Sort of tired atm, so that example might not be correct, but you should get the point I am getting at.

Is it possible to make these calculations on the large amount of data throughput without causing lag?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Thu, 22 August 2013, 02:05:45
The teensy 3.0 runs at 48MHz (and can be overclocked to 96MHz, but I would not recommend that). There shouldn't be any lag from the calculations, but I don't plan on adding that to my code as it should be easy enough to get the sensor within ±2 degrees, which you wouldn't even notice. The calculations would also likely introduce rounding errors, cursor lag (NOT calculation lag), and erratic movement (ESPECIALLY when changing direction). You can add those calculations if you want though, but I've already got too much on my plate as it is.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Thu, 22 August 2013, 19:22:30
As for restocking, that will probably be at least 3 weeks.  These sold out way faster than I anticipated, so I'm working with the vendors to source new stock.

Three weeks ain't that bad. I am not in that big of a rush. Shipping would probably be another week as well. Thanks for providing us with them btw.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Fri, 23 August 2013, 03:26:49
Alright, something I thought would be easy is proving quite difficult... Because there were "Virtual-Key Codes (http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx)" I thought it would be quite easy to send them to the computer to get stuff like VK_BROWSER_BACK and VK_BROWSER_FORWARD since the teensy and arduino code libraries didn't seem to have those 2. But my searching is proving just as futile as horizontal scrolling... Am I just being stupid?

EDIT: It also looks like I may not be able to use Motion_Burst on the teensy 3.0 (though it looks like it'll work fine on an Arduino Due...).
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - Ended/Waiting]
Post by: meowbots on Fri, 23 August 2013, 17:15:53
The newest FW should also fix the smoothing/lag issue.

What is the lag issue that you speak of? I'm trying to find ways to make this sensor as accurate as possible, and wondering if I should concern myself with getting the latest firmware.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Fri, 23 August 2013, 18:03:05
So it looks like there are 4 problems that need to be addressed so far:
#1 - Mounting the ADNS-9800's to the ball sockets of the Microsoft Trackball Opticals.
#2 - Forward and Backward buttons.
#3 - Receiving the multiple Motion_Burst response bytes.
#4 - Scrolling horizontally

In more depth:
#1 - I can't figure out how to attach them to each other... I think a part will have to be 3D printed, but I have no idea how to 3D model. I'll need help with this one, unless my Dad can pull off another hardware store miracle.
#2 - Because there were "Virtual-Key Codes (http://msdn.microsoft.com/en-us/library/windows/desktop/dd375731(v=vs.85).aspx)" I thought it would be quite easy to send them to the computer to get stuff like VK_BROWSER_BACK and VK_BROWSER_FORWARD since the teensy and arduino code libraries didn't seem to have those 2, but so far I haven't been able to figure out how to send Virtual-Key Codes to the computer with arduinos. Being able to use anything defined in the Virtual-Key Codes would mean that volume and media keys would also be mappable.
#3 - SPI.transfer(val) sends and receives a single byte. The Motion_Burst of the ADNS-9800's sends back 14 bytes, and it looks like only the Arduino Due and its SPI_CONTINUE can read those subsequent 13 bytes. I need to be able to read the first 6 bytes of Motion_Burst for it to be used as a more efficient and precise method than John's. Otherwise I'll just have to use John's method of reading REG_Delta_X_L and REG_Delta_Y_L (which takes longer than Motion_Burst) and hope I don't move the ball faster than 127 counts/pixels per millisecond (the limit of precise movement without reading the upper 8 bits of X and Y).
#4 - Scrolling horizontally seems similar to #2 in that there are codes for it, but I can't figure out how to send them to the computer with arduinos. (It should be pointed out that both vertical and horizontal scrolling, and mouse movement are not defined in the "Virtual-Key Codes").

It seems like I may have to have a driver of sorts running on the computer for #2 and #4...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: MrJohnK on Fri, 23 August 2013, 23:36:12
I believe you can still use Motion Burst Read.  While it returns a variety of bytes, you would only read 1 byte per transaction if I'm understanding that right.  Motion burst mode saves time since you don't have to tell the chip what you want to read, then read it.  You just tell it you want this burst mode, then execute multiple reads, one right after the other without specifying what you want to read.  So, you read from the Motion_Burst register, then do multiple subsequent reads to obtain multiple bytes of data representing Motion, Observation, Delta_X_L, Delta_X_H, Delta_Y_L, Delta_Y_H, Pixel Statistic, Shutter and Frame period.  Of course, you can just pull NCS high after the first four reads to cancel the operation since you already have what you are looking for.

Also, for special key sequences that are not part of Teesyduino (http://www.pjrc.com/teensy/teensyduino.html), you might email Paul Stoffregen at PJRC and have him add it to the standard HID USB profile (http://www.pjrc.com/teensy/td_keyboard.html).  He is usually pretty accommodating, so I've found.

Not sure how to help, but I have a CAD system and a 3D printer.  Without the actual mouse being retrofitted, hard to say how I can help though.

-John

Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: MrJohnK on Fri, 23 August 2013, 23:58:16
After re-evaluating what I said, and looking at the Motion_Burst data bytes, you would pull NCS high after six subsequent reads to get both high and low of the X & Y registries.  There are two other bytes presented before you get the motion data (Motion, Observation).

Alternatively, you could just read the high/low of each X and Y register, but of course, you would have to tell it what you want, then read the results for each byte of data that way.  So, that becomes eight seperate transactions verses seven using the Motion_Burst mode.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: alaricljs on Sat, 24 August 2013, 00:07:04
The interesting "Media" keys that are found on some keyboards and typically include mail, browser and a few other interesting things actually require an endpoint of their own.

Pretty sure this (https://github.com/tmk/tmk_keyboard/blob/master/protocol/pjrc/usb_extra.c) a chunk of that support out of hasu's tmk

Not sure if there's anything like that with pointing devices that have a ton of extra buttons and things.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: Bullveyr on Sat, 24 August 2013, 08:26:20
The newest FW should also fix the smoothing/lag issue.

What is the lag issue that you speak of? I'm trying to find ways to make this sensor as accurate as possible, and wondering if I should concern myself with getting the latest firmware.

Iirc first 9800 were a bit laggy (not as direct) because there was quite some smoothing which was corrected with newer FWs.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: MrJohnK on Sat, 24 August 2013, 10:05:22
In order to further the understanding of how to interact with this chip and solve the riddle of why it is 14 bits of data instead of 16.  When interacting with the chip over the SPI bus, the most significant bit ("MSB") is set to either 0 or 1 to indicate read or write respectively.  So, there are only 7 bits of real data that are sent in addition to the read/write indicator.  All transactions are pushing or pulling one byte of data over the SPI bus.  The data received from the chip (after requesting a read operation) also only has 7 bits since it comes as 2's complement formatted and the MSB is the sign bit.  Hope that helps.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Sat, 24 August 2013, 21:13:47
Alright, I have been looking into SPI a little more, and I think problem #3 is no longer an issue. It looks like Arduino and Teensy implement SPI differently. I was obviously looking at the Arduino pages, and because of that I thought there was a problem. In Arduino SPI controls the SS pin, while in Teensy you have to manually control the SS pin. Therefore there *shouldn't* be a problem reading 14 bytes in succession on a Teensy (or an Arduino Due with its SPI_CONTINUE).

The interesting "Media" keys that are found on some keyboards and typically include mail, browser and a few other interesting things actually require an endpoint of their own.

Pretty sure this (https://github.com/tmk/tmk_keyboard/blob/master/protocol/pjrc/usb_extra.c) a chunk of that support out of hasu's tmk

Not sure if there's anything like that with pointing devices that have a ton of extra buttons and things.

I'll look into this later when I have more time.

EDIT:

Ed,

your trackball project is fascinating. I have a related question about the 9800:
As you might have read in Bullveyrs post on page 3 in your thread, the 9800 has acceleration issues of about 5 % in the form of a sinus curve. See here for a graphic: http://www.teamliquid.net/forum/viewpost.php?post_id=18189604
Do you have any idea where this acceleration could come from? From the firmware running on the 9800 itself or from the firmware running on the Teensy 3.0?

Patrick

There is absolutely NO acceleration from the Teensy 3.0, any acceleration would be from the ADNS-9800 itself (if there truly is any, ESPECIALLY with the current A6 firmware).

EDIT2:

Las time I measured, there was acceleration. This wasn’t with the latest firmware, but as was posted by Bullveyr, this acceleration is likely unfixable.
I was thinking maybe one could use the computing power of the Teensy 3.0 to process the flawed data the sensor outputs. But that would be quite difficult, I’d guess.

You do realize that these graphs you linked show that there is NO acceleration right? It shows that there is an error margin in the sensing of distance moved, and the poster even points that out... Acceleration can be linear, a curve, exponential, or even stepped. None of those apply to the graphs because it is purely an error margin WITHOUT any acceleration.

To correct the error margin with math on the teensy would assume that every sensor's error margin at every speed was exactly the same. That is impossible, thus to correct the error margin you would have to get the graph of your specific sensor and calculate the math for it.

If you still don't like the ADNS-9800 sensor because of what you've read, then don't use it. But just realize that EVERY sensor has an error margin, which means that every mouse does too.

Show Image
(http://cdn.overclock.net/3/3a/350x700px-LL-3a123337_belsqdbh6ng4hh0nr.gif)
Show Image
(http://666kb.com/i/beluh5x7m0nnjthuf.gif)


BTW, these questions belong in the thread and not my inbox.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: Bullveyr on Sun, 25 August 2013, 05:26:04
It is correct that it's not really common acceleration but inconsistent CPI. The thing is that if you take slow movement as a base there is more inconsistency on the positive side if you more an A9500/9800 faster.
So in a gaming environment it results in positive acceleration in the sense that if you move the mouse faster your cursor moves a farther distance than if moved slowly.

This inconsistency isn't predictable enough to correct it on a MCU or software level without the movement "feeling wrong".

Anyone know what an ADNS-9818 model is?  My guess is it is the same as the ADNS-9800, but just a specific part number for a manufacturer as it seems to have the same specs as far as I can tell.

I think the "ADNS-9818"/"ADNS-S9818" are just typos that have been perpetuated throughout the internet... That happens quite often as people are too lazy to do research on what they are reporting on or reviewing. They just copy, paste, add some comments, annnd done.
S9818 is Razers special version of the ADNS-9800. Razer and Logitech usually have special versions of Avago (now PixArt) sensor.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Sun, 25 August 2013, 10:27:16
The overall curve goes upward, the picture of the Xai shows this more clearly.

I don’t like the ADNS-9800 not only for what I read, but for what I measured, too: I measured an ADNS 3090 at 1 % maximum deviation/acceleration. I did the same for the ADNS 9500 of the Sensei and got 5-7 %.

Sorry for taking this to your inbox. I’ll stop now! ;)

BTW: If you were to math away the acceleration of the 9x00, they would name whole forums after you …

The curve does NOT go upward for either the XAI or the G9X. If you look at 0.75m/s-3m/s you'll see that it is perfectly flat for both of them. The line does NOT show any of the types of acceleration (linear/curve/exponential/stepped). Sensors are *usually* the most inaccurate/unpredictable when sensing at slow speeds, so the erratic error margin below 0.75m/s is normal. The error margin simply stabilizes its form after 0.75m/s and becomes quite predictable.

It sounds like the ADNS-3090 is the perfect sensor for your OCD then. But my thread is about the ADNS-9800 breakout boards and everything related to them, NOT about comparing the ADNS-9800 to other sensors on the market.

Start replying in my thread then...

Again, it's NOT acceleration! And as I have just said, you would have to get the data from your specific sensor for math to do any good as every sensor that has ever been manufactured will have its own unique error margin. If I did the math for my ADNS-9800 to get 0% error margin, you would still have an error margin with your ADNS-9800 using that same math.

Oh ****, I need to get going, why am I still on GH?

EDIT: Still PMing me... And that link is to teamliquid's definition of acceleration, which has absolutely no bearing on my trackball project... I don't understand his agenda...

Ed,

I define it as acceleration. I know it’s a dirty definition, but that’s how people call it. Do you know this thread? http://www.teamliquid.net/forum/viewmessage.php?topic_id=333648#i-iii
Maybe it helps you with your project. :)

Patrick
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: meowbots on Mon, 26 August 2013, 07:48:25
Iirc first 9800 were a bit laggy (not as direct) because there was quite some smoothing which was corrected with newer FWs.

Would you mind sending them my way? I'd like to try all the options before going down the road of making my own absolute encoder with this thing, but I'm pretty convinced now that I'll need to in order to get the accuracy I want.

Thanks
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: Bullveyr on Mon, 26 August 2013, 08:16:09
I would if I had the FWs.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Mon, 26 August 2013, 19:04:59
I just found this, and it gives me hope.

Quote
1.3 Mousekey

KC_MS_U, KC_MS_D, KC_MS_L, KC_MS_R for mouse cursor
KC_WH_U, KC_WH_D, KC_WH_L, KC_WH_R for mouse wheel
KC_BTN1, KC_BTN2, KC_BTN3, KC_BTN4, KC_BTN5 for mouse buttons

1.4 System & Media key

KC_PWR, KC_SLEP, KC_WAKE for Power, Sleep, Wake
KC_MUTE, KC_VOLU, KC_VOLD for audio volume control
KC_MNXT, KC_MPRV, KC_MSTP, KC_MPLY, KC_MSEL for media control
KC_MAIL, KC_CALC, KC_MYCM for application launch
KC_WSCH, KC_WHOM, KC_WBAK, KC_WFWD, KC_WSTP, KC_WREF, KC_WFAV for web browser operation

So if I can figure out the labyrinth that is hasu's tmk and incorporate the code, then only problem #1 will remain. Thanks for the link alaricljs!

Iirc first 9800 were a bit laggy (not as direct) because there was quite some smoothing which was corrected with newer FWs.

Would you mind sending them my way? I'd like to try all the options before going down the road of making my own absolute encoder with this thing, but I'm pretty convinced now that I'll need to in order to get the accuracy I want.

Thanks

I could send you the package of files (including firmwares A4, A5 (89), and A6) that John sent me.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: meowbots on Mon, 26 August 2013, 19:10:23
I could send you the package of files (including firmwares A4, A5 (89), and A6) that John sent me.

That would be great. Can you put them on dropbox and email me the link or something? I was thinking of emailing John, but I wasn't sure if he even had the newer ones.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Mon, 26 August 2013, 19:18:17
I could send you the package of files (including firmwares A4, A5 (89), and A6) that John sent me.

That would be great. Can you put them on dropbox and email me the link or something? I was thinking of emailing John, but I wasn't sure if he even had the newer ones.

Just send me your email.

EDIT: Alright I sent it to your email.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Tue, 27 August 2013, 07:03:02
Does anyone have a drawing of it, mainly the diameter and cc distance of the mounting holes? Overall diameter and height would be useful as well.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: meowbots on Tue, 27 August 2013, 12:43:24
Here is my drawing in inches.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Tue, 27 August 2013, 14:20:45
There are eagle files on John's github if that helps.

Incorporating hasu's tmk code (if it's even possible) looks to be an incredibly daunting task as there is a mountain of files... It looks like everything but profiles should be able to be pulled from them (if I can figure out how). He already has 32 layers of keymaps, so it should be possible to have some more variables to have multiple profiles that each have 32 layers (who would need that many?). Profiles are logical groupings of layers for specific programs or games, and it would be much easier to toggle say 3 profiles down the list than 12 layers to get to the keymap you want.

I think I'm going to be pessimistic and say it'll be November at the earliest now... It'll take a long time to get all the code together. Who would've thought it would be this much work to make code for mice/trackballs? It seemed like it would be so much easier at the beginning. But the further down the rabbit hole I go, the harder and larger it seems...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Tue, 27 August 2013, 21:11:03
Here is my drawing in inches.

Thanks. I suppose it is decided then. If I start to make mounts made specifically for this pcb and sensor I might as well go with it.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Thu, 29 August 2013, 14:49:59
Hasu's tmk code is a nightmare to figure out... It looks like I'll need to rip out keyboard, mouse, system, and consumer, and then figure out how to send the info to them that is not in a scanned key matrix format. I'm not even gonna try to rip the layers support out at this point, especially since that was planned for 1.1 anyway. But I believe that ball scroll, horizontal scroll, and an FPS button will still make it into 1.0 at this time. Somebody please correct me if I'm wrong about the keyboard/mouse/system/consumer part. I'm not a master programmer, but neither am I an incompetent rookie. I have just never coded for hardware before this project, it's a totally new experience. And I only have a little time here and there where I can sit down to write some code, solder some stuff, or sift through existing code because I don't know how to do something. This is very much a learning experience.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Fri, 30 August 2013, 21:41:09
OK, so I *think* I have to make a custom USB device descriptor for the teensy 3.0 that declares the proper endpoints. Then I have to pass the proper info to them in the proper format for stuff to work with windows' standard drivers. So now I have to learn how to make a USB device descriptor and it's endpoints from scratch so that I can understand how they work. After I learn how they work I should be able to either copy the code I actually need from Hasu's TMK, or write my own from scratch because his looks WAY more complicated than anyone else's.

It looks like there are 16 endpoints in the teensy 3.0, and the USB spec maxes out at 32, so that's actually quite a lot for such a little chip.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: MrJohnK on Fri, 30 August 2013, 22:03:20
I've not taken my Teensy 3.0 out of the box yet, but if it is like the 2.0, all the USB HID descriptors for a keyboard & mouse composite device are already done through the Teensyduino add-on software.  You would just select keyboard & mouse in the Arduino software and the Teensy shows up as that in the USB hub.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Fri, 30 August 2013, 22:25:47
Those only have 3 buttons and vertical scrolling for mice, and no media or system keys for keyboard (like browser forward/backward). That is why so many people have had to modify them. Or are you saying that teensyduino is different now and includes support for 5 mouse buttons, vertical and horizontal scrolling, and media and system keys?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: MrJohnK on Fri, 30 August 2013, 22:34:40
AFAIK, it is just three mouse buttons and scroll up/down in Teensyduino.  Wonder if LUFA has the extra buttons...hmmm...or, if Paul would be willing to add those extras.  I think the horizontal scroll is copyright with Microsoft.  Not sure if that makes a difference in getting support for that or not.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Fri, 30 August 2013, 22:41:46
Hasu's TMK, among others, have support for horizontal scrolling and the rest. So even if horizontal scrolling is copyrighted by microsoft, it is still possible to make it work. I'm not making and selling a commercial product, so microsoft can't sue me.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: MrJohnK on Sat, 31 August 2013, 12:25:19
Could the functions you want to implement be done with keystrokes, like the F keys or something like that?  It isn't horizontal scrolling though.  Not exactly media keys, but certainly would avoid having to write your own USB stuff.  My trackball has 15 buttons that can do anything a Teensy can do, including any keystrokes or mouse functions.

The Teensyduino keymap is on this page (scroll down near bottom to see the chart):
http://www.pjrc.com/teensy/td_keyboard.html

Also, I see that Paul has the windows media keys on his ToDo list (see note right below the chart on the page).  Maybe some encouragement might help him to move this up on the priority list?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Sat, 31 August 2013, 15:31:18
The mouse, media, and system keys I need are not in the standard arduino/teensyduino library files like I already said, which means I can't use them as is. That PJRC keymap is for just regular keyboard keys, and was one of the first things I looked at when I started this project. If Paul were to implement the keys I need he would still have the mouse and keyboard broken down into multiple functions instead of singular functions that I want and have seen examples of. In the future I will submit my altered files for Paul to integrate into the teensyduino library so that no-one else has to go through this nightmare again. (But right now I have to code them in the first place.)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Mon, 02 September 2013, 10:43:29
Yay, avago sensor is back in stock. Thanks John

The_Ed, I am about to buy some parts. How certain is it that that you will use the teensy 3.0? I realize that you can never be certain, but by the looks of it your code will need it, correct?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: MrJohnK on Mon, 02 September 2013, 12:27:21
I put only 4 sensors in the shop today, 2 sold already.  I have 62 more coming later this week.  My customer in Italy said that his order finally showed up this morning, so I could put the 4 I was hold for possible re-shipment up for sale.  Apparently, I had 13 people on the wait list since it went out of stock o.O
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Mon, 02 September 2013, 18:40:53
My code is for the teensy 3.0, it will NOT work with the 2.0 or ++ 2.0. It would have to be modified to work on anything other than the teensy 3.0, and I have no plans to do that at this time. But if a teensy++ 3.0 is released in the future I will probably support that.

Once the endpoint stuff is figured out and completed I will have 1.0 alpha to start debugging. Once alpha is refined I'll have beta (which I'll release to only a few people for testing). Once beta is refined I'll let the masses have access to RC (Release Candidate). When all the problems with RC have been resolved, the final 1.0 RTW (Release To Web) will be released. I have a feeling that 1.1 beta (which will be released to only a few people for testing) will come after 1.0 RC, but before 1.0 RTW. I have no plans for a 1.2 at this time.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: ggaljoen on Sat, 07 September 2013, 08:52:30
Found you 'Geeks'  :thumb: in the search for extra information.
Already got the specs for the sensor and lens, but did not found the mentioned STEP or EGIS files for the ADNS-6190-002, anyone?

My use would be for 3d printing filament tracking at the extruder. Received mine from Tindie.

Thank you MrJohnK for the sensor board and thank you The_Ed for feeding this thread!
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Sat, 07 September 2013, 15:11:27
Because of my harddrive issue and my car permanently dying I haven't had much time to look at code this past week. I have to go out used car shopping today...

I seem to be finding a lot of information on how to declare the endpoints in the USB device descriptor, but nothing really on how to actually send the data to them on an arduino... Can somebody point me in the right direction?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Mon, 09 September 2013, 01:57:54
Ahhh ****... From what I think I understand from something I just read - The information I need for the teensy 3.0 endpoints and data transmission will be somewhere in a 1227 page datasheet from PJRC, and some code examples I have found will ONLY work on the teensy 2.0 because it does things differently apparently... But I need to use the teensy 3.0, so this ****in sucks...

This **** on endpoints is seriously hard to understand... If I can just get this endpoint stuff figured out I would finally be able to start testing and debugging, but information is just so damn elusive on the subject...

I have no idea how long it will take to complete my code at this point seeing as I'm pretty much on my own in figuring this stuff out. (How many hours have I spent trying to figure out endpoints?...) It would be awesome if someone could help me out with the teensy 3.0 endpoints and data transmission.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: domoaligato on Wed, 11 September 2013, 16:29:55
have you tried asking on the pjrc forums? they are very helpful.
http://forum.pjrc.com/forums/2-Project-Guidance
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Wed, 11 September 2013, 16:36:33
The people that ask questions there usually already have their stuff completed, but just have some bugs somewhere. For them to be of help they would likely have to write out my endpoint stuff themselves... I don't know, maybe I'll ask for some references of how to do the endpoint stuff there when I have time to make an account and write down my situation.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: dorkvader on Thu, 12 September 2013, 12:52:27
It can't hurt. I'd ask myself, but I'm certainly not knowledgeable enough about such things to even do that.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: hanya on Fri, 13 September 2013, 13:02:22
I seem to be finding a lot of information on how to declare the endpoints in the USB device descriptor, but nothing really on how to actually send the data to them on an arduino... Can somebody point me in the right direction?
I have added forward/back buttons and horizontal wheel to arduino and mbed mouse libraries. I only needed to modify descriptor and data to be passed to the PC.
There is the documentation about how to define USB descriptor for the recent mouse by Microsoft[1].
"Device Class Definition HID" and "HID Usage Tables" are required to edit the descriptor[2].

I do not have teensy so I can not help to do it. But it seems "mouse_hid_report_desc" value  in arduino-version/hardware/teensy/cores/usb_hid/usb.c have to be hacked and also usb_mouse_class methods.

USBKeyboard class of mbed supports media control keys[3]. Its structure of the descriptor could be refered as an example.

[1] http://msdn.microsoft.com/en-us/windows/hardware/gg487477.aspx
[2] http://www.usb.org/developers/docs/hidpage/
[3] https://github.com/mbedmicro/mbed/blob/master/libraries/USBDevice/USBHID/USBKeyboard.cpp#L396
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Fri, 13 September 2013, 16:47:47
1 and 2 I have already found and been looking at. 3 I have not seen before, but it is just more descriptor data and not the sending of data from the teensy 3.0 to the computer. I appreciate that you took the time to make an account and post, but those links give me nothing that I need at this point.

I am currently going through chapter 40 of K20P64M50SF0RM.pdf, hopefully I'll find some useful info there. If the teensy 3.0 is anything like the 2.0, the endpoint data transmission will be controlled with registers.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: hanya on Sat, 14 September 2013, 02:06:16
As an example to add five button support and horizontal scrolling, here is the patch for Arduino:
Code: [Select]
--- arduino-1.0.5 (2)/hardware/arduino/cores/arduino/USBAPI.h 2013-05-18 04:48:38.000000000 +0900
+++ arduino-1.0.5/hardware/arduino/cores/arduino/USBAPI.h 2013-09-05 18:02:41.530330129 +0900
@@ -52,6 +52,8 @@
 #define MOUSE_RIGHT 2
 #define MOUSE_MIDDLE 4
 #define MOUSE_ALL (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)
+#define MOUSE_BACK 8
+#define MOUSE_FORWARD 16
 
 class Mouse_
 {
@@ -63,7 +65,7 @@
  void begin(void);
  void end(void);
  void click(uint8_t b = MOUSE_LEFT);
- void move(signed char x, signed char y, signed char wheel = 0);
+ void move(signed char x, signed char y, signed char wheel = 0, signed char pan = 0);
  void press(uint8_t b = MOUSE_LEFT); // press LEFT by default
  void release(uint8_t b = MOUSE_LEFT); // release LEFT by default
  bool isPressed(uint8_t b = MOUSE_LEFT); // check LEFT by default

Code: [Select]
--- arduino-1.0.5 (2)/hardware/arduino/cores/arduino/HID.cpp 2013-05-18 04:48:38.000000000 +0900
+++ arduino-1.0.5/hardware/arduino/cores/arduino/HID.cpp 2013-09-05 20:20:40.945700558 +0900
@@ -55,14 +55,14 @@
     0x85, 0x01,                    //     REPORT_ID (1)
     0x05, 0x09,                    //     USAGE_PAGE (Button)
     0x19, 0x01,                    //     USAGE_MINIMUM (Button 1)
-    0x29, 0x03,                    //     USAGE_MAXIMUM (Button 3)
+    0x29, 0x05,                    //     USAGE_MAXIMUM (Button 5)
     0x15, 0x00,                    //     LOGICAL_MINIMUM (0)
     0x25, 0x01,                    //     LOGICAL_MAXIMUM (1)
-    0x95, 0x03,                    //     REPORT_COUNT (3)
+    0x95, 0x05,                    //     REPORT_COUNT (5)
     0x75, 0x01,                    //     REPORT_SIZE (1)
     0x81, 0x02,                    //     INPUT (Data,Var,Abs)
     0x95, 0x01,                    //     REPORT_COUNT (1)
-    0x75, 0x05,                    //     REPORT_SIZE (5)
+    0x75, 0x03,                    //     REPORT_SIZE (3)
     0x81, 0x03,                    //     INPUT (Cnst,Var,Abs)
     0x05, 0x01,                    //     USAGE_PAGE (Generic Desktop)
     0x09, 0x30,                    //     USAGE (X)
@@ -73,6 +73,15 @@
     0x75, 0x08,                    //     REPORT_SIZE (8)
     0x95, 0x03,                    //     REPORT_COUNT (3)
     0x81, 0x06,                    //     INPUT (Data,Var,Rel)
+   
+    0x05, 0x0c,                    //     USAGE_PAGE (Consumer Page)
+    0x0a, 0x38, 0x02,              //     USAGE (AC Pan)
+    0x15, 0x81,                    //     LOGICAL_MINIMUM (-127)
+    0x25, 0x7f,                    //     LOGICAL_MAXIMUM (127)
+    0x95, 0x01,                    //     REPORT_COUNT (1)
+    0x75, 0x08,                    //     REPORT_SIZE (8)
+    0x81, 0x06,                    //     INPUT (Data,Var,Rel)
+   
     0xc0,                          //   END_COLLECTION
     0xc0,                          // END_COLLECTION
 
@@ -221,14 +230,15 @@
  move(0,0,0);
 }
 
-void Mouse_::move(signed char x, signed char y, signed char wheel)
+void Mouse_::move(signed char x, signed char y, signed char wheel, signed char pan)
 {
- u8 m[4];
+ u8 m[5];
  m[0] = _buttons;
  m[1] = x;
  m[2] = y;
  m[3] = wheel;
- HID_SendReport(1,m,4);
+    m[4] = pan;
+ HID_SendReport(1,m,5);
 }
 
 void Mouse_::buttons(uint8_t b)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Sat, 14 September 2013, 05:14:35
The teensy's aren't regular arduinos... (they use different files in \hardware\teensy\cores\teensy3\) And the teensy 3.0 is different than the teensy 2.0, which means I can't just use existing code examples. The teensy's seem to use registers and buffers to send the data to the endpoints that are described, so I have to figure out what does what to get my data into the proper buffers and what register magic has to be done for data transmission. So the components are: the endpoint descriptors, enabling the endpoints, the keycodes, the endpoint buffers, and the endpoint register stuff for data transmission. I can't really use the existing mouse and keyboard endpoints for various reasons, which is why I have to make my own from scratch. And that's why I need to figure out how to send data on the teensy 3.0, which is proving quite complicated and difficult (and this is what I need help on).

(I hope I'm being clear enough...)
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: metalliqaz on Mon, 16 September 2013, 12:12:56
Have these been integrated into any successful projects yet?  I bought one to have in my 'kit', but I would love to see some finished products.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: dorkvader on Mon, 16 September 2013, 15:21:58
Have these been integrated into any successful projects yet?  I bought one to have in my 'kit', but I would love to see some finished products.

I know mr. kicklighter has modified his own trackball. I am planning on modding some of mine, but haven't gotten 'round to it yet.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: metalliqaz on Mon, 16 September 2013, 15:34:38
I'd really like to make something special.  I need to try a good trackball for a while to see how I like it.  I wonder if there is anyone out there that is gaming with a trackball...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Mon, 16 September 2013, 15:52:47
If I can figure out this endpoint stuff it will become MUCH easier for people to add their own, or modify the existing ones. I haven't had time to finish reading chapter 40 yet, but my quarter will be done in like 2 weeks so I'll have some time then. I think I will only need 3 endpoints now (down from 4) because of some other code I've seen. EVENTUALLY this project will get further, but time has to allow.

I used to game all the time with my Dad's Microsoft Trackball Optical, it's just that today's monitor resolutions are too big for it's old optical sensor.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: dorkvader on Mon, 16 September 2013, 16:48:24
I'd really like to make something special.  I need to try a good trackball for a while to see how I like it.  I wonder if there is anyone out there that is gaming with a trackball...
Well, I highly recommend getting a "good" trackball with actual ball bearings. there are some new penny&giles units on ebay that the seller will let you have for $25 shipped that are very nice with their ball bearings. You will need to make an enclosure for them, however. I have a few trackballs with "good' bearings (assimilation, kensington (turbo mouse, none of this lame new stuff), penny& giles, itac, etc.) and it's much more worthwhile converting one of these than a trackball with lesser quality bearings (CST, newer kensington, basically everything)

Keep in mind that us microproducts now owns the penny&giles trackball line, and they have been branded as saic, traxsys, and another oem that I'm forgetting, could be trackerball. These are all very nice.

danaher (dynapar) trackballs are hit& miss. Mine is probably the worst trackball I own, as it sits on "plastic dots".

Finally, the feel of the trackball is greatly impacted by the quality of the ball. I strongly recommend gettign a new ball if you can. Pool balls are cheap and easy to get if your trackball supports the size.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: metalliqaz on Mon, 16 September 2013, 17:15:03
Wow that would be a huge trackball!  I've never seen something that size except on an arcade cabinet.

The problem with using a trackball for gaming is the fact that fingers you would normally be using to press buttons are used for moving the ball.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Mon, 16 September 2013, 17:28:18
That's why you use thumb operated trackballs for gaming (like the Microsoft Trackball Optical). Though I think having a pool ball sized thumb operated trackball would be too big.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: MrJohnK on Mon, 16 September 2013, 22:54:29
Quote
Have these been integrated into any successful projects yet?  I bought one to have in my 'kit', but I would love to see some finished products.
Quote
I know mr. kicklighter has modified his own trackball. I am planning on modding some of mine, but haven't gotten 'round to it yet.

To be exact, I designed and 3D printed my trackball.  Some pictures:
http://www.flickr.com/photos/8465641@N07/sets/72157633258917941/

I'm really interested in seeing how a good trackball mod on an existing commercial trackball body comes out.  When I started looking at the clearances inside of my old Trackman, it didn't look like there would be enough room to fit the better sensor in there, which is why I just designed a whole new trackball body from scratch.  This 3D printed one is my daily use trackball now.  It does really well for CAD work and gaming (I'm a recovering WoW addict). 

Some ball bearing would be nice indeed.  I just have three small set screws holding the Delrin ball in mine up.  I used those so that I could exactly dial-in the distance between the ball and sensor as it has a pretty specific distance it works well at (2.4mm) and has tolerance of only +/- 0.2mm.  Outside of that tolerance, it has issues and does not work so well.  It is great when tuned right though.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Tue, 17 September 2013, 03:19:03
I *may* have made a breakthrough on the endpoint stuff! But I likely won't be able to write the code and test it until after the quarter is over in 2 more weeks... I really hope this stuff works as it would be cool if I was able to figure it out by myself. But there will most likely be a few errors here and there, so I still may have to ask for help at PJRC. But I would feel a lot better asking for help with wrong code in places than no code in places.

But I still have this feeling that the buffers and offsets are gonna cause me more trouble... Though I wont know until I try.

EDIT: Alright, I think I have an even better grasp of the buffers and offsets now (my head hurts...). Here's to hoping I'll have 1.0 alpha completed within a month (because of school).
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Mon, 23 September 2013, 17:37:22
Alright, so here's another small update: (Yes, I'm neglecting my homework during finals week...)

1. It *may* support smooth scrolling that's adjustable while powered on (at least down to 1/4 of a notch, but *maybe* down to 1/120 of a notch)
2. It *may* be possible to send both the upper and lower bytes of X and Y movement (if it isn't possible, then the excess over ±127 just has to be shaved off and added to the next report)
3. If either/both of these make it into the code, the mouse will likely not work in the BIOS. The culprits responsible for that will be the Report IDs required to send the feature report for smooth scrolling, and the 2-byte mouse movement (so you'll have to comment out/in parts if you need it to work in the BIOS)
4. Horizontal and smooth scrolling are supported by Vista and up, so If you're using XP or lower you'll also have to play the commenting game.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: dorkvader on Mon, 23 September 2013, 17:48:42
3. If either/both of these make it into the code, the mouse will likely not work in the BIOS. The culprits responsible for that will be the Report IDs required to send the feature report for smooth scrolling, and the 2-byte mouse movement (so you'll have to comment out/in parts if you need it to work in the BIOS)
I don't think any of my pointing devices work in any of my BIOS's, or will this affect EFT / UEFI compatibility?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Mon, 23 September 2013, 18:08:56
3. If either/both of these make it into the code, the mouse will likely not work in the BIOS. The culprits responsible for that will be the Report IDs required to send the feature report for smooth scrolling, and the 2-byte mouse movement (so you'll have to comment out/in parts if you need it to work in the BIOS)
I don't think any of my pointing devices work in any of my BIOS's, or will this affect EFT / UEFI compatibility?


I don't know for sure, just that the document said it wouldn't work.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Wed, 25 September 2013, 12:24:30
Just got the sensor. Is the lens supposed to be loose? I don't get how you mount it so that it stays in place. There are pins which roughly positions the lens in front of the sensor and LED but I would have assumed that positioning the lens requires some precision. Are you supposed to mount it so that the lens is held firmly against the PCB or glue the pins on the other side? If I only put the lens in place, it will fall down when I turn it upside down. This worries me a bit.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Wed, 25 September 2013, 13:32:17
I *think* the lens is supposed to be held firmly against the laser sensor pcb, and then the resulting assembly needs to be held firmly against the ball socket/bottom of the mouse (with the proper liftoff distance set).
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: MrJohnK on Thu, 26 September 2013, 19:56:11
The lens is designed to be mounted on the inside of a mouse or under the socket of a trackball such that the super structure holds it in place.  If you need to have it dangling with no support, you can "stake" the plastic pins with a soldering iron once they are in place above the chip.  Essentially, making a sort of mushroom top shape out of the alignment pins so that the lens is no longer removable.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Fri, 27 September 2013, 07:54:56
But how do I ensure that it is located exactly in front of the sensor? There are many possible solutions to not make it removable as you say, but isn't the position of it crucial?

I haven't measured how much it moves but I would estimate that it is a good 0.3mm in the x-y plane The image output ought to become very distorted if the lens is placed off center. The low precision of this assembly concerns me a great deal.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: MrJohnK on Fri, 27 September 2013, 08:10:14
The lens and the sensor IC were designed to work together within these tolerances, originally by Avago.  Agreed, there is a little bit of play, however, I've never been able to detect any issues as a result in the few years I've been using this form factor (I originally started with the ADNS-9500).  The "stake" process is described in the datasheet as an acceptable way to attach the lens to the sensor IC. While that doesn't directly answer your question, I believe the small amount of wiggle room is within acceptable tolerance as it was designed to work this way as a matched set from the manufacturer.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Fri, 27 September 2013, 09:10:25
I don't understand how that can be the case. The importance of the distance from lens to tracking surface has been stated several times, and that distance is longer than that between the lens and the sensor. If you have a tolerance of the placement of the lens relative the tracking surface the tolerance needs to be tighter for the placement of the lens relative the sensor since it is a shorter distance and simple optical laws apply. The lens has to follow the laws of physics. This either means that the tolerance for the lens to tracking surface is heavily exaggerated or the tolerance of the lens to sensor is is tighter than indicated.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Fri, 27 September 2013, 14:48:33
Liftoff distance is a setting. So if you are placing it farther from the surface you will have to increase that setting, conversely if you are placing it closer to the surface you will have to decrease that setting.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Mon, 30 September 2013, 02:59:59
Small update time again:

I think it is most logical to define 4 scroll wheels (standard 1-byte and smooth 2-byte), with the 2 smooth scrolling wheels in my third custom endpoint that also contains the system and consumer controls. Some applications may not support smooth scrolling, thus it wouldn't make sense to make only 2 smooth scrolling wheels.

I am also contemplating defining 2 sets of X/Y axes (1-byte and 2-byte) so as to try to make it work in the BIOS (I believe this is for UEFI support). I would then put those secondary scroll wheels and X/Y axes in a fourth custom endpoint, leaving just the system and consumer controls in the third. I think this might be better in the long run as then I wouldn't have to change anything in the future if I get a motherboard with UEFI.

But of course these duplicates will increase the amount of commented out code I'll have to include... I think I'll only test the parts I'll be using in my trackball mod before passing it on to a few other people for a more thorough testing in their own projects.

Each endpoint has a single function to send data, which is much more efficient. I still don't understand why the stock code breaks them up.

I wonder how many times I've revised the code by now... Hopefully I don't mix up the versions of the pieces...
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: dorkvader on Mon, 30 September 2013, 06:50:45
I wonder how many times I've revised the code by now... Hopefully I don't mix up the versions of the pieces...

are you using some sort of version control like mercurial?
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Mon, 30 September 2013, 14:29:50
I wonder how many times I've revised the code by now... Hopefully I don't mix up the versions of the pieces...

are you using some sort of version control like mercurial?

Nope, and I've never heard of mercurial... It's just folders...

I'll try to hammer out some more code near the end of the week after I get some orders and keyboard mods out.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: MrJohnK on Mon, 30 September 2013, 20:04:50
Ed,
I'm just curious, have you been able to hook the sensor up to your Teensy 3.0 at least get some basic SPI hardware communication established and movement data sent?  I've not tried it on a Teensy 3.0, so just wanted to hear it it works as expected.

-John
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Mon, 30 September 2013, 21:03:21
My breakthrough on endpoints was only on the 17th, and my quarter just ended so it's break week this week. Which means I *may* get 1.0 alpha completely written, but won't have time to test it until later. Most of my time spent on this has been research (mostly on endpoints...), and making changes to code. It's just a matter of time, it'll get done eventually. Also with each change I make I have to cascade changes to other parts, which is why I am a little concerned with confusing the versions. I really hope that the first tests go without a hitch, but I know there will be something wrong. No code is perfect on the first try, there's always some simple mistakes that are bastards to track down.

I still remember writing c++ in the campus library a few years ago. Taping and stapling pieces of paper together with lines between them for the flow of the voids. Good times.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Fri, 04 October 2013, 01:14:12
I guess it's a good thing when I find bugs in the stock teensy code, but you'd think they would all be fixed by now... Oh well, as long as I find and fix all the ones that affect me it'll be good enough. It's also probably not a good thing that one computer has teensyduino 1.15 and the other has 1.16. It still amazes me with how much code and documentation I have gone through, and how much I've had to figure out and understand to do these custom things with a teensy. I'm probably not gonna finish the code before school starts again next week... Oh well, I've been doing other things and I shouldn't stress myself out during break week.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: damorgue on Thu, 10 October 2013, 09:35:24
Has the compatibility from the older version been heavily broken? The reason why I am asking is to ask if I could get one of the earlier firmwares to look through. If nothing else, which pins as you planning on using for what on the teensy? I am currently planning placement and electrical connections which have to be made between the parts atm. Something like Pin 1 and 2 for switch A and B, and which pins will communicate with the sensor would be quite useful for now.
Title: Re: High Speed Laser Optical Sensor (Avago ADNS-9800) [$28 shipped - DONE]
Post by: The_Ed on Fri, 11 October 2013, 00:27:21
Pins are mapped by the user in a section near the top, but there are only 2 pin options for things like SCK, MOSI, and MISO. Pretty much anything else can use any of the digital pins.

One of these days I'll have some time time to test the code on the hardware, but today I did some car stuff which is more important than code.