Shop OBEX P1 Docs P2 Docs Learn Events
I want to make a IR Remote Control.... — Parallax Forums

I want to make a IR Remote Control....

jdouganjdougan Posts: 6
edited 2009-07-13 01:48 in General Discussion
I am just getting started on a little gadget and thought I would ask if someone has any resources or has already done something similar that might help speed this project up.

What I want to do is make a device that will duplicate three buttons being pressed on a remote control for a cable box using a SX28AC/DP chip. When I am done, this lil gadget will remain pointed at the box and every 24 hours this gadget will send "0", "5", and "2".

I have an Parallax USB O'Scope and I have captured the code from the remote control and tried a few different ways to duplicate it, but this is a little harder than it seems. Any shared code anyone has that might help will be much appreciated.

Comments

  • Shawn LoweShawn Lowe Posts: 635
    edited 2009-06-17 16:38
    http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/vol8/col/nv153.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    When all else fails.....procrastinate!
  • JonnyMacJonnyMac Posts: 9,213
    edited 2009-06-17 18:31
    The program that's attached demonstrates sending Sony SIRCS codes from an SX28; the SX modulates the IR LED at 40kHz using the ISR -- this should get you started. I've used this code to control DVD players and a still camera (for time-lapse photography). You'll probably have to change the protocol but the modulation and IR LED control scheme will work for you.
  • jdouganjdougan Posts: 6
    edited 2009-06-24 19:48
    All - Thanks for the info so far... I am still struggling with this simple task and just don't have the expertise to make this work (blinking an LED was easy...) I have attached the pattern captured from the actual remote that I am trying to duplicate... I originally thought I would just capture what I needed and duplicate it using PAUSEUS between blinks, but my results are almost never the same.

    So, I tried the SXB from JonnyMac and just can't seem to make that work either. Is there a simple way to take the OScope data that I have, program it into the SX28AC and make it spit out this pattern with the press of a button attached to an input? I am curious too, if I am going to continue having problems using the Internal Oscillator at 4MHZ? Will I need something faster to ever make this work....

    I am sure this is simple for someone out there and I figure if I can ever grasp how to make this work with one pattern, I will be able to snow ball it from there... basically, I need something VERY simple.

    Thanks a million!!!!!!!!!
  • PJMontyPJMonty Posts: 983
    edited 2009-06-24 20:00
    JDougan,

    Don't use the internal oscillator for time critical (e.g. serial communications such as IR remotes) application. Use an external clock or resonator instead.

    Thanks,
    PeterM
  • JonnyMacJonnyMac Posts: 9,213
    edited 2009-06-24 21:39
    In an ideal world you'd determine what protocol your remote is using and then write a driver routine for it, just as I did for the Sony 12- and 20-bit SIRCS protocols. To be candid, you 'scope images are somewhat less than helpful and, honestly, you may not be ready for this kind of project if blinking an LED is the extent of your skills. That said, give it a go. With my program the LED is modulated, all you have to do is create pulses by writing a 1 or 0 to the anode pin (RA.0). Use DELAY_TIX to control the width of the pulses (in 12.5us units).
  • jdouganjdougan Posts: 6
    edited 2009-06-24 22:10
    Thanks JonnyMac... I agree that I may not be ready for this kind of project and I really appreciate all that you and others have had to offer... I just printed off the "IR Remote for the Boe-Bot". I hope it can help me. I really want to make this project become a success and sometimes I just can't give up. I am going to continue to try, I just have to get a grasp on how a remote works and how to make the darn chip do the same job!!
  • Shawn LoweShawn Lowe Posts: 635
    edited 2009-06-25 00:55
    What is your remote supposed to control? Google what protocall it uses (if you haven't already)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    When all else fails.....procrastinate!
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2009-06-25 05:21
    Hi,
    It has been a few years, so I may not have kept the code. But this is my experience.

    I used an audio oscope software through my computer sound card to catch IR transmissions for decoding.
    Though the 40Khz is a little bit high for audio, the actual baud rate is slow enough that one can clearly see the timing.

    That may be helpful as most of the documentation on the web is not comprehensive about what each and every key is doing on one's own remote. Some transmissions are simply one-shot and other seem to automatically retransmit [noparse][[/noparse]like the up and down volume]. You have to provide a trap in software to ignore redundant transmissions while responding the first good one. A time delay of some sort is required, maybe 100ms or more. Don't worry about one-shots being missed as people intuitively repress a key if they don't get the response they expect.

    I also have had a BasicStamp set up to create and send a capture file on my computer to compare to the oscope. Some transmission behavior is surprisingly sloppy and it is important to know what's up if you want to reliably capture.

    The SXes internal oscillator wanders roughly 7% due to changes in temperature, where as a resonator or crystal will hold this figure way down to below 3%. Many of the new resonators are even tighter. So use an external to have better results.

    Many of the software examples only partially parse the transmission and ignore the fuller length transmission in order to save time. That made it hard for me to get started. This is somewhat of a cheat as one cannot use certain features of the remote - like switching between a t.v., a stereo, and a v.c.r. If you want those functions - the full code must be captured and decyphered.

    In other words, the full transmission code usually has two segments - a key code and a device address. Many example just capture the key code.

    The point is that the devil is in the details if you really want to fully exploit each and every button.

    I have a universal remote that transmits over 100 different formats, but i have mostly stayed with the Sony standards as they are popular on the web for examples.

    My own feeling is that for indoor, single room remote control - there is nothing better than IR. The SX can easily do it all. But building a complete database for all the keys on your remote is a tedious and lengthy project. Even Parallax's example only use a few of the keys and ignores the rest.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ain't gadetry a wonderful thing?

    aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan

    Post Edited (Loopy Byteloose) : 6/25/2009 5:45:01 AM GMT
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2009-06-25 09:54
    More thoughts... Just for starters, the Sony 12bit code is more easily handled than longer codes with more bits. As I said above, this one is very much explored on the internet so Google can locate useful information. Part of the challenge is that the SX and BasicStamp handle and store data as 8bit words, so capture and processing of longer sequences requires more handling. The beginner likely will be more comfortable with 1 or 2 bytes for the required 'lookup table' that identifies each key and links a response to said key.

    Usually there are three tasks in the program's reception - recognize a header, recognize a data stream including key identity [noparse][[/noparse]for further action] including device address being sent, and recognize end of transmission. Of course, if the device address is NOT validated by your SX, it can ignore the rest. In this way, you might use an empty selection on your T.V remote and have the SX respond only when you switch to another device [noparse][[/noparse]maybe you don't a VCR want to use that recognition code}. In many cases, merely the process of recognizing the header portion will exclude a lot of devices that have longer and shorter headers. So you have a reception loop with several tests and each one provides an exit to a state of waiting for another transmission.

    Personally, I strongly suggest buying a Universal Remote for research and testing that is sold as a replacement device. This should be one that you have to configure yourself from a list of 100 or so devices rather than a 'smart' device that learns protocol from transmission from another device. By getting yourself a separate device, you can select a code that is ignored by all your home devices and you can have something to really build a home remote control system on.

    Not all BasicStamps are useful as their speed may be too slow for proper capture and handling of IR sequences. A 50Mhz SX will offer you a lot more opportunity than a 4Mhz as you can tune the device to be more precise in recognition of code. It will also have more time to look up what the key code should do as there are more empty clock cycles between incoming IR. That does mean that the receiver will be more 'power thirsty', but that really is a non-issue as it is the transmitter that is battery dependent, not the receiver. The receiver will often tie into a wall wart and power something else, like a relay board or a robot.

    I have also collected a few odd IR remote controls, like discarded Air Conditioning remotes. These can be decoded and recycled for hobby use. The IR remote is a wonderful device as it is well built for recycling and hobby use. It would take quite a bit of work for you to create your own IR remote and it would likely consume more batteries over the period of a year.

    Good luck to you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ain't gadetry a wonderful thing?

    aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan

    Post Edited (Loopy Byteloose) : 6/25/2009 10:15:01 AM GMT
  • stephenwagnerstephenwagner Posts: 147
    edited 2009-06-25 16:52
    jdougan,

    Take a look at this project using a BS2 and an external 38KHz oscillator.

    http://www.parallax.com/tabid/321/Default.aspx

    The code can be modified to support other IR protocols.

    The 38 KHz oscillator can be purchased here: http://www.rentron.com/remote_control/TX-IR.htm· and the resonator: http://www.rentron.com/Products/PIC-Micro.htm.

    As stated by others, google "IR protocol NEC" "IR protocol RCA". You will even find protocol information on the IR receivers manufacturers "Application Notes" web sights.

    I have code for IR receivers and IR transmitters that I will poast at a later date.

    Stephen Wagner

    ·
  • jdouganjdougan Posts: 6
    edited 2009-06-25 17:13
    Not sure if this helps any, but the images I uploaded are a zoomed in shot of a single button press on a remote. I thought this would make it easier to understand by zooming in and showing the timing.

    The remote that I am trying to duplicate a couple of button press's on is a "URC 7820". I have just learned that it transmits at 56KHZ to the Scientific Atlanta cable converter box. My project is to simply duplicate a couple of key presses ("3" and "0" to be exact). At the end of this project, I will place this box in a lobby type area and my device will tune this box back to the correct channel every XX hours or so (doesn't have to be exact, but will probably be every 3 hours).
  • JonnyMacJonnyMac Posts: 9,213
    edited 2009-06-25 19:35
    What you need to do is get a 56KHz demodulator (e.g., Mouser 782-TSOP2256) so that you can see the actual protocol; attempting to analyze the modulated signal from the LED will probably be fruitless. The code I submitted above is modulated at 40kHz but this is easily changed by modifying the interrupt timing. Still, first things first: setup a detector so that you can determine the protocol used by your remote -- after that you can duplicate it.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2009-06-26 14:55
    56KHz modulation? That is interesting as most of us are working with 38-40KHz modulation, but it really is not a serious issue as the sensor demodulates the transmission and it is the 'baud rate' that is important to the program timing for reception and decoding. If you want to send a modulate 56Khz, the SX will allow you to do so with a faster crystal and an interrupt loop. You may not have to bother going up to 50Mhz for transmission. Being +/- 1Khz doesn't seem to matter much for reception.

    Since the baud rates are actually in the audio frequency range, one still can use a audio oscope software and a sound card on a conventional PC for decoding. One doesn't have to buy a normal oscope with higher bandwidth.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Ain't gadetry a wonderful thing?

    aka G. Herzog [noparse][[/noparse] 黃鶴 ] in Taiwan

    Post Edited (Loopy Byteloose) : 6/29/2009 3:48:24 AM GMT
  • Invent-O-DocInvent-O-Doc Posts: 768
    edited 2009-06-29 00:55
    The current weekend special on parallax is a book/kit for IR remotes. Also, they have a book for download that has all kinds of sample projects written for the stamp. Although that may or may not be the same protocol you need, it might get you oriented to IR remote projects. If worse comes to worse, you can always hack a universal remote to do what you want, but you should be able to get it to work with the SX also.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Thomas Talbot, MD
    Gunpowder, MD, USA
  • JonnyMacJonnyMac Posts: 9,213
    edited 2009-06-29 19:50
    @jdougan: What you want to do is possible with a little effort. Have a look at this:

    http://forums.parallax.com/showthread.php?p=819481

    I built a time-lapse controller for my Sony camera -- the only way to remotely trip the shutter is through an IR interface. I knew that the camera used the Sony protocol so that was easy, but I still had to look at it on a 'scope with a proper demodulator to determine the bits sent from the remote to the camera for a shutter release command.
  • mike pmike p Posts: 3
    edited 2009-07-13 01:48
    jdougan,

    Don't know if you're still in need, but if so I highly recommend this product:

    http://store.homeseer.com/store/GC-IRL---Infrared-Learner-Global-Cache-P539C47.aspx

    This IR Learner is available from Homeseer for about $78. It might be a bit pricey for just duplicating 3 button codes, but I have used it with great success to capture/duplicate IR codes. One of the cool things about it is you can capture your generated IR codes and quantitatively compare them with the originals. The IR Learner will give you output such as:

    sendir,2:1,2,56000,1,1,23,345,23,158,23,94,23,158,23,158,23,94,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,345,23,158,23,94,23,158,23,158,23,94,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,345,23,158,23,94,23,158,23,158,23,94,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,345,23,158,23,94,23,158,23,158,23,94,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,158,23,345,23,1120

    "56000" is the modulation frequency, the first "23" means 23 cycles of 56K carrier, then "345" means 345 cycles of no carrier, with further alternation of on/off carrier.

    The IR Learner has a claimed carrier frequency range of 30 to 500 KHz. It is DB9 serial, but I have used it with no problem with an Airlink USB-Serial adapter.

    An easy way to get started is generate a short on/off pulse train of carrier and capture it with the Learner. Be aware the the Learner probably does not see visible light LEDs (i.e. use IR LED), and needs to see light that looks like a modulated carrier before it will capture it. Also be aware it can be tricky to duplicate the range of IR remotes. Try your IR code up-close at first; once you get it working move back to find the usable range
Sign In or Register to comment.