Shop OBEX P1 Docs P2 Docs Learn Events
Infrared Troubles... — Parallax Forums

Infrared Troubles...

ArchiverArchiver Posts: 46,084
edited 2001-11-04 18:29 in General Discussion
I need to send a 40khz freq to an infrared led to be detected by a metal can
detector (you know, from Radio Shack). I'm using the BS2, and it does seem to
output the signal, but it does not work. My real problem is that I can't get the
correct freq out...my math says that I need to use a 12.5 period on PULSOUT, but
you can't use decimal values. Freqout doesn't work, I've already tried 32khz,
but to no avail. ANY help is appreciated...


[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-11-01 18:15
    Try with the freqout command, Works well I used it to do distance
    measurement. [noparse]:D[/noparse]


    Mensaje original
    De: Astro Fizzix [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=9YAXyW96Ni_i1p7vOnsO4-KXBRUDPmjbAAf_ch28CqJWbG6VPGBngO6FNMNLHUOQtmSJq3aEKbzvPBbIBUo]astro_fizzix@y...[/url
    Enviado el: Mi
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-01 21:25
    Offload the task to a 555 running at 40KHz, the 555 will easily drive
    the LED, can be easily controlled by the stamp. Frees up the stamp to
    do other things.

    --- In basicstamps@y..., "Astro Fizzix" <astro_fizzix@y...> wrote:
    > I need to send a 40khz freq to an infrared led to be detected by a
    metal can detector (you know, from Radio Shack). I'm using the BS2,
    and it does seem to output the signal, but it does not work. My real
    problem is that I can't get the correct freq out...my math says that
    I need to use a 12.5 period on PULSOUT, but you can't use decimal
    values. Freqout doesn't work, I've already tried 32khz, but to no
    avail. ANY help is appreciated...
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-02 15:39
    Carlos, I was wondering if you'd explain what setup you have for distance
    measurments, I have always been curious about how that works, if it's not too
    much trouble...


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-04 00:10
    Sure, no problem, the only limitation is that only measures distances
    ranging from 0-25cms max, just connect an IRLed and receiver and point
    them in the same direction so the light emmited by the led can return to
    the receiver once it's reflected back from a surface (the brighter the
    surface the more distance can measure), then use freqout on the emmiter
    to generate a 40khz signal for 1ms then check the receiver status and
    there you go, a 1 must appear if an object is in the range, if you try
    several frequencies you can obtain several distances, using lookup helps
    a lot!!

    Here's the program that does it:

    counter var nib
    l_val var byte
    r_val var byte
    ir_freq var word

    main:

    l_val=0
    r_val=0

    for counter=0 to 4
    lookup counter,[noparse][[/noparse]37500,38250,39500,40500,41500],ir_freq
    freqout 15,1,ir_freq
    l_values.lowbit(counter)=~in14

    debug home,cr,cr
    debug " ",bin8 l_values
    debug " ",dec5 ncd(l_values)
    goto main

    NOTE:
    Don't separe the "freqout" line from the "l_values" one, if you do so
    you won't be able to recover the bit before it disappears, also put a
    .1uF capacitor between Gnd and Vdd on the receiver pins. Have Fun!!

    If you need more help just contact me again!!
    (sorry about my English [noparse]:)[/noparse] I'm from Venezuela and I'm 17 years old)

    Mensaje original
    De: Astro Fizzix [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=hZChI0bRN9aFk33Epa7PhW-LWx7ORMY0T_wkIb6P_EfRPTXEdPKCoUXw4TRWVH1HKJlsNj2eDqSnNIKgew]astro_fizzix@y...[/url
    Enviado el: Viernes, 02 de Noviembre de 2001 11:40 a.m.
    Para: Post BS Message
    Asunto: [noparse][[/noparse]basicstamps] RE: Infrared Troubles...

    Carlos, I was wondering if you'd explain what setup you have for
    distance measurments, I have always been curious about how that works,
    if it's not too much trouble...


    [noparse][[/noparse]Non-text portions of this message have been removed]


    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject
    and Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-04 14:52
    Wow, that's great! But, the BS2 can only generate a MAX of 32.7khz, which is
    where my problem is...however, I assume from your code that different freq's
    send out different light strengths. Kinda like the brightness of an LED. Is that
    correct? I can hookup a little 555 setup and generate the 40khz or whatever I
    want, so what you have shown me is very helpful, thank you!
    By the way, sounds like you and me are on the same level, I'm 18.


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-04 18:29
    Hey, I was able to do the 48.5 KHz thing with a BS2E, no problem. Its just
    that the range and reliability of the sensor was not so good. I switched to
    the Sharp modules and have had no problems.

    Original Message

    > Wow, that's great! But, the BS2 can only generate a MAX of 32.7khz, which
    is where my problem is...however, I assume from your code that different
    freq's send out different light strengths. Kinda like the brightness of an
    LED. Is that correct? I can hookup a little 555 setup and generate the 40khz
    or whatever I want, so what you have shown me is very helpful, thank you!
    > By the way, sounds like you and me are on the same level, I'm 18.
Sign In or Register to comment.