banner

Friday, July 13, 2012

TV remote controlled computer mouse (an avr VUSB project)

 


 Hi,
    While laying in bed and watching movies on my laptop, I used to think if there is a remote control, it will be easy to pause, play, fwd, rev, adjust volume, play next etc etc without going near to the system. Then I planned to make a remote control. I don't have a bluetooth mouse. There are many options infront of me. We can do it easily using AVR microcontroller because there is a great VUSB project :-). Using vusb library, we can implement a low speed software usb port(slave) on avr microcontroller. In the vusb library, there is an example of hid-mouse implementation in which the author used the usb report descriptor same as that observed on a logitech usb mouse. I then added few more lines of code to it to make it receive and decode RC5 signal from a philips tv remote and to send the corresponding mouse events to the system using vusb library. I believe this is the best method because it doesn't require any special driver in pc since it is a HID device. Also it works on almost all avr microcontroller(tiny, mega etc) and it doesn't require any usb to serial converter or any special hardware and it is cheaper. Also it is platform independent. It will work similar to that of a usb mouse in windows, linux & mac . I used obdev's shared VID/PID pair(0x16c0/0x5dc). The same pair is used in usbasp, so the usbasp driver should be uninstalled(if it is installed earlier) and deleted otherwise it will not work in windows.
       Hope all avr lovers have heard the famous USBASP AVR ISP programmer and most of them might have used/still using this VUSB based stuff. I then made the circuit design almost similar to that of the usbasp so that any one can try this easily on the same USBASP hardware just by replacing the atmega8 with another atmega8 programmed with the new hex from this project. Also we need to connect a TSOP 1738 IR receiver module to the USBasp hardware and need to connect it's o/p to the INT1 pin of Atmega8. Finished! Hardware is ready... Now we can plug it to usbport and use it is as an RC5-Mouse. We need a philips TV remote with RC5 protocol to test it.
       RC5 decoding is done using external interrupt and a timer. The mouse data consist of 4 bytes. The first byte is the mouse button states, the next two are dx and dy (increment in x and y coordinate, signed value) and the last byte is the wheel displacement which is also signed. We need to set the vaues of this four byte structure and then need to call a vusb function  "usbSetInterrupt" to send the mouse data to system. There is a very good vusb tutorial at codeandlife.com. Also you can check out the vusb home page.

Usage & Features:
  • 8 directional navigation of mouse pointer. (remote buttons - 2,4,6,8, 1,3,7,9)
  • Accelerated mouse movement for intelligent fast movement. ie the mouse pointer speed increases on holding the above mentioned navigation keys.
  • For fine adjusting the position, release the key and press it again step by step.
  • Left click - button 5
  • Right click - button 0
  • Mouse wheel - volume- and volume+ button
Pics:
I used my usbasp programmer hardware for the purpose. Soldered a TSOP1738 on the usbasp board.


 Circuit diagram: (added tsop 1738 to existing usbasp circuit diagram)

5v supply is taken from the USB. We should not connect any additional power supply, it will damage the usb port and even the system...
 Also it works with atmega328p but it require some modification in few register names. Code for this controller is also included in the source because this is most commonly used arduino chip.(port folder). The default main.c file is for atmega8.

Source code:

Comments:

24 comments:

unais said...

excellent work....

coke said...

Hi, what is that 100E component in the schematic ?

Good work BTW.

Carlos

Vinod.S said...

100 ohms

rashboy said...

im kind of newbie....
im working on a similar project...using (atmega32A)...
can u please explain what is the need for the 12MHz crystal here... why dont we use the internal clock of the MCU?!?!

Hemanth Kumar said...

Hi Vinod...
i made this pcb & burned the hex file..& when i connect it to PC, it is saying that "USB Device not Recognised"


am using windows7, 64 bit & also am using prog isp softwarefor burning hex files..

Please help me out..

Vinod.S said...

Most probably, I think you missed the fuse bits....

Did you programmed the fuse bits?

Vinod.S said...

By default, the fuse bits are programmed for 1MHz internal RC oscillator...
See the required fuse bit values in the Makefile. (for atmega8)

Hemanth Kumar said...

ya...i programmed fuse correctly..
H_F=c9
L_F=ff

Hemanth Kumar said...

i complied the code using AVR Studio 4.

Vinod.S said...

FUSE_L = 0x9f
FUSE_H = 0xc9

Hemanth Kumar said...

am using avr dude prog isp....
it will cause any problem?

Vinod.S said...

I don't think so..

anil bhaskar said...

hey.. its a awsm prjct.... i tried to make it but its not working . i burnd fuse properly. basically i dont hv a philips remote i hv the other one. so can u tell me its just bcoz of remote . but in ma remote there iz also hv RC5 protocol.... so need hlp ......
thanks

nurul said...

hi vinod i m new in avr so how to set fuse bits in ic, i m using zif programmer (from vega robbokit), so, fuse bite setting is required in zif programmer?

thankx a lot

Sophie Tyler Neil said...

This item is really hard to find, I wanted a brand new one so I searched all over the net. Luckily for me, I was able to find one at buy and sell philippines. Its really far but its worthed.

Hesam.time said...

windows notify "USB device Not Recognized"
What shoud I do ?

Jitender Sharma said...

sir how should i proceed with arduino uno r3 board?

Admin said...

hi, i have the same problm, device not recognised

Puneet Kumar said...

hello sir
do we need any device driver for this project
?

Dormeo said...

System device driver has stopped responding any suggestions how to trouble shoot the gadget.
Interactive Board

sidd rocks said...

Hi,

I dont know how you people like such subjects, in school / college i always running from this subjects, but i always caught by my parents /teachers when result came, i was not very clear to understand this. Hats to you guys

Thanks sharing with us, and making my memories fresh
Fini

Riya Malhotra said...

There is some issue with my desktop it sometimes display error regarding graphic driver. I tried updating the driver but its of no use.

Cheapest Laptop

Enigma Hernandez said...

You are Awesome!!!! seriously

Thanks a lot!

david james said...
This comment has been removed by a blog administrator.

Post a Comment

SHARE IT on FB