USB IR Toy: Perl scripts for signal analysis

From DP

Jump to: navigation , search

Anton contributed these Perl scripts for decoding and visualizing infrared signals captured by the IR Toy. These scripts use the USB IR Toy IR Sampling mode, so a fairly recent version of the USB IR Toy firmware is required -- at least v07.

Grab them all from Git or the forum.

Contents

NEC decoder

As an single parameter pass a bin file generated by IRToyRecPlay utility.

> ir_NEC.pl dumpfile.bin

Example command line.

G:\Projects\Eclipse-3.6\IRToy>ir_NEC.pl test000.bin
0x00F7AA55 IR-NEC: Addr1:0x00, Addr2:0xF7, Cmd:0xAA OK
0xFFFFFFFF R
0xFFFFFFFF R
0xFFFFFFFF R
0x00F7EA15 IR-NEC: Addr1:0x00, Addr2:0xF7, Cmd:0xEA OK
0xFFFFFFFF R
0xFFFFFFFF R
0xFFFFFFFF R
0xFFFFFFFF R

Output example.

Philips RC-5 decoder

G:\Projects\Eclipse-3.6\IRToy>ir_RC5.pl test000.bin
0x00003011 S1:1 S2:1 T:0 Addr:0x00 Cmd:0x11
0x00003011 S1:1 S2:1 T:0 Addr:0x00 Cmd:0x11
0x00003812 S1:1 S2:1 T:1 Addr:0x00 Cmd:0x12
0x00003812 S1:1 S2:1 T:1 Addr:0x00 Cmd:0x12
0x00003013 S1:1 S2:1 T:0 Addr:0x00 Cmd:0x13
0x00003013 S1:1 S2:1 T:0 Addr:0x00 Cmd:0x13
0x00003811 S1:1 S2:1 T:1 Addr:0x00 Cmd:0x11
0x00003014 S1:1 S2:1 T:0 Addr:0x00 Cmd:0x14
0x00003815 S1:1 S2:1 T:1 Addr:0x00 Cmd:0x15
0x00003815 S1:1 S2:1 T:1 Addr:0x00 Cmd:0x15

Output example.

PANASONIC EUR648251 decoder

Test000.bin00.png

The protocol is similar to NEC but with different timings and 6 data bytes encoded.

According to this lirc file the decoder is working (pre_data is the same and the codes are correct too).

G:\Projects\Eclipse-3.6\IRToy>ir_PAN.pl test000.bin

IR-PAN: 0x40(01000000) 0x04(00000100) 0x05(00000101) 0x43(01000011) 0xfd(11111101) 0xbb(10111011)
IR-PAN: 0x40(01000000) 0x04(00000100) 0x05(00000101) 0x43(01000011) 0xfd(11111101) 0xbb(10111011)
IR-PAN: 0x40(01000000) 0x04(00000100) 0x05(00000101) 0x43(01000011) 0x09(00001001) 0x4f(01001111)
IR-PAN: 0x40(01000000) 0x04(00000100) 0x05(00000101) 0x43(01000011) 0x09(00001001) 0x4f(01001111)
IR-PAN: 0x40(01000000) 0x04(00000100) 0x05(00000101) 0x43(01000011) 0x89(10001001) 0xcf(11001111)
IR-PAN: 0x40(01000000) 0x04(00000100) 0x05(00000101) 0x43(01000011) 0x89(10001001) 0xcf(11001111)
IR-PAN: 0x40(01000000) 0x04(00000100) 0x05(00000101) 0x43(01000011) 0x49(01001001) 0x0f(00001111)
IR-PAN: 0x40(01000000) 0x04(00000100) 0x05(00000101) 0x43(01000011) 0x49(01001001) 0x0f(00001111)

Only last 2 bytes are different so maybe the first four are device descriptors and/or addresses?

ir2PNG

Ir2png-example.png

  • Forum post
  • Create a PNG image from an IR Toy capture
  • Pass a dumped bin to this script
  • Requires GD::Image perl module

IR Toy recorder

The script uses function that is fixed in v.10beta+ grab it from here

  • Forum post
  • Perl script for recording data from IRToy
  • Currently it is working with Win32::SerialPort or Device::SerialPort (autodetected).
  • Change COM4 to other COM port if needed
  • Save USBIRToy.pm and irtoy_record.pl in same folder.
  • There is a 'secret' function to dump (to stdout) the received bytes and the calculated time. To enable this function just create an empty file with name 'irtoy.dump' in the folder where the script is running.

G:\Projects\Eclipse-3.6\IRToy>irtoy_record.pl test
Sampling mode enabled!
Press key on remote or CTRL+C to terminate
Processed: test000 min=18(383.9994us), sum=9505.0000, multiply=21.3333, len=400
Processed: test001 min=18(383.9994us), sum=27773.0000, multiply=21.3333, len=1000
Terminating on signal SIGINT(2)

Setup

ppm install Win32-SerialPort

To install Win32::SerialPort for ActiveState Perl.

sudo apt-get install libdevice-serialport-perl

To install Device::SerialPort on Ubuntu(or any debian distribution).

yum install perl-Device-SerialPort

To install Device::SerialPort on CentOS(or any RedHat distribution).

pkg_add -r p5-Device-SerialPort

To install Device::SerialPort on FreeBSD.

IR Scope converter script

rct contributed a perl script to convert captured USB IR Toy .bin files into .ict files that can be read into IRscope (a windows utility) for display and analysis of captured IR signals. IRscope is a windows only utility by Kevin Timmerman and Graham Dixon. The source code is available under the GPL. IRScope can be very help for analyzing the structure of captured IR signals. Additionally IRscope can import and export several IR code formats.

Here's the code and some screen shots. One is a Sony CD Stop and the other set of Panasonic codes are the test.bin that Anton posted recently.

Irscope-screen .png

Irscopescreen-sony-cd-irtoy.png

Irscopescreen-panasonic.png