Jumping Jack Flash weblog

New test with IR receiver/transmitter using sound card

Posted in Infrarossi by jumpjack on 30 settembre 2009

Some tests have been performed using an Asus EEEPC 701 4G to both sample and play remote control signals.

EEEPC looks to have an high capabilities sound card, which allows sampling up to 154000 Hz; this allows properly sampling the original 38000 Hz carrier rather than just its presence/absence.

Standard audio card sampling:

Asus EEEPC sampling:


Using this sample, some tests hav been performed to determine if, how and when the EEEPC is capable of controlling the TV set which the remote belongs to.

Results are weird: ONE single LED appear to be enough to control the TV set, but NOT using the original sampled signal; instead, an artificial signal made out of a 19000 Hz tone and “mixed” into a stereo signal made up of inverted signals is needed to properly control the TV set.




Codici discreti telecomandi per DVD recorder LG

Posted in Infrarossi by jumpjack on 28 gennaio 2009

Discrete IR codes for LG DVD Recorder (tested on RH-255)

Un “codice discreto per telecomando” è un codice di controllo che non corrisponde a nessun tasto realmente presente sul telecomando che attiva una certa funzionalità sul dispositivo.

Sul telecomando è presente un singolo tasto on/off, che accende il dispositivo se è spento o lo spegne se è acceso (“toggle”).

Il codice discreto “ON” accende il dispositivo se è spento, e non fa niente se è già acceso; analogamente il codice “OFF”.

Per la selezione della sorgente esterna, il tasto sul telecomando scorre le sorgenti AV1, AV2, AV3 e antenna; su certi dispositivi esistono codici discreti per selezionare la singola sorgente, a prescindere da quale sia quella attualmente selezionata.


Per il DVD RH 255, ho trovato questi codici:

0000 006d 0022 0003 00ab 00aa 0016 003f 0016 0014 0016 003e 0016 003f 0016 0014 0016 003e 0016 0014 0016 0014 0016 003e 0016 0014 0016 003e 0016 003f 0016 0014 0016 003e 0016 0014 0016 0014 0016 003e 0016 0014 0016 003f 0016 0014 0016 003e 0016 003e 0016 003f 0016 0014 0016 0014 0016 003f 0016 0014 0016 003e 0016 0014 0016 0014 0016 0014 0016 003e 0016 06c3 00ab 00aa 0016 0014 0016 0e7d

0000 006d 0022 0003 00ab 00aa 0016 003e 0016 0014 0016 003f 0016 003e 0016 0014 0016 003e 0016 0014 0016 0014 0016 003e 0016 0014 0016 003f 0016 003e 0016 0014 0016 003f 0016 0014 0016 0014 0016 0014 0016 003e 0016 003f 0016 0014 0016 003e 0016 003f 0016 003e 0016 0014 0016 003f 0016 0014 0016 0014 0016 003e 0016 0014 0016 0014 0016 0014 0016 003e 0016 06c3 00ab 00aa 0016 0014 0016 0e7d

tasto REC

Codice LIRC: 0x6D92 = 0110 1101 1001 0010

L’equivalente PRONTO dovrebbe essere, stando al programma “TONTO”:

0000 006d 0022 0002 0157 00ab 0016 003f 0016 0016 0016 003f 0016 003f 0016 0016 0016 003f 0016 0016 0016 0016 0016 003f 0016 0016 0016 003f 0016 003f 0016 0016 0016 003f 0016 0016 0016 0016 0016 0016 0016 003f 0016 003f 0016 0016 0016 003f 0016 003f 0016 0016 0016 003f 0016 003f 0016 0016 0016 0016 0016 003f 0016 0016 0016 0016 0016 003f 0016 0016 0016 05f3 0157 0055 0016 0e4d

Come ho ricavato il codice “PRONTO”?

Osservando il tracciato del segnale campionato, e considerando (a parte i primi due “scalini” molto larghi) che “alto-breve / basso lungo” indica un bit pari a 1, mentre “alto-breve / basso-breve” indica un bit pari a 0 (zero), si ottiene:



In questo tipo di protocollo (“SIRCS”), i primi 16 bit sono sempre uguali e indicano il dispositivo; i successivi 8 indicano il comando; gli ultimi 8 sono i bit invertiti del comando.

Dividendo la sequenza in gruppi di 8 si ha:

10110100 10110100    01101101  10010010

Si nota chiaramente che gli ultimi 2 gruppi hanno i bit l’uno l’opposto dell’altro.

Convertendo in esadecimale, si ottiene:

B4 B4 6D 92

Questo vuol dire che i comandi possibili sono solo 256, cioè i valori da 0xb4b400 a  0xb4b4ff (aggiungendo alla fine il byte invertito).

Nel file LIRC, il codice dispositivo (b4b4) è indicato nella riga:

  pre_data       0xB4B4

Riepilogando, ecco alcuni tasti noti:

DVD ON: 0xb4b4.ae.51

DVD OFF: 0xb4b4.6e.91

REC: 0xb4b4.6D.92

PLAY: 0xb4b4.8C.73

STOP: 0xb4b4.9C.63

In piu’, secondo il file LIRC:

nome hex dec bin
6 0x02FD 2 0000001011111101
SUBTITLE 0x0AF5 10 0000101011110101
POWER 0x0CF3 12 0000110011110011
DOWN 0x12ED 18 0001001011101101
ENTER 0x1AE5 26 0001101011100101
PAUSE 0x1CE3 28 0001110011100011
0 0x22DD 34 0010001011011101
ZOOM 0x26D9 38 0010011011011001
SKIP-FORWARD 0x2CD3 44 0010110011010011
ANGLE 0x32CD 50 0011001011001101
2 0x3CC3 60 0011110011000011
8 0x42BD 66 0100001010111101
SEARCH 0x46B9 70 0100011010111001
SCAN-BACK 0x4CB3 76 0100110010110011
TITLE 0x52AD 82 0101001010101101
RIGHT 0x5AA5 90 0101101010100101
DISPLAY 0x5CA3 92 0101110010100011
CLEAR 0x629D 98 0110001010011101
SETUP 0x6A95 106 0110101010010101
OPEN/CLOSE 0x6C93 108 0110110010010011
STAR 0x7A85 122 0111101010000101
4 0x7C83 124 0111110010000011
7 0x827D 130 1000001001111101
MARKER 0x8679 134 1000011001111001
RANDOM 0x8A75 138 1000101001110101
PLAY 0x8C73 140 1000110001110011
LEFT 0x9A65 154 1001101001100101
STOP 0x9C63 156 1001110001100011
RETURN 0xA25D 162 1010001001011101
A-B 0xAA55 170 1010101001010101
SKIP-BACK 0xAC53 172 1010110001010011
3 0xBC43 188 1011110001000011
9 0xC23D 194 1100001000111101
REPEAT 0xCA35 202 1100101000110101
SCAN-FORWARD 0xCC33 204 1100110000110011
DVD-MENU 0xD22D 210 1101001000101101
1 0xDC23 220 1101110000100011
UP 0xE21D 226 1110001000011101
PROGRAM 0xEA15 234 1110101000010101
AUDIO 0xF20D 242 1111001000001101
5 0xFC03 252 1111110000000011

Turn your phone into an universal remote control

Posted in hardware, Infrarossi, Sviluppo, Symbian by jumpjack on 10 giugno 2008

This short tutorial shows how to turn almost any cellphone into an universal IR remote control.

CHECK GoogleCode page for downloads and updates

Old post (with detailed instructions about how to build hardware)

How I did it (and credits)

Why it should work also on non-stereo cellphones (but it does not?!?) (see also excel file)

Useful links (explanations of remote control protocols)

Other uses for old phones
Available patents (not mine):
Infrared generator from audio signal source
IR receiver using IR transmitting diode


Ready-made transmitter: irDroid



– a cellphone with stereo audio output (audio left , audio right , ground) or symmetrical audio output (audio+, audio-)

– 2 IR leds

– a wired headset compatible with the phone

– a PC with audio card

– an audio recording software on PC

– an audio editing software for PC or an audio sinthesyzer software for PC

This project does not depend on O.S. used: you just need ANY computer capable of recording audio and create audio files from scratch. Linux, Windows, MacOSX or whatelse makes NO difference.

Please look at this post to know how to:
– build an IR receiver for the PC
– sample a remote control
– (create a WAV file using Audacity program) (not strictly needed: this article describe an alternate method).

Once you sampled all needed buttons of your remote, it’s just a matter of building a proper WAV file for each one of them. If you don’t want to use Audacity to do it manually, you can use SOX program: it creates pieces of “raw” audio file, which joined together build up the final WAV file.

Here you find example scripts (for DOS/Windows environment) which build a WAV file based on binary description of the remote signal. You have to setup the unizeri.bat file to have it matching the sampled signal. Then call create.bat specifying as parameter the “creator file” (unizeri-raw, or unizeri-tv,… ), the final WAV file (testbutton) and the number of additional times you want the command is repeated (at least ONE occurrence will be alway created):

create unizeri-raw testbutton 4

(no extensions required for filenames) (NOTE: script must be run inside SOX folder).

This will result in a tesbutton.wav file which, played on a phone (or on PC, or on any audio capable device), equipped with audio-to-IR converter, to control your device.

The audio-to-IR converter:

It is just a couple of LEDs connected in oppopsite ways to “audio output left” and “audio output right” (for normal phones) or to “audio+” and “ground” (for phones with symetrical audio output like nokia 6680). In symetricl ouptu, Left- and Right- must be connected together (see below).

Audio-to-IR converter:

Connections for nokia 6680:

(10 Ohm resistor not strictly needed)


Study about physics/optical phoenomena involved in this project:

Excel file – how to play a 38000 Hz “sound” through a 20000Hz-capable audio device

Big image summarizing Excel data


Forums about Ledrem:



PLC Forum

PC Tuner

HW upgrade





Remote control – 1: the receiver

Posted in hardware, Infrarossi by jumpjack on 22 maggio 2008


a – cut the ending part of the headphone cable (i.e. , remove headphones)

b – connect the IR leds in place of the headphones (one led per channel)

That’s all, now you have an IR receiver. (Note: images refer to first attempt with a single LED connected once to a channel and then to the other till the correct one was found).


> NEXT: Sample the remote control


Or just buy one irDroid IR blaster:


Remote control 4: the emitter

Posted in hardware, Infrarossi by jumpjack on 22 maggio 2008


a – Pick the headphone cable

b – connect one led between left and right channel (don’t care GROUND)

c – connect the other led between left and right channel, but the opposite direction

Your emitter should look like this:

Please note the opposite orientation of the two leds!

You should connect them to your headphone cable this way:

Ok, your emitter is ready.

Unfortunately, as it is it will be very weak, and it will have just a few centimeters range! To get a suitable range you need a suitable power; and to get more power than the phone can provide, you need an amplifier.

An amplifier is an electronic circuit which uses an external power source to add some power to a weak electric signal; you can build a simple one using just a few components: 5 resistors and 1 transistor:


The resistors are the component which have a “xxx kOhms” label; the transistor (here, actually,  a “double transistor”, properly a “darlington”) is in the circle.

The external power here comes from a 9V battery (bottom left in  the picture) .

Let’s divide the circuit in parts to better understand it.

  1. We have a voltage divider: this set of components divides the voltage in parts, depending on how it is built, according to formula:
    Vout = Vin * R2/(R1+R2)
    If R1 = R2, Vin is exactly splint in 2 equal parts: Vout = Vin / 2voltage-divider.png
    This means that in our circuit the voltage in Vout will be 4.5V if we use a 9V battery.
    Why do we need this voltage divider? Because the input signal coming from phone to our amplifier will have positive and negative values (its carrier is a sinusoid), so if the base of the transistor was biased at 9V, transistor  wouldn’t be able to amplify positive parts of the wave, being it at higher voltage than the battery; if it was biased at 0V, negative parts of the input wave would be lost; we need “the right in the middle value”: 4.5V
  2. Now we can add the transistor, which will get Vout as input to its base:transistor.png
  3. In case the current/signal coming from the phone was too high, we need a limiting resistor on the input; I don’t know how actually high can the phone output voltage be, anyway the current that will flow trhough transistor will be Iin = Vphone/R3. This current will just activate and drive the transistor, it does not flow through the speaker:
  4. The current which flows in the speaker is determined by the  battery voltage, not by the phone voltage; the power which the transistor must handle due to surrounding components is given by P = V^2 / Rs, where Rs is the internal resistance of the speaker, which we do not know:
    but we know from datasheet that the MPSW45A cannot tolerate more than 1W  (Pd value); to get Pd<=1 we must have V^2/Rtot <=1 ,i.e 81<= Rtot , where Rtot is the total resistance given by sum of speaker resistor and additional R4: we get that it must be Rtot = Rs + R4 >=81 ohm , and Iout would be Iout = V/Rtot <= 9/81 = <=111 mA:
    limit-output.png for this current flowing through the transistor we get around the maximum amplification, as we can see from datasheet:

In “phone world”, 5V is a most common voltage (USB charger voltage); what does it happen by applying 5V to this circuit rather than 9V?

The original site the schematic comes from does not explore this case… but I assume that we would get:

  • Rtot >=V^2  –>  Rtot >=25
  • Vbase = 2.5V
  • P = 25/Rtot
  • 25/81= 0.3  = 1/3

This means that by sure the transistor won’t get damaged, and it also probably means that we’ll get an output power wich is 1/3 of what we get using 5V, assuming we use same R4. To get same power of the 9V-powered amplifier, I think we’d need a total resistance Rtot >= 25 Ohm; R4 value is given by: R4 = Rtot – Rs = 25-Rs.



<< PREV: Edit waveform

>> NEXT-  REPLAY THE WAVEFORM: (in this same page)

a – Plug the emitter into HEADPHONE output of your audio card

b – Position the two leds just in front of your device

c – Press PLAY in Audacity: your device should react to the command you previously sampled.

Remote control – 3: Editing waveform

Posted in hardware, Infrarossi by jumpjack on 22 maggio 2008


Now you need to rebuild the original signal of the remote. As explained above, it’s just a matter of carrier present/absent. So:

a – Add 2 new mono tracks into Audacity project

b – Copy the “squared” signal into one track

c – On the other track, create a “tone” (the carrier): 38000 Hz 19000 Hz frequency, 0.9 amplitude

d – Select and delete unneeded parts of the tones; to do this, you have to zoom in: select a part of the signal, and click on the “zoom to fit” button:

You’ll obtain something like this:

e – Now click on an edge of the signal and drag the mouse down to the second track, until the selection reachs the edge of the next pulse in the signal:

f – Once thw WHOLE low-part of the signal is selected (see picture below), click on the “silence” button:

g – You should obtain “silence” on the lower track too:

h – Repeat steps e-f-g for all silence parts of the signal, until you obtain something like this:

Ok, now you have replicated the original signal.

Unfortunately, you can’t just “replay” it: soundcards can usually reproduce only signals up to about 20 KHz, but a remote control use 38 KHz modulation.

But some guys had a great idea some years ago (look here for their patent, now free available on internet; free registration required): simply connect two IR led to left and right channel, one the opposite way of the other, discarding GND, and play a stereo signal made of same signal with opposite phases: this will result in each LED producing a 19 KHz signal; their opposite phases allow signal “sum”, and the result is a 38 KHz signal.

How to accomplish all of this?!?

i – After deleting original signal track (you don’t need it anymore), create a new mono track in Audacity (menu can vary amond different versions):

j – Copy into it the just obtained (reconstructed) signal:

k – Select the whole track

l – Select “invert” from “effects” menu: this will inverti waveform phase:

m – select the first track and choose its own menu item to join it to the track below into a single stereo track:

You should now see a single stereo track:

Ok, now you eventually have the needed signal, which you can use to control your device.


<< PREV: Sample your remote

>> NEXT: Build the emitter

Remote control – 2: Sample your remote

Posted in hardware, Infrarossi by jumpjack on 22 maggio 2008


a – Start “Audacity”

b – Plug your receiver into MICROPHONE input of your sound card

c – Place your remote in front of the LEDs

d – Start recording: stereo track, 7600044100 Hz, 16 or 32 bit.

e – Press a button on remote

f – Stop recording

Ok, now you have a sample of one button of the remote. You should see two different tracks: you’ll have to consider just the one which looks like a “square wave”.

Indeed, on my audio card (VIA AC’97) sampling on one channel results in a sequence “triangles”, while on the other channel I get a sequence of “rectangles”. You’ll have to ZOOM a lot into the waveform, both vertically and horizontally, as the signal is very short (few milliseconds), and probably quite low.

The meaning of squares is “digital”: if the signal is high, it means a 38 KHz carrier is present; if the signal is low, no carrier is transmitted. Remote controls use different protocols to tramsmt signals. Look at this page for details (but you don’t need to know details to complete your remote transceiver).


<< PREV:Build your receiver

>>NEXT:  Edit waveforms