Shop OBEX P1 Docs P2 Docs Learn Events
Using a BS II to flash an LED with a carrier — Parallax Forums

Using a BS II to flash an LED with a carrier

deejayspinzdeejayspinz Posts: 6
edited 2010-09-28 19:21 in BASIC Stamp
Hi All,

I have a slight dilemma. I am building a IR Beacon to allow a robot seek it. I need to flash an IR LED at 1200Hz on a 38KHz carrier. I don't entirely understand the 38Khz carrier but, and this may be part of my problem.

So, what I did was create a small BSII SX IR LED flasher. In a nutshell PIN 1 is triggered using the FREQOUT command to flash the IR LED. The command I am issuing is: FREQOUT PIN1, 10000, 1200, 38000 (pin 1 for 10 seconds @ 1200Hz). The problem is, I dont think this is generating a 38KHz carrier.

After doing some Googling about this I found some sample circuits that suggest using a 555 Timer circuit to generate the 38KHz carrier and then using the BSII SX to generate the 1200Hz flash. Problem is, I dont understand how to do that. The following link shows a sample (http://www.electranix.net/?page_id=322). What I want to understand is how to replace the 555 circuit on the left with my BSII circuit to trigger the 38Khz circuit on the right. The other problem is due to my lack of understanding of the 38KHz carrier - I simply dont get the concept of the 1200Hz flashing of the IR LED on a 38KHz carrier.

Can anyone help me understand how I can get the above working the way I need to? Thx ahead of time for your tips / suggestions.

Comments

  • bill190bill190 Posts: 769
    edited 2010-09-27 20:16
    True, I don't think you can create a 38 kHz carrier with a Stamp. And a 555 timer would be best.

    All you need to do is power one connection on the IR LED with the 555 output, then power the other connection with a stamp pin output.

    So when the stamp output is on, 38 kHz signal is transmitted. Then when the stamp is off, nothing! You are basically switching on/off the 38 kHz carrier with the stamp.

    Better yet would be to use a transistor from the stamp output and then use that to switch on that one lead of the LED.

    The only problem with all this, is this is a bit complex and too fast to "see", so you will probably need some sort of test equipment to verify you have 38 kHz and also that the stamp is sending its portion of the signal at the right timing.

    You can do the math and come up with the right timing, then do something as simple as using a hexadecimal number instead of a decimal number, then the timing is not right! (It REALLY helps to be able to verify what your outputs are.)

    I have a frequency counter and also use a stamp as a frequency counter. A stamp can measure 38 kHz. I prefer to use the stamp as my frequency tester.

    And I use a Propeller to measure the whole works (output) from the IR LED. I use IR capture from the IR kit objects (software) on the Propeller Object exchange here...
    http://obex.parallax.com/objects/37/

    And I use an IR detector which they sell on the Parallax store. These are 38 kHz and will ONLY detect 38 kHz and are pretty picky! So you need to be close to 38 kHz on your carrier. IR detectors are made for other frequencies, but 38 kHz seems to be most common for IR remote stuff.

    Anyway I use the IR detector on the Propeller to "test the whole works" - output from the IR LED. Here is that detector...
    http://www.parallax.com/Store/Sensors/ColorLight/tabid/175/CategoryID/50/List/0/SortField/0/Level/a/ProductID/177/Default.aspx

    And I am working on an IR project now, so ask away if you have any questions.

    The short program for the stamp to detect frequency is on my other old computer which is not booted and I don't have time to boot it now (Windoze 2000) - takes forever. But I'll make a note to post here tomorrow with that code.

    With that small program, you will be able to see the 38 kHz from your 555! And then change a resistor or capacitor on the 555 and see the frequency change.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-09-27 20:22
    The FREQOUT is used for generating a 38KHz carrier and it can generate one other frequency as well. The two frequencies are mixed in the output pulse stream.

    Keep in mind that the FREQOUT frequencies don't go up as high as 38KHz. You're actually generating a lower frequency and using the 2nd harmonic. Read the description of this in the "IR remote for the BoeBot robot" tutorial that you can find here.

    If you want direct carrier generation, use an external 555 timer as described in the tutorial.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2010-09-27 20:25
    This document may be helpful [FONT=Arial,Bold][FONT=Arial,Bold]IR Remote for the Boe-Bot[/FONT]
    [/FONT]
  • bill190bill190 Posts: 769
    edited 2010-09-27 20:34
    The following is the Sony SIRC IR remote protocol. Very good explanation of how an IR signal with a carrier works and you can see this in their diagram...
    http://www.sbprojects.com/knowledge/ir/sirc.htm
  • deejayspinzdeejayspinz Posts: 6
    edited 2010-09-28 06:48
    Mike Green wrote: »
    Read the description of this in the "IR remote for the BoeBot robot" tutorial that you can find here. If you want direct carrier generation, use an external 555 timer as described in the tutorial.

    Mike, thx for the suggested reading, I think this may be my solution. I put together the circuit (555 timer) on page 201 and ran the code to allow me to adjust the frequency of the timer to 38KHz. It seems to be working, but I am getting odd result:

    There are two things that are confusing me:

    1) I have the circuit hooked up on a breadboard. As I watch the values, they hover from 5KHz to 8KHz. However, if I use my finger to push down on the 10K Trimpot, the 9V battery connections, or the 555 chip, they jump to the range from 31KHz to 42KHz and remain there until I remove my finger (note, I am making sure I am not bridging any connections). Like I have a bad or dirty pin. Or some form of capacitance getting into the circuit from my me? I guess things are sensitive at this high a frequency?

    2) With fingers on the trimpot (for example) I am watching the debug window, the values seem to follow a 2 or 3 second cycle where they ramp up from about 31KHz to 42KHz, then back down, then the cycle repeats itself.

    Any ideas? Have I got a bad component? I cant see how something would be loose, and wont really know until I solder everything together.

    DO
    HIGH 6
    COUNT 7, 100, cycles
    LOW 6
    cycles = cycles * 10
    DEBUG HOME, "Frequency = ", DEC5 cycles, " Hz"
    LOOP
  • Mike GreenMike Green Posts: 23,101
    edited 2010-09-28 06:54
    It sounds like you have a bad connection. Maybe one of the parts is not making good contact with a breadboard socket.
  • bill190bill190 Posts: 769
    edited 2010-09-28 08:01
    The above code you posted is what I use to measure frequency.

    Then for 38 kHz on a 555, I used the following and it worked perfect (although I was using 5 volts I think)...
    http://static.electro-tech-online.com/imgcache/8016-555schematic.gif

    If you are using the same value components, might want to measure each resistor with an ohm meter to be sure it is the correct value.

    And maybe try a 5k resistor instead of the variable resistor.

    Also try using something plastic to poke at the connections instead of your fingers.

    Some resistors have very thin wire and sometimes I have problems with these making a good connection on a breadboard. I cut another piece of the same wire, then poke that in the same hole with long nose pliers to get a good connection.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2010-09-28 08:52
    Here is a circuit I've used before. I put it on a little RadioShack board so I didn't have to deal with breadboard connection issues.
    482 x 393 - 33K
    640 x 440 - 41K
  • deejayspinzdeejayspinz Posts: 6
    edited 2010-09-28 09:32
    Guys,

    Thanks very much for the links/sample circuits. I did some more testing and think I am almost there. I think to get rid of the inconsistent readings, I will transfer the components to a permanent circuit.

    I'll let you know how it works out.
  • ercoerco Posts: 20,256
    edited 2010-09-28 10:56
    For a beacon, you will want to use a 556 timer to modulate a 38 kHz carrier at 1200 hz. This is the circuit you want, you just need to tweak the RC values to get 1200 hz.

    halfway down the page: http://www.botmag.com/articles/scribbler.shtml
  • bill190bill190 Posts: 769
    edited 2010-09-28 18:59
    erco wrote: »
    For a beacon, you will want to use a 556 timer to modulate a 38 kHz carrier at 1200 hz...

    But then you couldn't change the settings with the stamp and see what happens. There goes all the fun! :lol:
  • ercoerco Posts: 20,256
    edited 2010-09-28 19:21
    Sure! Thus freeing up a $50 Stamp to be the brains of a smart robot which tracks to the $2 dumb beacon or beacons! :)


    I can bring home the beacon...
Sign In or Register to comment.