Jumping Jack Flash weblog

Remote control – 3: Editing waveform

Posted in hardware, Infrarossi by jumpjack on 22 Maggio 2008

== 3 == EDIT WAVEFORMS

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.

^^ INDEX

<< PREV: Sample your remote

>> NEXT: Build the emitter

48 Risposte

Subscribe to comments with RSS.

  1. […] 3) Edit the resulting waveforms […]

  2. […] (RSS) « Remote control – 3: Editing waveform Remote control – 1: the receiver […]

  3. […] Strangely, it is not the first time that this question has come up. On this occasion the question was inspired by a DIY project for making a IR transmitter using a standard PC sound card and Audacity. […]

  4. Clod said, on 14 novembre 2010 at 15:45

    Ciao, deduco dalla schermata di audacity che sei italiano. Complimenti per il progetto, sto cercando di riprodurlo per poi sviluppare una piattaforma per i cellulari, sempre opensource naturalmente. Ho registrato correttamente un canale e creato la traccia, ora devo testarlo, ma non sono sicuro di aver collegato correttamente il trasmettitore: nelle foto si vede che uno viene connesso ad un canale e l’altro a terra, ma io ho connesso entrambi ai due canali (uno ciascuno ovviamente) e il risulatato sono due onde inverse. Penso che il risultato sia il medesimo, no?

    • jumpjack said, on 14 novembre 2010 at 20:50

      Di quale foto parli di preciso? La foto a pagina 4 mostra che la massa non va collegata a nessun led.

      • Clod said, on 15 novembre 2010 at 15:34

        parlo di quella del ricevente…comunque fatto, funziona ^_^ ora però il raggio d’azione è basso, qualche modo per ampliarlo?

        • jumpjack said, on 15 novembre 2010 at 20:44

          immagino che “basti” un normale amplificatore… a saperlo progettare!

      • Clod said, on 17 novembre 2010 at 16:12

        Sono riuscito a codificare i codici binari all’interno del sengale inviato… Per quanto riguarda il trasmettittore, ora ho usato due led che avevo a casa di telecomandi vecchi, ma avendo i contatti corti, sono storti. Se messi in linea qual’è la distanza a cui arrivano? Ho provato ad aumentare l’ampiezza ma non cambia un gran che.

  5. Eddy Herman said, on 1 Maggio 2011 at 21:38

    can you put some samples up for say a power button for a tv because i have my wave but im not sure if its right ?

    • jumpjack said, on 1 Maggio 2011 at 21:43

      You can see a sample in the first image! In your sample you should see a series of bursts not longer than 30-40 ms each (0,030-0,040 seconds) . My first image show only the first one of the series of bursts.

      Can you uoload a screenshot of your sample?

  6. Karen said, on 15 dicembre 2011 at 7:23

    I’ve record the sample of one button of the remote, and done the step above. However, the emitter can’t control the device. Here’s the image of my sample.

    help me

    Please take a look at it, thanks!

    • jumpjack said, on 15 dicembre 2011 at 8:11

      Signal looks good, at list from such “distance” (I see preamble and pulses), but I need a very close zoom to see the sinusoidal waves, which must be in opposite phases.

  7. Sourav Karmakar said, on 7 gennaio 2012 at 11:45

    This thing worked brilliantly for me… really neat stuff. I wanted to simulate for Nikon ML3 remote for DSLR. Now i have a 30kb .wav file that i can put on ANY device that plays WAV and use to shutter my Camera!!… tried on a Samsung Galaxy i5801, iPod Nano 5th Gen!

  8. dan said, on 20 gennaio 2012 at 22:17

    Hi,

    I have tried replicating the wave many times for my tv remote but can not get it to work. Any ideas?

    Thanks

  9. Jan Rubin said, on 6 giugno 2012 at 15:44

    Dude!!! It’s awesome! Very good guide. Worked on wave, on Macbook. Same shit but in english. Worked with Mac remote just perfect. Until last step I didn’t know if it’s gonna work or not, but when my Mac respond I felt almost like after sex.

  10. […] Remote control – 3: Editing waveform […]

  11. edytibi said, on 23 marzo 2014 at 23:46

    Hello!Thank you for the information.Using your cleaning method I obtained a working wav, but is very hard for 42 samples (an entire remote control).Are there any applications to do this automatically?I tested “LedRem with Sox” (from recorded wav to RAW LIRC, and from LIRC a bat file with commands for Sox) but the generated wavs have a lot of silence at the beginning and they are mono.After fixing them they are still not working.I put a sample (original capture and processed file) on WeTransfer http://we.tl/P2JOTq7Jk4 if you don’t mind to take a look.The shape and the spacing are the same, it changed the rate from 44.1KHz to 48KHz.Thank you!

    • jumpjack said, on 24 marzo 2014 at 8:47

      Can you send them to jumpjack at libero dot it?

      • edytibi said, on 24 marzo 2014 at 14:04

        I have sent the sample.I experimented with the batch of Sox commands, and modified the rate to 44100 Hz (instead of 48000), the carrier to 19000 Hz (instead of 18000), I eliminated the first line which inserted 0.1s of silence,and modified the second line (“…vol 0 > base.raw”).I obtained a wave that seems out of sync with the captured one.

        • edytibi said, on 26 marzo 2014 at 0:14

          Made it work.Although with the described modifications (replacing the rate with 44100 and the carrier frequency with 19000) the new wave seems out of sync, it controls without problem the TV (in stereo flavor with one channel inverted).
          I found another problem.LedRem for very small values uses exponential numbers (example 0.000045 gets written in the batch file as 4.5E-5) that drives SOX nuts and make a non-working and huge wav (2-3MB, instead of 20-40KB). It would be very nice if the author of LedRem could make the above mentioned changes of the sample rate and carrier frequency, and to fix the exponential number writing (it’s very difficult to edit 42 BAT files, but easier than manually cleaning the waves).Thank you for your effort!

          • jumpjack said, on 26 marzo 2014 at 6:58

            I’m no longer maintaining LedRem since years, and especially now I’ve not so many spare time available, anyway the source is public.

  12. edytibi said, on 26 marzo 2014 at 23:12

    I fixed the issues. If needed the fixed source code and executable is available at LedRem page http://code.google.com/p/ledrem –> Issues –> Issue 7 –> #2
    Many thanks to the author.Now I have a backup of my remote controls that can be used to teach any universal remote control with learning function (if needed).

  13. Anonimo said, on 18 Maggio 2014 at 11:48

    Should I create a sine wave? Or another one?

  14. Anuj said, on 11 giugno 2014 at 13:30

    Hi, everything worked well for me except that when i play file with windows media player, the command is not detected 9/10. it is 10/10 in Audacity.
    It doesn’t work with an android at all.
    Can any one help me to resolve my issues please… ?? I am keeping big hopes from this forum because the tutorial helped me a lot and I dont want to leave this after coming so far !

    Jumpjack.. please help me or anyone else who knows whats going wrong !

  15. Anuj said, on 12 giugno 2014 at 5:08

    Thanks for the reply. Sent the wav files on your email id [obscured] 🙂

    • jumpjack said, on 12 giugno 2014 at 16:54

      From Anuj
      “all the files works very well with Audacity. may be 1/10 I miss the command. When i play the same files with Windows media player (Windows 7 32 enterprise), I hardly detect the command. more or less 90% times i miss the command and sometime it gets detected.

      I am using a carrier tone of 36KHz as I know my remote uses that frequency ( I only developed that remote ). I tried both sine and square but, both works for me without much of issues.

      I tried all these files with 2-3 android phones and iphone5. Non of them worked for me. I really doubt that the signal from the phone jack are very weak (only line voltages and are not amplified like computer headphone jack).

      Still, I want a better opinion from you after looking the .wav files. You can suggest trying some particular phone model but, I am not sure that I can find it and test with it (but, i will try).

      Also, I tried to check the IR leds while connected to laptop audio jack with phone camera and they light up when the wav is played. Also, if I play in PC without transmitter connected, I hear a very short “chirrrpppp” sound which means the PC is playing the file. The same thing doesn’t happen on any phone.

      Hope you can find some time for me and give ur valuable suggestion soon.

      • jumpjack said, on 12 giugno 2014 at 16:55

        My reply:
        If file works with audacity, then file is good.

        Maybe mediaplayer has a filter, an equalizer or something which changes the played waveform: try to resample its output using another pc.

        If phones can’t play the tone, maybe you need a specific player for wav files? The method can’t work if you convert the wav to mp3 or other formats.

        • jumpjack said, on 12 giugno 2014 at 16:55

          From Anuji:
          Media player in windowsbi will check for the filters and equalizers.
          In mobile phones I used different media players but no success.
          Today I created just a tone of 38khz for 10 secs and exported it as wav. Played it with same media player and it made sound. That means that media player plays wav files. Do you think play duration can be a problem and the player is neglecting to play a file of 20ms?
          Can u suggest any phone of recent time which u think works for you.??
          Do you think in any case I need to amplify the signals with phone ?

          • jumpjack said, on 12 giugno 2014 at 16:57

            Some users reported they couldn’t see any flashing in the led when using phone, although it properly commanded devices, but only very colsely; so they installed a small signal amplifier to get better range.
            Try keeping the led attached to receiving device, just to see if signal works.

            • Anonimo said, on 13 giugno 2014 at 16:13

              Wonderful news bro, I made it work and it works with my android without any problem. I m surprised that the range with mobile is about 3-4 meters. With laptop I m gettingssimilar range. The problem lied in my doubt in last comment. Our so called stupid smart phones are
              Extra smart and neglect to play a ffile less than 1 sec. I just kept the command after 100ms interval just to make sure to not to have fade in issues. Rest all the remaining 900ms are complete silence.And to my surprise this time the command worked from mobile.
              Later i did some tweaking in tone. The range with sine waves is much more than square wave. I was wrong in my last comment where I said the distance with both the waves is same.
              Still after so much success I am not able to work with all kind of mobiles. With two symbian phones no success. With I phone 5 no success. With other two low end androids no success.
              Now my task is to make it work with every kind of mobile phone.
              Again, pls help to throw some morelight on what ccould went wrong with other mobiles?

              • jumpjack said, on 13 giugno 2014 at 18:55

                Very interesting, thanks for sharing.
                I wonder if modern phones/PCs are capable of playing 48 KHz audio files natively rather than “simulating” them by optical interference: I read of some audiocards capable of 96 KHz sampling (not mine).
                I Don’t know why some phones do not work, try looking for different players (which do not tamper the original waveform…)

                Additionally, there are some android apps capable of amplifying sound (audioboost or something like that), which could improve range (although 4 meters is already very good!)

                • Anonimo said, on 14 giugno 2014 at 16:19

                  Yes! 4 meters with my HP elitebook laptop and my android is confirmed. I made is work my Whirlpool air conditioner today.
                  Another help needed !
                  This morning I was working with AC remote and the command structure is very large! It takes almost 15-20 minutes to samples one command with audacity ( i mean capture, edit the signal and make a stereo file). Can you suggest something which can do this signal editing work automatically ?
                  LIRC2Ledrem doesnt seems to work for me. I may be not using it properly. Can u suggest how to use ?

                  I have no idea about my laptop or android playing the audio more than 44KHz. On monday I can make another transmitter with single LED and check on that.

                  Thanks again !

                  • jumpjack said, on 14 giugno 2014 at 17:40

                    I don’t even remember how Lirc2LedRem and the other SW work, I wrote them years ago and no more used…

  16. Tran TLoc said, on 10 ottobre 2014 at 7:14

    Hi jumbpjack,
    Your tutorial is so great, it’s easy to understand. But when I finished all: build Rx, get sample signal, Build Tx, there’s nothing happen with my TV although I put Tx really close with TV. Could you check it for me? I use HP Compaq 8510w for IR Rx and Tx with Audacity for editing Signal and Media Player to Transmit Signal. This is picture:
    http://www.mediafire.com/view/catf4h9cuge0544/signal.PNG.
    And link Audacity with Original Signal and my “Clone Signal”. http://www.mediafire.com/view/4az6ch6ormieu2e/tv5_Signal.aup

    Thanks.

    • jumpjack said, on 10 ottobre 2014 at 7:19

      The beginning of the signal looks unusual: try adding a long initial pulse starting from first spike and ending to second one; it could be an initial calibration tone for the receiver, which should be constant (are your remote control batteries fully charged?).

      • Tran TLoc said, on 10 ottobre 2014 at 13:27

        Wow, with your tip, “are your remote control batteries fully charged?”, I think the signal may be weak and edited it again, then It work.
        After all, thank you very much.

        • jumpjack said, on 10 ottobre 2014 at 14:35

          Great! Could you please send me also the image of the new sample? I’ll add it to the blog as a reference for other users.

          • Tran TLoc said, on 10 ottobre 2014 at 14:47

            Ofcourse, here you are http://www.mediafire.com/view/4bfl387udxf06qq/Success.PNG.
            Just notice Edge of Signal Up/Down to edit ours.

            • jumpjack said, on 10 ottobre 2014 at 23:10

              Yes I got it, but I thought you also resampled the remote after replacing the battery: this should lead to a stronger calibration pulse at the beginning of the waveform.
              Additionally, it could be interesting to see if a modern smartphone can play a 96 kHz file: this would allow to directly replay the sampled remote control signal (also sampled at 96 kHz) with just one single led and without manual processing of the waveform.

  17. Tran TLoc said, on 10 ottobre 2014 at 7:37

    Thanks for your responding soon,

    I send you more signal Rx of other remote, the beginning of the signal don’t have “square” form too. I used another IR Led to receiver, results are the same.
    Here they are: http://www.mediafire.com/view/4a6h828qf573c2o/AirCondi_Power.aup
    http://www.mediafire.com/view/led6l20p8f5euvc/HDplayer_power.aup
    http://www.mediafire.com/view/f7lc8ijbcgbbk82/LGTV_power.aup.

  18. Pavle said, on 8 febbraio 2016 at 19:45

    To generate a tone do I have to just go to generate and select tone and does it have to be sine???


Puoi inserire un commento qui sotto; diventerà visibile dopo la moderazione dell'amministratore