A remote control for my PC

Inspired by the XP MCE, I decided to have a remote for my PC so that I can skip thru the channels easily and my mouse would be happy J

Googling, I got many matches for my idea. One has a usb interface with the ATtiny13 Microcontroller chip. Its hardware part was simple but programming a chip was not so easy for me as in our lab. I noticed the backend software used in it – LIRC [http://www.lirc.org] . It is a IR transceiver compiled for Linux developed for the same purpose. From the lirc homepage I got the windows version of it - WinLIRC. It demands only a simple receiver section with RS232 interface [http://cmail.info.kuzbass.net/%7Enav/WinLIRC.htm].

IC1 – 78L05 voltage regulator

IC2 – TSOP1738 IR receiver

C1 – 4.7uF

R1 – 4.7K

D1 – IN4148

And a Serial plug



The circuit part is over and for software I used the WinLIRC server and used VB6 for my customized software.


To use WinLIRC from VB, I used the code from Martin Kubik jim@jtan.com

Include the Microsoft Winsock Control 5.0 Components an Create an Object like Winsock1. Open connection to the WinLIRC Server like in the Form_Load() Procedure. Since now, the open was O.K, you can receive messages with the Winsock1_DataArrival() Procedure. Every time WinLIRC recognizes a remote key it will be send to all connected (max. 6) programs. In this case the Winsock1_DataArrival() will be called if data is received from WinLIRC.


Private Sub Form_Load()


    Dim strLocalIP As String


    strLocalIP = Winsock1.LocalIP

    Winsock1.Protocol = sckTCPProtocol

    Winsock1.RemoteHost = strLocalIP

    Winsock1.RemotePort = 8765

    Winsock1.Connect


End Sub


Private Sub Winsock1_DataArrival(ByVal bytesTotal As Long)


    Dim strData As String

    Dim strRemoteHex, strRemoteName, strRemoteKey As String

    Dim intRemoteIdx, intSeperatorOne, intSeperatorTwo As Integer


    Winsock1.GetData strData, vbString

    Text1.Text = strData    'Messagestring from WinLirc


    strRemoteHex = Left(strData, 16)

    intRemoteIdx = Val(Mid$(strData, 18, 2))


    intSeperatorOne = InStr(21, strData, " ", vbBinaryCompare)

    strRemoteKey = Mid$(strData, 21, intSeperatorOne - 21) 'Code of the Key from Remote Control


    intSeperatorTwo = InStr(intSeperatorOne, strData, Chr(10), vbBinaryCompare)

    strRemoteName = Mid$(strData, intSeperatorOne + 1, (intSeperatorTwo - intSeperatorOne) - 1) 'Name of the Key - defined in WinLircServer


    Text2.Text = "KEY:" & strRemoteKey & " Control:" & strRemoteName


End Sub


Sending commands should be as simple as:


    Dim sendstr As String

    Dim password, remotename, buttonname As String


    sendstr = (password & " " & remotename & " " & buttonname & " " & times_to_repeat & vbLf)

    Winsock1.SendData (sendstr)


times_to_repeat is an optional parameter the default value is "0"


I didn't find the remote configuration file for my Thomson ColorTrack TV Remote from that long list on their site. So I had to introduce every button of the remote to the WinLIRC and it made the config file.

I can now even shut down my computer from my bed! Its all simple trix of the technology.

Friday, January 18, 2008 | posted in | 0 comments [ More ]