Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Controlling cursor using PIC18F4553 via USB

Status
Not open for further replies.

polarsnake

Newbie level 4
Joined
Jun 26, 2011
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,350
Hi everybody! I'm doing a project now that uses EOG signals (signals picked up by electrodes on the eyes) to control mouse cursor. So basically what it does is that the user will use his/her eyes to move the cursor and navigate the PC. I'm using PIC18F4553 and it is to be interfaced with a PC via USB.

I know there are 3 main things that I would have to tackle in this project:

1) Analog to Digital Conversion (eye signals into microcontroller)
2) USB interfacing
3) Translating the signals into mouse movement

-----------------------------------------------------------------------------------------------------------------------

I have been told to use the USB framework that has been provided in the Microchip website to aid me in interfacing the USB, however after downloading it I have no freaking clue how to use it. Can someone please help me in this?

And I have already started on the analog to digital conversion part and have already written a pseudo-code for it. Can anybody tell me if I'm on the right track here?:

#include <pic18f4553.h>
#include <delays.h>
#include <adc.h>
#include <stdlib.h>

int result;

dec convert(void);



void main()
{
ADCON0=0x01; //select channel AN0
ADCON1=0x0E; //RA0 is configured as analog input
ADCON2=0x84; //Right justification and manual acquisition
TRISA=0xFF; //RA0 is configured as input, the rest of the pins are unused
TRISB=0xFF; //Port B all unused
TRISC=OxFF; //Port C all unused
TRISD=0xFF; //Port D all unused
TRISE=0xFF; //Port E all unused

while(1)
{
result = convert();

if(result>=xxx && result<=xxx) //xxx to be replaced with values later
{
//insert code here to make cursor click
}

else if(result>=xxx && result<=xxx) //xxx to be replaced with values later
{
//insert code here to make cursor move up
}

else if(result>=xxx && result<=xxx) //xxx to be replaced with values later
{
//insert code here to make cursor move down
}

else if(result>=xxx && result<=xxx) //xxx to be replaced with values later
{
//insert code here to make cursor move left
}

else if(result>=xxx && result<=xxx) //xxx to be replaced with values later
{
//insert code here to make cursor move right
}

} //end of while(1) loop


} //end of main

dec convert()
{
Delay10TCYx(3); // Wait for required acquisition time (6us)
ConvertADC(); //start A/D conversion
while(BusyADC()); //wait for completion
result = ReadADC(); //read result
CloseADC();
return(result);

}
 

luben111

Advanced Member level 1
Joined
Mar 2, 2002
Messages
491
Helped
111
Reputation
223
Reaction score
107
Trophy points
1,323
Location
UK
Activity points
3,907
I have seen in the net some working projects where they use standard WEB camera placed close to the eyes and some software to track the iris shape. The final result is that you an precisely track where you're looking without using additional uP
 

polarsnake

Newbie level 4
Joined
Jun 26, 2011
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,350
Umm the problem now is that I have to use eog signals to induce cursor movement. I'm not supposed to use any other methods
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top