Shop OBEX P1 Docs P2 Docs Learn Events
Ir remote control w/ BS2 — Parallax Forums

Ir remote control w/ BS2

dimattdimatt Posts: 5
edited 2012-02-09 08:02 in Learn with BlocklyProp
Im making an ir remote control for our class t.v. with and infared LED and an infared-sensitve photoresistor. I've already found the JVC ir protocal being that·each pulse is a 526µs long 38kHz carrier burst (about 20 cycles). A logical "1" takes 2.10ms to transmit (equivalent of 80 cycles), while a logical "0" is only 1.05ms (equivalent of 40 cycles). Should i be using the freqout command or the pulseout command for the bs2 output? What would the commands look like put together?
«1

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-05-17 15:46
    Are you trying to transmit IR codes with a BS2? That may not be possible, as the instruction load delay will interfere with timing. You would probably have better luck with the SX and SX/B.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas, TX· USA
  • edited 2005-05-17 16:39
    If that 526 uS requirement was not involved, you could probably just use the FREQOUT command to send either 1 ms or 2 ms for transmitting the bits.· However, you may still be able to use a 555 timer with the BASIC Stamp to get the job done.· Since a 555 timer is common and inexpensive, it might be worth a try.· Here's how: Use·the 555 timer tuned to 38.5 kHz, and send PULSOUT commands to its reset pin (Pin 4) to control the amount of time that it modulates the signal.· Instead of the speaker and capacitor shown in Chapter 6, use the IRLED and 470 ohm series resistor.· Assuming P6 on the BASIC Stamp is connected to the 555 timer's reset pin, PULSOUT 6, 263 would make the 555 timer send a 526 uS signal to the IR LED.· See Basic Analog and Digital, Chapter 6 for instructions on how to set the frequnecy on a 555.· It's available for free download from www.parallax.com -> Downloads -> Stamps in Class Tutorials.

    ·
  • edited 2005-05-17 22:17
    Alright, here is proof of concept for the BASIC Stamp 2 and 555 timer transmitting the JVC IR protocol.· The 555 timer IC in this example should be fairly easy to obtain locally, but you can also get one form Parallax for $2 US plus shipping.· Here is the link:

    http://www.parallax.com/detail.asp?product_id=604-00009

    This 555 timer circuit will transmit at around 38 kHz when the Reset pin is held high. P7 is for measuring your transmit frequency, and P8 is left floating because the program sends it PULSOUT commands to establish the delay between 526 microsecond bursts of IR.

    attachment.php?attachmentid=37810

    This program sends the start bit, followed by binary 1010. While the PULSOUT commands to P6 correspond exactly with the modulated IR times, the PULSOUT commands to P8 do not. This allows the delay between IR bursts to be precise because the shorter PULSOUT durations compensate for processing overhead.
    ·
    [color=#008000]' TestJvcTransmit.bs2[/color]
    [color=#008000]' This is not a complete message packet.  However, it does demonstrate[/color]
    [color=#008000]' how to transmit start, binary-1, and binary-0 using the JVC IR protocol.[/color]
     
    [color=#008000]' {$STAMP BS2}[/color]
    [color=#008000]' {$PBASIC 2.5}[/color]
     
    [color=#0000ff]LOW[/color][color=#000000] 6[/color]
     
    [color=#0000ff]DO[/color]
     
      [color=#0000ff]PULSOUT[/color][color=#000000] 6, 4200    [/color][color=#008000]' Start of message signal[/color]
      [color=#0000ff]PULSOUT[/color][color=#000000] 8, 1850[/color]
      [color=#0000ff]PULSOUT[/color][color=#000000] 6, 263     [/color][color=#008000]' Binary 1[/color]
      [color=#0000ff]PULSOUT[/color][color=#000000] 8, 550[/color]
      [color=#0000ff]PULSOUT[/color][color=#000000] 6, 263     [/color][color=#008000]' Binary 0[/color]
      [color=#0000ff]PULSOUT[/color][color=#000000] 8, 66[/color]
      [color=#0000ff]PULSOUT[/color][color=#000000] 6, 263     [/color][color=#008000]'[/color] [color=#008000]Binary 1[/color]
      [color=#0000ff]PULSOUT[/color][color=#000000] 8, 550[/color]
      [color=#0000ff]PULSOUT[/color][color=#000000] 6, 263     [/color][color=#008000]' Binary 0[/color]
      [color=#0000ff]PULSOUT[/color][color=#000000] 8, 66[/color]
     
      [color=#0000ff]PAUSE[/color][color=#000000] 35           [/color][color=#008000]' 35 ms delay before repeat[/color]
     
    [color=#0000ff]LOOP[/color]
    
    

    The oscillator frequency may be a bit off.· If you're within a couple hundred hertz of the 38.5 kHz center frequency, it usually works, but your effective transmit range will be significantly larger if you calibrate the timer.· You can do this by replacing the series 1 k and 470 Ω resistors with a 10 k potentiometer.· Then, with the aid of the program below, adjust the potentiometer until you get the Debug Terminal to report a value as close to 38500 as possible.
    ·

    [color=#008000]' TestFrequencyAndDutyCycle.bs2[/color]
     
    [color=#008000]' {$STAMP BS2}[/color]
    [color=#008000]' {$PBASIC 2.5}[/color]
     
    cycles        VAR      Word
    tH            VAR      Word
    tL            VAR      Word
     
    [color=#0000ff]DO[/color]
     
      [color=#0000ff]LOW[/color] 6
      [color=#0000ff]PAUSE[/color] 100
      [color=#0000ff]HIGH[/color] 6
      [color=#0000ff]COUNT[/color] 7, 100, cycles
      cycles = cycles * 10
      [color=#0000ff]PULSIN[/color] 7, 1, tH
      tH = tH * 500
      [color=#0000ff]PULSIN[/color] 7, 0, tL
      tL = tL * 500
      [color=#0000ff]DEBUG[/color] [color=#800080]HOME[/color], [color=#ff0000]"Frquency (Hz)   "[/color], [color=#000080]DEC5[/color] cycles,
              [color=#800080]CR[/color], [color=#ff0000]"Time high (uS): "[/color], [color=#000080]DEC5[/color] tH,
              [color=#800080]CR[/color], [color=#ff0000]"Time low: (uS): "[/color], [color=#000080]DEC5[/color] tL
     
    [color=#0000ff]LOOP[/color]
    
    

    ·

    Post Edited (Andy Lindsay (Parallax)) : 5/23/2005 5:07:12 PM GMT
  • NoodlesNoodles Posts: 19
    edited 2005-05-25 14:36
    I agrre with andy about the freqency being generated by a 555, however you may have problems with a bs2 because JVC codes happen really fast and there are alot of elements. I am not sure becasue I am doing the reverse and the bs2 can't store all the elements fast enough to decode. REMMEMBER that 2.10 time is from RISING EDGE TO RISING EDGE or from the start of one pulse to the next so take 2100 - 526 = 1574, so that element consists of 526uS high followed by 1574uS low. If you have accsess to a fluke or tectronix scope that'll make the job easier, at least it help me.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"We Are Not Human Beings Having·A Spiritual Experence,

    ··············... We Are··Spiritual Beings Having·A·Human Experence"
  • edited 2005-05-25 20:12
    Noodles,

    I'm not sure if decoding JVC will work with a BS2, but I think there is a chance it could. The trick to try would be to use RCTIME to measure the time to the edge. My guess is that it will return different values for zero or one, and even give you enough time for some concise number crunching before the RCTIME command. Hopefully, it will make it possible to process each bit as it is received.

    Andy
  • NoodlesNoodles Posts: 19
    edited 2005-09-16 04:08
    At this point in time I've abandoned the project in the larger scope of things it's become too much work and the protocol is open so I can't use it in the field for fear of accidental firing of the rockets which is a shame because its a small neat remote and has all the buttons i need. however it's quite difficult to store the data fast enough even with a bs2p, i'm not quite sure if a faster MCU would help. my launch pad now self levels and I plan on using a analog joystick and a SX key to transmit movements over a serial line and a seperate SECURE line for firing and saftey emergency stop circuit... I guess a drive train might help too

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"We Are Not Human Beings Having·A Spiritual Experience,

    ··············... We Are··Spiritual Beings Having·A·Human Experience"
  • CJCJ Posts: 470
    edited 2005-09-16 11:30
    I was looking for this exact type of circuit to try transmitting low speed serial, rather than pulsout, will probably have to use parity,
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-09-16 13:56
    If you're using this with rockets, then I HIGHLY recommend a hard-wired connection. Nothing will mess up your day like a rocket firing up your nose because somebody was trying to tune their television -- or sat on the remote.

    Most firing systems I've seen have a safety-key, that MUST be in place before the rocket can be fired. This makes it fairly safe to pull the key, go out to the pad and load up the rocket, then return to the launch console and re-insert the key. But THAT only works because the console has a hard-wired connection to the pad.

    Also, IR remotes are limited to about 50 feet or so, indoors. Bright sunlight may reduce that range further.

    Bottom line -- rockets are fun, but seriously dangerous. Be careful and don't get hurt!
  • CJCJ Posts: 470
    edited 2005-09-16 22:22
    Andy,

    I built that circuit as depicted and it doesn't work, checked it about half a dozen times, then I built the adjustable one on page 109 of Basic A and D, and it worked, so I know my parts are good, does that exact one work for you?
  • CJCJ Posts: 470
    edited 2005-09-17 01:05
    I figured it out, the 470 and 1K,needed to go to pin 7 discharge, between it and the 470 to vdd, now it works quite nicely

    attached is the schematic of how I had to change the circuit to make it work

    Post Edited (CJ) : 9/17/2005 1:19:44 AM GMT
    677 x 306 - 22K
  • edited 2005-09-17 03:43
    CJ,

    Sorry about the mistake in my schematic. Thanks for finding and posting the correction! A trouble-shooting job well-done.

    Andy
  • NoodlesNoodles Posts: 19
    edited 2005-09-28 02:18
    Not To take this thread off base, I wanted to respond to cj's comment concerning rocket saftey. I had abandoned iR because of saftey and SECURITY It would be too easy for some one with a palm pilot and commercialy available software to LISTEN and REPEAT the iR code. However I also program PLC's and there is much consideration inot fail safe enviroments here. RF design magazine offers many serial to serial RF Transcievers as does parallax Vs. the type that put a pin high when a button is pressed this allows a sequence of commands to be sent . This eliminates the possiblity of noise affecting the system. To ARM THE ROCKETS (not to fire) a series of codes are sent. The first is a header that tells the MCU that codes are coming..The next 3 are numbers I use the MOD operator so the codes can be changed without reprogramming. Allow me to digress...The MOD operator returns the remainder of division. So I tell the MCU to evaluate the codes for a zero remainder. Ex. my launch sequence is 14 24 91 the real code is 7...8...9 I check to see is the first code is divisable by 7 then 8 then 9....then arm. If any code fails wait 10 Sec. then accept retranmitted codes if the codes fail 1st attempt multiple times then lock the system. the chance of this cobination ( with larger nubmers and more codes ) is slight if at all. First off the connection is available with AES encrypt. and the codes themselves use simple encypt not only does this keep others out it also makes ARMING my interference LESS possible if at all. The FIRING power source would then Lockable by use of a contactor or relay allowing the rockets to be locked out or isolated ( Google : Lock Out - Tag Out or redunant saftey) this means that the arming relay must be engaged to make firing possible. the 2nd relay fires. however the goal of this project is to locate ground and air threats on a HOT RANGE so once control is handed to the robot IT IS IN CONTROL and humans should not be on the range (e.g. out side of a bunker) I use a web cam to watch from behind cover. BUT YES I HAVE HAD MY HANDS BURT BY ROCKETS IN THE PAST. AND I ALSO WOULD ADVISE ANYONE USING THEM LIKE THIS WEAR A FULL FACE SHIELD AVAILABE AT A WELDING SUPPLY or lowes maybe.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"We Are Not Human Beings Having·A Spiritual Experience,

    ··············... We Are··Spiritual Beings Having·A·Human Experience"
  • NewName007NewName007 Posts: 12
    edited 2005-10-21 22:53
    now will the corrected circuit above "tune" the 555 to 38.5KHz? and I dont understand what I do with pin8.
  • edited 2005-10-22 01:00
    The corrected circuit should give you a frequency close enough to 38 kHz for the IR receiver to detect it. P8 is left floating. You can send it pulsout commands if you need to establish times when the IR signal is not sent that last less than 1 ms.
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-10-24 14:52
    What Andy is saying is, if you want to send 100 uSec on and 100 uSec off -- well, there's no "Pause(100 uSec)" command in the BS2. So, to get the BS2 to 'pause' for that long, you'd use a "PULSOUT 8, 50" command to in effect get the pause you need. You'd also have to experiment with that, because just loading the PULSOUT command is going to take a few 10's of uSec.
  • NewName007NewName007 Posts: 12
    edited 2005-10-27 00:06
    Great! Now today I just made a radio shack run, I picked up a 555CN Timer IC. I suppose that will work, and I did not pick up a electrolytic .01 uF capacitor becase I thought I had one laying around and indeed I do not. Can I just use a ceramic disc capacitor? what will it be labled on the front so I know it is a .01uF?
    thanks
  • edited 2005-10-27 01:19
    A 0.01 uF ceramic·capacitor should have the number 103 printed on it.·

    103 indicates·10 with three zeros·tacked on the end, and then multiplied by 1 pF.

    10x103 X 1x10-12 = 10x10-9
    ···························= 10 nF
    ···························= 0.01 uF

    Post Edited (Andy Lindsay (Parallax)) : 10/27/2005 3:29:32 AM GMT
  • ShamsulShamsul Posts: 2
    edited 2005-10-27 07:07
    Hi,



    I am trying to build a digital inclinometer. My idea is to connect a linear potentiometer to ADC0831 then connect to SLED4C. When the voltage from the potentiometer is zero then it will display 0 (Zero) again the potentiometer will rotate, it will supply 1.5V to ADC the SLED4C will display 210.



    This is my first project with ADC0831. Would you please tell me, what are the things I should buy? Would you please tell me about the connections and the program? I know the BASIC program.













    Thanks





    Shamsul



    Vancouver
  • Paul BakerPaul Baker Posts: 6,351
    edited 2005-10-27 17:43
    Shamsul, you question has nothing to do with IR remote control, therefore you should create a new post so people don't miss your question.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·1+1=10
  • NewName007NewName007 Posts: 12
    edited 2005-10-28 21:53
    Could someone point me in the direction of where I can get the results from others who have used the ciruit and how accuratly it was for them.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If it doesn't fit dont force it, Just get a bigger hammer.
  • edited 2005-10-29 01:24
    Here are two suggestions:

    ·- 1 -
    • Scroll to the top of this page
    • Click the Stamps in Class link
    • Click the New Topic button to start a new thread with your new question

    ·---· OR· ---

    ·- 2 -
    • Scroll to the top of this page
    • Click the Parallax Forums link
    • Click the BASIC Stamp link
    • Click the New Topic button to start a new thread with your new question
  • NewName007NewName007 Posts: 12
    edited 2005-10-29 02:05
    yea but then Id have to use this thread as a reference which means people have to go through that much more effort to know what im talking about. If it retains to the same subject as the thread was started on,Why not ask the question here? So I dont see a reason for you to be a "start a new thread nazi" with me..

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If it doesn't fit dont force it, Just get a bigger hammer.
  • CJCJ Posts: 470
    edited 2005-10-29 16:36
    If you use the 10k pot, like andy said in his schematic post, you can tune it to exactly what you need, just be sure to use the fixed schematic I posted a few down from his as the start point
  • NewName007NewName007 Posts: 12
    edited 2005-10-29 17:26
    not sure how Im supposed to connect the potentiometer in the circuit. I think I connect the Wiper between pin 7 of the 555 and the 470 ohm resistor. and the other two pins im not sure about. I would guess one of them has to connect to the capacitor and pin 2 but im not sure which one.
    any help?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If it doesn't fit dont force it, Just get a bigger hammer.
  • CJCJ Posts: 470
    edited 2005-10-29 18:30
    one leg to pin 6 and the wiper to between pin 7 and the 470ohm the other leg is not connected
  • edited 2005-11-02 18:54
    NewName007,

    Here is how I think the circuit should look with a 555 timer. You can then use "TestFrequencyAndDutyCycle.bs2" from an earlier post to tune the circuit.
    attachment.php?attachmentid=39314

    Andy


    Post Edited (Andy Lindsay (Parallax)) : 11/2/2005 7:01:20 PM GMT
    704 x 325 - 61K
  • edited 2005-11-02 18:57
    CJ,

    Here is a re-drawn circuit with your corrections incorporated. Thanks again for letting us know about the bug.

    attachment.php?attachmentid=39315

    Andy


    Post Edited (Andy Lindsay (Parallax)) : 11/2/2005 7:01:33 PM GMT
    700 x 322 - 57K
  • NewName007NewName007 Posts: 12
    edited 2005-11-10 00:19
    The 100 K potentiometer is very sensitive and VERY hard to get close to 38500 Hz. how much grace do I get with the frequency im transmitting on? If i spend long enough on it I can get it to 38***hz but thats all i get to choose the last 3 digits just jump around. Should I check my circuits again or is that just how it is?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If it doesn't fit dont force it, Just get a bigger hammer.
  • edited 2005-11-10 04:00
    Yeah, a 10 k pot would be much better. There are also multi-turn 10 k pots that would give you even more control with the screwdriver.

    Here is a link to the product page for a 10 k trim pot: http://www.parallax.com/detail.asp?product_id=152-01031
    Here also is a link to the product page of a 10 k, multi-turn pot: http://www.parallax.com/detail.asp?product_id=152-01032

    The filter in the IR receiver is pretty forgiving over short range. You've probably got at least +/- 1 kHz, maybe more. So, as long as those two leftmost digits are 37 or 38, it should be fine.

    Finding the exact transmission frequency for maximum range will take some fine tuning, and it might not be at exactly 38000 Hz, and it will also change a little from one receiver to the next.
  • chuckconderchuckconder Posts: 2
    edited 2012-02-09 08:02
    CJ wrote: »
    I figured it out, the 470 and 1K,needed to go to pin 7 discharge, between it and the 470 to vdd, now it works quite nicely

    attached is the schematic of how I had to change the circuit to make it work

    Post Edited (CJ) : 9/17/2005 1:19:44 AM GMT

    how hard would it be to integrate a few buttons that associate's with the code . Power on, source, volume up down?

    Chuck
Sign In or Register to comment.