control pc mouse using arudino + photoresistors?

hey i'm new to the microprocessor programming and everything and i just got the arduino and i'm pretty hyped. i was wondering if it was possible to control the mouse of a pc mouse using an arduino and photoresistors without buying any extra products since i don't have money. for example, if i move my hands around the photoresistors, the mouse should move depending the the analog read of the photoresistor.? what kind of library do i need to do this or what function do i use?

please help

How many photoresistors, how are they placed, and what will they detect?

A mouse is a physical device. Moving it with a photoresistor is not going to be possible. Unless the Arduino is controlling a robot arm, which is holding the photoresistor, and using it as a push stick.

If you mean that you want to control the PC's cursor like a mouse, then that is possible. All you need to do is program the Arduino to act like a USB master instead of a USB slave. You do have a Uno, right? If not, that isn't possible.

Making the Uno act as a USB master is most definitely not a beginner project.

PaulS, anyone would think you are trying to be difficult :wink:

Yes, this is possible, you can have your arduino take data from the photoresistors (connected in a voltage divider to the analog inputs - you only need an extra resistor for each photoresistor) then you can send serial data to your computer (I will assume you are using Windows as you have not said) and use software such as Serial Keys or AAC Keys to emulate mouse movements.

Now you need to go do research based on that info :slight_smile:

This idea will however, not be very accurate and will not work if the ambient lighting changes.

Mowcius

PS, just for your info, it's arduino...

PaulS, anyone would think you are trying to be difficult

Didn't even have to try on this one. It was too easy.

I sometimes wonder whether there's a generation of tinkerers that are somehow under the impression that photoresistors detect hands, or movement, as opposed to light levels.

I sometimes wonder whether there's a generation of tinkerers that are somehow under the impression that photoresistors detect hands, or movement, as opposed to light levels.

Well if you're in the dark and add some LEDs then they can, kinda :wink:

I think it is also possible to do this with processing. It was too late at night for me to understand the program that I saw, but it was supposed to control the mouse cursor. You would just setup a serial link between the Arduino (Uno or 2009,) and processing.

It would be terribly efficient, and could even have noticeable lag, but it would work.