Python Development

Welcome to Python!

Dateline: Aug. 4 2011:

  • The current IrTrek 0.97c Python Code Base is going through a complete rewrite and the new code will not be released until around the end of 2011. So, I do not recommend diving into the IrTrek Python libraries until that release. This Wiki page will have that release information when it happens.
  • The manner that Virtual Remotes are encoded will completely change, I hope to create an open source standard for this. Or if there is anything out there already. So, I do not recommend diving into creating new Virtual Remotes at this time.
  • Below are steps to get started with Python in general and with some of the developments we are working on.

Thanks, Mark Adams, Cisco, markccc aat geod doot com

Eclipse / Aptana

  • Install Aptana Studio 3 (We may call it Eclipse below)
  • In Preferences, change the theme to "Eclipse Theme" if you like it better.
  • Change the Workspace to "c:\at_root_irtrek" which you should already have installed.
  • Create a "PyDev" project named as "src"
    • Set Python interpreter as "C:\at_root_irtrek\support\portable\py\App\python.exe"
  • Refresh
  • Open "irtrek\pytronix\app_irtrek\"
  • Press F9, if the IrTrek app opens, you're in!
  • Exit IrTrek app

Serial Test

  • Open a serial terminal on the IrTek7 Com port
  • 115200 baud, 8 bits, no hardware flow, no parity.
  • I use TeraTerm Pro Web 3.1.3
  • Type "v" to see IrTek version
  • Type "iR0" to enter "rec" recieve mode.
  • Place a remote up to the black LED (photo diode) on the IrTek7 and note signals received.
  • Type "v" to see IrTek version and drop out of receive mode.
  • Close or disconnect serial terminal.

NEC Decoder Test

  • Make sure the IrTek7 is powered (Not just from serial port).
  • In Eclipse open irtrek\pytronix\app_irtrek\decoder_code\
  • At the top of this file edit the below line to the correct Comm port, like if COM5:
    • CommPort = '5' #COMM 5 Serial Port
  • Launch file by pressing F9, should output "<rec on>"
  • Place a remote up to the black LED and see if NEC are decoded!
  • Hope it works!


Testing the NEC Codes

  • Using the Z368 remote, the decoded values should match the Z368-NEC code page.
  • For example the key1 code is: 40ff01fe
  • The full IrTek Command would be: t ffff 16 4 40ff01fe 0, no spaces.
  • Going back to the Serial Test, send the following: tffff16440ff01fe0
  • See if the settop receives a "1" code.

Decoding other IR Protocols

  • Currently, decoders for the following are (somewhat) supported:
Protocol Code Notes
SA56 08 Classic SA at 56KHz
SA36 09 Classic SA at 36KHz
RC5 0a RC5
MOTO 15 Motorola
NEC3 16 Standard NEC (use
  • If you look at irtrek\pytronix\app_irtrek\lib\ you see this table.
        self.decoder_protocols = [
  • The full matching logic is not done, so use commenting to just use one at a time for now.
  • The NEC decoder has not even been added.
  • When this logic is finished, all Python decoders will have a try at the raw data.
  • If any make a match, it will display.
  • This Universal IR Decoder Project will be an on-going effort as open source for a long time.
  • To engage a decoder, first comment out all the others in the above self.decoder_protocols.
  • In the IrTrek "IrTek" tab while in Operational Mode, click Tek7 Decoder On.
  • Some of the decoders just print to the background Python CLI window and not the GUI window.

Indentifying IR Protocols

  • Setup two IrTeks, optically coupled.
  • One Receiver Unit IrTek7 connected to a serial terminal program.
  • And another one Transmitter Unit connected to the IrTrek app.
  • Place the Receiver Unit into Receive Mode by typing: iR0
  • Play with the remote buttons in question.
  • Get a feel of what the signals seen on the terminal look like.
  • Open different Virtual Remotes on the Transmitter Unit.
  • See if they have the same kind of signals as the remote.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License