Click here to Skip to main content
14,028,577 members
Click here to Skip to main content
Add your own
alternative version


35 bookmarked
Posted 16 Mar 2009
Licenced CPOL

USB IR with c8051

, 18 Jul 2014
Rate this:
Please Sign up or sign in to vote.
USB IR with c8051


View large


This is a WinLirc like application that uses USB toolstick instead of RS232 and suits all TV remotes.
It can remotely control your computer with IR remote control of all manufacturers and needs only a toolstick from silabs.
This toolstick can be either Toolstick Base adapter (F326) or toolstick debug adapter (F321).
The same applies for IR sensor - suits all of them that operate on 5V and receives 38KHz signal(TSOP -1708, IRM8752, practically any IR receive module) or any 3,3V if you supply 3.3V and make changes to schematics.

Of course IR-sensor does not bring TX-pin up enough, you need to supply 4,7K resistor between 5V and RX-pin for debug adapter input (something like this).


Look also at Counter_based_c8051.aspx and Toolstick_LCD_with_c8051.aspx from my previous work and projects that using the same 'debug adapter'.

Using the Code

You can put the named IR codes to 'Settings.ini' file located in app.path folder and teach the program to understand the remote by setting ShowTheMatch=true.
Then you can copy-paste code between '' symbols from main window to 'Settings.ini'.
Repeated codes are marked with ':Nr'. Really it's the ir-repeat code '01' that remote sends when you hold down the button for a long time.
It's not important- but when you want to increase 'volume' by remote - it's convenient to hold the button instead of repeatedly pushing it again and again. 
To not confuse the sent signals with others that are repeating - the program periodically resets the actual signal to zero (that means when remote does not send code for 100ms, it resets the sent signal to zero - and the program waits for the actual code again).
This is needed to eliminate the IR-detector faulty noise signals (due to interference from luminofor lamps or other).


By default, the signal length is put to catch 22-bit length signals- you can change that accordingly to match your remote in code.

If CurIndex > 22 Then
    For i = 0 To MaxCodesCount
        If Codes(i).CodeBinary = Code Then
            Code = Codes(i).CodeName
            match = True
            Exit For
        End If
    Next i
        If match Then
            Interval = 0
            RepeatCount = 0
            RaiseEvent ReadMess(Code & ":" & RepeatCount & vbCrLf, 1)
            PrevCode = Code
            bRepeat = True
        Else 'not match found
            If ShowNotMatching Then RaiseEvent ReadMess_
        	      ("not match '" & Code & "'" & vbCrLf, 1)
                bRepeat = False
        End If
    'Code = ""
End If

Notify.dll acts like intermediate notification events messenger for the main app.
WindowTitle.dll periodically checks for a window.hWnd number and notifies the main app through notify.dll the changes.

Sample Settings.ini:


In my app, I send messages to a window named 'VLC DirectX video' and 'TV'.
In addition, I can remotely 'shut down' the computer.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Estonia Estonia
No Biography provided

You may also be interested in...

Comments and Discussions

QuestionLong in the tooth. Pin
SteveHolle18-Jul-14 9:56
memberSteveHolle18-Jul-14 9:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web02 | 2.8.190419.4 | Last Updated 18 Jul 2014
Article Copyright 2009 by ingvar8
Everything else Copyright © CodeProject, 1999-2019
Layout: fixed | fluid