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