CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Optical mouse with PIC

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Gerhard



Joined: 30 Aug 2007
Posts: 144
Location: South Africa

View user's profile Send private message Send e-mail

Optical mouse with PIC
PostPosted: Wed Sep 17, 2008 4:08 pm     Reply with quote

Hi. I searched on the site to see if someone has done this before but i cant find anything. I want to use a normal optical mouse found in PC's and strip it to make that a distance moved sensor. Has anybody done this type of thing before using CCS and PIC? If posible can someone point me in the right direction such as type of protocal used and some reference sites to have a look at.
Thanks
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

Re: Optical mouse with PIC
PostPosted: Wed Sep 17, 2008 9:12 pm     Reply with quote

Gerhard wrote:
Hi. I searched on the site to see if someone has done this before but i cant find anything. I want to use a normal optical mouse found in PC's and strip it to make that a distance moved sensor. Has anybody done this type of thing before using CCS and PIC? If posible can someone point me in the right direction such as type of protocal used and some reference sites to have a look at.
Thanks


If this is a PS-2 interfaced mouse, it would be best if you did not strip it, but rather leave the interface electronics in place and make your PIC simulate a PS-2 host. Unlike a mechanical mouse, the optical mouse can accumulate some position error after moving back and forth. I don't know your application, but if it requires no cummulative error, then you better look for a different distance sensor.
_________________
Robert Scott
Real-Time Specialties
Embedded Systems Consulting
Gerhard



Joined: 30 Aug 2007
Posts: 144
Location: South Africa

View user's profile Send private message Send e-mail

PostPosted: Thu Sep 18, 2008 4:12 am     Reply with quote

The idea is to use as much of the mouse as possible and if it is like the old wheel mice that had the bal just use the X and Y coordinates to detect if an object has moved and how far it has moved refered to the ground or some other object. Basicaly the same as a pc does it but just manipulate the data sent to my aplication. I would use it to measure how far a small remote controlled car has moved in the X and Y direction. If the mouse uses something like rs 232 or i2c i would like to find out what the packet is that is sent and how it would be possible in CCS to read and decode that data. I would preferably use a USB type of mouse but if that is not possible i would switch to PS2.

Thanks for the reply
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

PostPosted: Thu Sep 18, 2008 6:14 am     Reply with quote

I assume your remote control car is not going to go faster than the upper limit of the mouse decode speed. The mice have been designed for manual pointing use and do not have the capability to read speeds that are much faster than that.

The logic of the mouse is all encapsulated in the chip inside it. If you want to interace to it using USB, then you will have to make your PIC play the role of a USB host, which is 100 times harder than playing the role of a PS-2 host.
_________________
Robert Scott
Real-Time Specialties
Embedded Systems Consulting
Gerhard



Joined: 30 Aug 2007
Posts: 144
Location: South Africa

View user's profile Send private message Send e-mail

PostPosted: Thu Sep 18, 2008 9:45 am     Reply with quote

Thanks.
The project is just to see if something like this could be possible so even if the speed is the problem it is just to check if it can be done.

I found a website that explains how the ps-2 protocol works, but I see that the clock gets generated by the mice so the pic will need to look at the clock generated then use that for the coms. Sounds almost like I2C. Where would be a good starting point on the project or does anyone have some advice on how I would be able to do this.

Here is a link to that site.
http://www.computer-engineering.org/ps2protocol/

Thanks in advance
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Thu Sep 18, 2008 12:22 pm     Reply with quote

Did you have a look at the CCS provided example ex_mouse.c? This example is the other way around, it has the PIC simulate a mouse, but should give some useful pointers.
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Thu Sep 18, 2008 1:11 pm     Reply with quote

I played with this a few years ago, mostly from the mechanical point of view and I never got the software to work. But I did find I could use lenses to increase the stand-off distance and top speed at the cost of resolution. It requires a lot of light but I had a video camera that needed strong light anyway.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group