Shop OBEX P1 Docs P2 Docs Learn Events
Universal Code Sequences for Toshiba TV's — Parallax Forums

Universal Code Sequences for Toshiba TV's

NoBo780NoBo780 Posts: 94
edited 2008-03-19 00:25 in General Discussion
Anyone that is familiar with IR communication knows that commands that are sent from a TV (or VCR, DVD, etc. for that matter) are made up of varying pulses, starting with a 'start' pulse that tells the TV/VCR/etc. that it is about to receive a new command sequence. I am doing a project that involves controlling a Toshiba TV via a microcontroller + an IR detector,& an IR LED. The micro captures the pulse width from the remote controlling the TV, and repeats them through the IR LED. The thing is, in order for it to do so, it must know the start bits (the first pulse width that is sent from the remote to let the TV know it's about to send it a command), so it knows when to start capturing a new code (right?). I have SCOURED the internet for the information on the pulse code sequences that are used (universally) for Toshiba TV's, but I can't find them anywhere. Does anyone know where I can find them? Do I even need them to do this? I am trying to do what was done here: (http://www.parallax.com/Portals/0/Downloads/docs/prod/sic/WebIR- v1.1.pdf) with an Arduino (ATmega168 programmed via the 'wiring' code library), except that I will have the Arduino store the codes at random, and repeat them via the IR LED. Kudos to anyone that can successfully answer this question!!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Giggly Googley!

Comments

  • allanlane5allanlane5 Posts: 3,815
    edited 2008-03-12 01:54
    What I did to achieve a similar purpose was to wire up an IR-Detector, then hook up a logic-analyzer module (like the ANT-8) to the detection pin, and record the timing of the output pulses it made when a Toshiba remote was aimed at it and a button pressed.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-03-12 05:01
    Here is a list of Pronto hex codes for Toshiba, by model number.

    Here is a document that describes the Pronto hex format.

    ('Took all of five minutes with Google. wink.gif )

    -Phil
  • NoBo780NoBo780 Posts: 94
    edited 2008-03-12 11:47
    Phil:

    I have seen that website (th one w/ the codes), but my model # is not there (it's like 27AF...). But shouldn't the codes for ALL Toshiba TV's be the same? OR not... (I mean, we have universal remotes...)?

    Allan:

    I have a logic analyzer (and by that, you just mean the indicator of HIGH/LOW, right?) built into my multimeter, but I guess it's wayyy to slow for that. And how did you time the pulses just so with a logic analyzer? Isn't that the device with simply two LED's that indicate HIGH and LOW? Did you use a photodetector over the LED's and time it with a micro, or is there a more expensive analyzer you used? I by no means have an oscilloscope, if that's what you're talking about, and I do not currently have the wallet to get one shakehead.gif . What are my options? How can I do this? More info HERE.·Thanks for the help.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Giggly Googley!
  • NoBo780NoBo780 Posts: 94
    edited 2008-03-12 11:52
    I see what you mean by logic analyzer. I do not have access to such an instrument. Maybe there's a function in my multimeter that can help me? I have the Radioshack 46-range multimeter. Info HERE. Maybe I can use duty cycle or something? It can relay data to a PC to be graphed in real time, but the HI-LOW functions do not act nearly fast enough for this application, but It has other functions...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Giggly Googley!
  • stephenwagnerstephenwagner Posts: 147
    edited 2008-03-12 12:34
    NoBo780

    Check out this project:

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

    The repeater works very well.

    Search the web for infrared protocol & infrared protocols

    http://www.geocities.com/SiliconValley/Lakes/3947/TABLE.HTML

    http://www.sbprojects.com/knowledge/ir/ir.htm

    http://www.vishay.com/docs/80071/dataform.pdf

    http://www.celadon.com/SC-33B-programmable-remote-control/SC-33B-NEC-IR-Protocol.pdf

    You will also find other protocols on the Celadon web sight.

    http://www.celadon.com/remote-controls.htm

    You may not find the exact protocol for your appliance. Once you have captured part of the data from your remote, the rest is easy. You need the start pulse,·the pause and then you need to understand the difference between a logical 1 and logical 0 and finaly the number of bits. Most of the data is sent four groups of 6 and or 8 bits for a total of 24 and or 32 bits. Look at your data in a binary fashion in groups of 6 and or 8.

    Every remote I own followes the NEC format of 32 bits and or RCA format of 24 bits.

    The boe bot IR paper describes a great IR remote receiver using RC time.



    Good Luck
  • NoBo780NoBo780 Posts: 94
    edited 2008-03-12 13:13
    Thanks! I saw that first link before; that's how I got the inspiration for this. Little did I know that it would be so hard! When I looked at the info in the document from Parallax, it seemed easier...But maybe I could take a different approach; do you know those universal remoted that 'learn' commands? Well, can't I have my microcontroller use that method to figure out the protocol? FYI, I do not need to know what button goes to which protocol; this will just receive commands at random from the remote, and relay them to the TV at a later time.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Giggly Googley!
  • stephenwagnerstephenwagner Posts: 147
    edited 2008-03-12 19:40
    I can only help you with the BS2 micro controller. I am unfamiliar with your micro controller of choice. There are lots of·protocols ·and modification of protocols with IR remotes. There are also repeat pulses that are transmitted while the user holds a button down. ie. a 'start' pulse followed by a logic one and repeated at some interval. Not all "Learning remotes" can record the·protocols. I hade this issue with a knock off Magnavox. If you study the repeater paper, the Magnavox followed no standard IR protocol. You are better off with the boe bot receiver software/hardware using RCTIME and the boe bor transmitter example. I was not happy with the 555 timer 38KHz modulator/transmitter. I found over 1KHz of drift using consumer electroinc parts. Purchase the TX-IR Infrared Remote Control IC from http://www.rentron.com/remote_control/TX-IR.htm. ·I used a second BS2 and IR receiver to get my timming corret for my transmitter. I used PULSOUT to an unused pin to occupy time. I also used a BS2 and PULSEIN 0, ... to capture the first 8 light on pulses of the consummer remote and PULSIN 1, ... to capture the light off pulses. I found that for the NEC protocol and the RCA protocol that the information was in the light off pulses. I then used the RCTIME receiver example to determine the number of pulses/bit and the raw binary data MSB first/last.·By studing the recived bits that are changing and the bits that are logical NOT, I reverse engineered the protocol for that remote device.

    Have Fun.
  • allanlane5allanlane5 Posts: 3,815
    edited 2008-03-12 20:15
    The Ant-8 http://www.rockylogic.com/products/ant8.html

    is a Logic Analyzer -- it samples up to·8 lines of TTL data, and presents the results as a graph,
    showing the timing of the signals.

    Post Edited (allanlane5) : 3/12/2008 8:33:24 PM GMT
  • stephenwagnerstephenwagner Posts: 147
    edited 2008-03-12 20:49
    You should have no issues using one (1) channel, the correct sampling speed·and a IR reciver.

    ·
  • NoBo780NoBo780 Posts: 94
    edited 2008-03-14 12:24
    Stephen:

    I always wanted a scope, and I think that will probably be the only surefire way of measuing the IR pulses. The problem is, I am not sure I have that much money on an instrument that I will rarely use. Although they are great tools, I would not use it much, even though this situation probably demands one. Is the scope manufactured by Parallax sufficient (fast enough/enough resolution/refresh time for this puropse)? It's only $129. Also, is there any other way I can go about measuring the sequences without a oscilloscope or logic analyzer? Thanks for the help.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Giggly Googley!
  • stephenwagnerstephenwagner Posts: 147
    edited 2008-03-14 17:55
    NoBo780

    I have never used the Parallax Scope. I constructed a poormans scope with a BS2 OEM.

    The BS2 is not fast enough to capture the light on and light off pulse periods in one shot.·PULSIN PIN, 1 is fast enough to capture just the high pulses and PULSIN PIN, 0 is fast enough to capture the low pulses.

    Write a program to capture the LIGHT OFF pulse periods.
    Remember, the IR·receiver outputs 5V when the IR transmitter is off and the IR receiver outputs 0V when the IR transmitter is on.

    The following will capture 10 light off pulse periods.
    PULSIN PIN, 1, PULSEVALUE(0) 'Array Value 1
    PULSIN PIN, 1, PULSEVALUE(1) 'Array Value 2
    .
    .
    .
    PULSEIN PIN, 1, PULSEVALUE(9) 'Array Value 10

    Write a second program to capture the LIGHT ON pulse periods.
    The following will capture 10 light on pulse periods.
    PULSIN PIN, 0, PULSEVALUE(0) 'Array Value 1
    PULSIN PIN, 0, PULSEVALUE(1) 'Array Value 2
    .
    .
    .
    PULSEIN PIN, 0, PULSEVALUE(9) 'Array Value 10

    Draw a wave period similar to the NEC protocol and start writing down the values received for light on and light off periods. You should see the pattern jump out at you.

    Except for the first light on period, the other nine should be the same value for the NEC protocol. Except for the first light off value, the other nine you should see two unique values.

    Follow the IR boe bot paper and write a program using RCTIME to capture the number of bits and there values.

    SJW
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-03-14 19:56
    Another thing to take into consideration both for measuring the pulses and for generating them is that the low-to-high delay from the IR receiver is longer than the high-to-low delay. You can see this effect in the scope trace I posted here.

    -Phil
  • NoBo780NoBo780 Posts: 94
    edited 2008-03-16 01:17
    Stephen:

    Thank you very much. I have a few questions, though.
    stephenwagner said...
    Draw a wave period similar to the NEC protocol and start writing down the values received for light on and light off periods. You should see the pattern jump out at you.

    Except for the first light on period, the other nine should be the same value for the NEC protocol. Except for the first light off value, the other nine you should see two unique values.

    Follow the IR boe bot paper and write a program using RCTIME to capture the number of bits and there values.

    What do you mean by "Draw a wave period"? And where can I find the NEC protocol? And lastly, what does RCTIME have to do with this? And why do I need the number of bits and their values? Here's the programs I used, BTW:

    ' {$STAMP BS2e}
    ' {$PBASIC 2.5}
    ' LIGHT OFF PULSE SEQUENCE (IR Transmitter LOW)
    
    ir  PIN   15
    PULSEVALUE    VAR   Word(10)
    
    PULSIN ir, 1, PULSEVALUE(0) 'Array Value 1
    PULSIN ir, 1, PULSEVALUE(1) 'Array Value 2
    PULSIN ir, 1, PULSEVALUE(2)
    PULSIN ir, 1, PULSEVALUE(3)
    PULSIN ir, 1, PULSEVALUE(4)
    PULSIN ir, 1, PULSEVALUE(5)
    PULSIN ir, 1, PULSEVALUE(6)
    PULSIN ir, 1, PULSEVALUE(7)
    PULSIN ir, 1, PULSEVALUE(8)
    PULSIN ir, 1, PULSEVALUE(9) 'Array Value 10
    
    DEBUG "ONE: ", DEC PULSEVALUE(0), CR
    DEBUG "TWO: ", DEC PULSEVALUE(1), CR
    DEBUG "THREE: ", DEC PULSEVALUE(2), CR
    DEBUG "FOUR: ", DEC PULSEVALUE(3), CR
    DEBUG "FIVE: ", DEC PULSEVALUE(4), CR
    DEBUG "SIX: ", DEC PULSEVALUE(5), CR
    DEBUG "SEVEN: ", DEC PULSEVALUE(6), CR
    DEBUG "EIGHT: ", DEC PULSEVALUE(7), CR
    DEBUG  "NINE: ", DEC PULSEVALUE(8), CR
    DEBUG "TEN: ", DEC PULSEVALUE(9), CR
    
    END
    
    



    ' {$STAMP BS2e}
    ' {$PBASIC 2.5}
    ' LIGHT ON PULSE SEQUENCE (IR Transmitter HIGH)
    
    ir  PIN   15
    PULSEVALUE    VAR   Word(10)
    
    PULSIN ir, 0, PULSEVALUE(0) 'Array Value 1
    PULSIN ir, 0, PULSEVALUE(1) 'Array Value 2
    PULSIN ir, 0, PULSEVALUE(2)
    PULSIN ir, 0, PULSEVALUE(3)
    PULSIN ir, 0, PULSEVALUE(4)
    PULSIN ir, 0, PULSEVALUE(5)
    PULSIN ir, 0, PULSEVALUE(6)
    PULSIN ir, 0, PULSEVALUE(7)
    PULSIN ir, 0, PULSEVALUE(8)
    PULSIN ir, 0, PULSEVALUE(9) 'Array Value 10
    
    DEBUG "ONE: ", DEC PULSEVALUE(0), CR
    DEBUG "TWO: ", DEC PULSEVALUE(1), CR
    DEBUG "THREE: ", DEC PULSEVALUE(2), CR
    DEBUG "FOUR: ", DEC PULSEVALUE(3), CR
    DEBUG "FIVE: ", DEC PULSEVALUE(4), CR
    DEBUG "SIX: ", DEC PULSEVALUE(5), CR
    DEBUG "SEVEN: ", DEC PULSEVALUE(6), CR
    DEBUG "EIGHT: ", DEC PULSEVALUE(7), CR
    DEBUG  "NINE: ", DEC PULSEVALUE(8), CR
    DEBUG "TEN: ", DEC PULSEVALUE(9), CR
    
    END
    
    



    Let me know if I'm doing anything wrong, here. Also, don't I need some way for the BS2 to WAIT until it sees the start of the sequence to start recording the pulses? Otherwise, if I just place my TV remote in front of the IR detector and hold down, say, the volume + button, and then press reset on the BS2, then it is highly likely that it will simply catch the sequence anywhere but from the beginning about 98.9% of the time??

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Giggly Googley!
  • NoBo780NoBo780 Posts: 94
    edited 2008-03-16 01:32
    Hmmm... Maybe I'm wrong. Whenever I run the program, and hold down the VOL+ or VOL- buttons on the remote, the BS2 returns the same results (but varying by sometimes up to 20) SOMETIMES. About 70% of the time this is true, but other times, I get some wacko values...

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Giggly Googley!
  • stephenwagnerstephenwagner Posts: 147
    edited 2008-03-17 12:47
    NoBo780
    1. Please read the links I posted in my first post. The NEC protocol is described in almost every post.
    2. Draw the wave periods described in the protocols posted and than write down·some of the light on times and assign them to the high periods you have drawn. Then write down some of the light off periods and assign them to the low periods. With the nec protocol the information is in the light off time periods.
    3. Read the basic stamp manual and the RCTIME instruction. RCTIME is just a stop watch. It measures the time of period from RCTIME execution to a Low/High and/or High/Low transition. There is an example in the basic manule with no resistors or capacitors that measures the contact closure time of a relay. The RCTIME instruction is used in the IR receiver to capture the "1" and "0". In the case of the nec protocol the light is off for approximately 1125 mSec - 560 mSec = 565 mSec for a logical "0" and the light is off for approximatly 2250 mSec - 560 mSec = 1690 mSec. If you take the average of 565 and 1690 (565 + 1690)/2 = 1127.5 or 1128 mSec and use this value·and compare it to what is received by·RCTIME you can set the bits in you receiver to a 1 if greater then and a 0 if less then. Remember the stamp performs time measurement in 2 uSec intervals. 1128 mSec / 2 uSec = 564 RCTIME periods. Use 564 as a threshold. I used 557 in my project.
    4. Read the book on remotcontrol for the boe bot.
    5. The·wacko time values are either the "Repeat Code" described in the NEC protocols and / or the time period between "+VOL" periods.

    Write· two (2) basic programs. create one to receive four 8bit codes and a second program to receive four 6bit codes. DEBUG out the codes in binary one right under the next and study them. Look for things that change and things that don't change. Also look for bits that are opposite.

    The code posted in my project will help solve·some of your issues.
    checking:
    IF det = 1 THEN checking
    PULSIN det, 1, pulse
    IF pulse < 1935 OR pulse > 2005 THEN checking 'check for 4000 uSec (3930)/2 = 1965 +/- 30

    The above code looks at the detector and if the detector sees no IR light, the code loops back to checking. If the code sees IR light, the code PULSINs the time there is no IR light after the IR light has gone away. I check the period the IR light is off and then the code performs RCTIMEs on all the·24 low periods. There are 24 for the RCA protocol. 4 goups of 6 for a total of 24.

    I hope this helps.

    SJW
  • NoBo780NoBo780 Posts: 94
    edited 2008-03-17 13:32
    Thanks a lot. I'll try to work on this when I get some spare time, soon. FYI, you made a typo, so I don't see which is which:
    stephenwagner said...
    In the case of the nec protocol the light is off for approximately 1125 mSec - 560 mSec = 565 mSec for a logical "0" and the light is off for approximatly 2250 mSec - 560 mSec = 1690 mSec.
    "off" and "off". Which one is supposed to be "on"?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Giggly Googley!
  • stephenwagnerstephenwagner Posts: 147
    edited 2008-03-17 13:52
    In the case of the nec protocol the light is off for approximately 1125 mSec - 560 mSec = 565 mSec for a logical "0" and the light is off for approximatly 2250 mSec - 560 mSec = 1690 mSec FOR A LOGICAL "1".

    I hope this helps.
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-03-17 17:00
    This thread is being moved from the BASIC Stamp Forum to the Sandbox.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • NoBo780NoBo780 Posts: 94
    edited 2008-03-19 00:25
    Woow...This is way over my head. Nevermind. I am going to have a REALLY hard time doing this without an oscilloscope/logic analyzer. I have NEVER given up before, but this is too much.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Giggly Googley!
Sign In or Register to comment.