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:

37 comments :

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

    Good work BTW.

    Carlos

    ReplyDelete
  2. 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?!?!

    ReplyDelete
  3. 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..

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

    Did you programmed the fuse bits?

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

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

    ReplyDelete
  7. i complied the code using AVR Studio 4.

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

    ReplyDelete
  9. 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

    ReplyDelete
  10. 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

    ReplyDelete
  11. This comment has been removed by a blog administrator.

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

    ReplyDelete
  13. sir how should i proceed with arduino uno r3 board?

    ReplyDelete
  14. hi, i have the same problm, device not recognised

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

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

    ReplyDelete
  17. 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

    ReplyDelete
  18. 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

    ReplyDelete
  19. This comment has been removed by a blog administrator.

    ReplyDelete
  20. should we burn usbdrv.c with main.c in atmega8
    or burning main.c only will work?

    ReplyDelete
  21. Can anyone say which all files are to be programmed to atmega8?

    ReplyDelete
  22. hey you will get hex file to burn into mcu not the .c
    in any project it will give only one hex file those usbdrv.c are just supporting source files. but your main logic will be in main(target). to you will be dumping main.hex

    ReplyDelete
  23. This comment has been removed by a blog administrator.

    ReplyDelete
  24. not working ....how should i sfind out my error

    ReplyDelete
  25. 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?!?!
    rc boats

    ReplyDelete
    Replies
    1. In this project I am using VUsb library. That is written by considering 12MHz external clock.

      Now why to use external crystal ? Because the USB require an accurate clock and the internal RC oscillator will not be very Accurate. It can vary from chip to chip, room temperature, chip temperature, age etc. Also I am not sure if it can reach till 12MHz and no pll multiplier. I think internal can be max 8MHz but USB need a higher clock to emulate the USB device.

      Delete
  26. Hi, Sir ! fantastic project ! congratulations !

    Unfortunately, doesn't work in my machine. My O.S is Windows 7 x64. I'm using a Atmega328p as microcontroller.

    I replaced the file "main.c" and in the "Makefile" , I changed the microcontroller to "atmega328p" and the fuse bits. the ATMEGA328P fuse bits are H: 0xD9 and L: 0xE2. And I change the programmer to "avrisp", because i'm using a "Arduino as ISP".

    What do you suggest should be wrong in this project? I should burn the fuse bits of ATmega328P as the fuse bits of ATmega8 ?

    Thank you very much in advance .

    ReplyDelete
  27. I don't feel comfortable using my mouse without mouse pad.I mean it feels to slow and inefficient working without it to me.So I have selected one mouse pad from ergonomic mouse pad reviews

    ReplyDelete
  28. im doing a similar project...im not allowed to use the app installed in the pc...is there any other alternative in which I won't have to use the app..
    plz help

    ReplyDelete
  29. I am trusting the same best exertion from you later on too. Actually your exploratory writing abilities has roused me. IT Project Management Company

    ReplyDelete
  30. i am very picky about baby toys, so i always choose the best ones; electronics quality control

    ReplyDelete
  31. Save files as few as possible. You have to create folders for several file types and according to use; five folders for your desktop folders may be enough for easy file retrieval. The Recommended hp all in one computers

    ReplyDelete