Shop OBEX P1 Docs P2 Docs Learn Events
38khz IR receiver help — Parallax Forums

38khz IR receiver help

WhelzornWhelzorn Posts: 256
edited 2005-11-28 00:26 in General Discussion
I have some 38khz Infrared receiver modules I got from jameco. They work great with the bs2, but I'm trying to figure out why. They have 3 pins, as you probably know, +5V, gnd, and Vout.

The confusing part is that when power is supplied to it (and no signal is being detected), the Vout pin is just "off" (it *might* give off about .1v) but when it detects the 38khz IR signal, the Vout pin acts like ground (I don't know the correct term to describe that). But for example, if you put an LED between +5v and Vout, it will turn on when something is detected. I managed to use an example program to make it work with the bs2:
' {$STAMP BS2}
' {$PBASIC 2.5}

' Program Listing 1.1 - Testing the IR Beam.bs2

IR_detect  VAR  Bit
LOW 7

place:

  PAUSE 50
  FREQOUT 7, 1, 38500
  IR_detect = IN8
  IF IR_detect = 0 THEN unbroken

    ' Make sure to add six spaces to the debug statement
    ' below.  That way both debug statements will have the
    ' same number of spaces for a better display.

    DEBUG HOME, "Beam is broken; object detected.      "
    GOTO place

  unbroken:
    DEBUG HOME, "Beam is unbroken; object not detected."
    GOTO place


but I have no idea how to get this to work with other microcontrollers (specifically PIC) because I don't know how to get them to detect a difference between no input and ground.

Any help would be appreciated.

Thanks, Justin W

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-25 22:05
    It probably requires an external pull-up -- use 4.7K or 10K (to Vdd) on the Vout pin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • WhelzornWhelzorn Posts: 256
    edited 2005-11-25 22:18
    hmmm... I see what you mean, but I can't seem to find a way to test if this works or not.
    I tried putting a pull-up between Vdd and Vout, and then put an LED between Gnd and Vout and another between Vdd and Vout, and all this does is maked both LED's illuminate to full intensity (they are both getting +5v)

    edit: well, this happens with or without the pull-up resistor, and even so, I think it has an internal pull-up because the LED between Gnd and Vout is very dim without the pull-up, but it's still getting some power. All a pull up does is makes that one brighter.

    Post Edited (Whelzorn) : 11/25/2005 10:23:33 PM GMT
  • NewzedNewzed Posts: 2,503
    edited 2005-11-25 22:46
    You are getting what yiu should get with Vout pulled high.· Now shine an LED emiiter on the detector and see if the LED goes out.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • BeanBean Posts: 8,129
    edited 2005-11-26 03:11
    Vout is basically disconnected(not connected to V+ or GND) when nothing is detected. And when 38KHz is detected it is connected to GND.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95

    http://www.parallax.com/detail.asp?product_id=30012

    "SX-Video OSD module" Now available from Parallax for only·$49.95
    http://www.parallax.com/detail.asp?product_id=30015

    Product web site: www.sxvm.com

    Those that would give up freedom for security will have neither.
    ·
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2005-11-26 03:14
    Maybe this way (see pic.)?
    376 x 215 - 10K
  • pjvpjv Posts: 1,903
    edited 2005-11-26 19:52
    Hi PJ;

    In your proposed schematic, the forward base-to-emitter junction will clamp the "to stamp" voltage to 0.6 volts; surely not enough to be detected by it. You will need to isolate the transistor with a series resistor in order to permit simultaneous detection by a stamp.

    Cheers from Hawaii,

    Peter (pjv)
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2005-11-26 20:16
    Zoiks!· Well, yeah.

    I mean, I didn't know what Whelzorn's plan really is.· I should've made it an either/or proposition: keep the transistor and everything past it to experiment with the IRED Det. visually or omit all that and run the pulled-up output to the STAMP.
  • WhelzornWhelzorn Posts: 256
    edited 2005-11-27 05:06
    well, I am stunned to find out the how hard it is for the PIC16F84A (probably other PIC's as well) to detect small voltages. I mean, it couldn't even detect 5v through a 140ohm pull-up resistor. so I think the only thing for me to do is use a transistor (possibly a transistor array) for each and every pin. Any other ideas are appreciated though, because this seems impractical and hacky.
  • pjvpjv Posts: 1,903
    edited 2005-11-27 07:43
    Hi Whelzorn;

    Well, actually it is easy to detect small voltage excursions with an SX, even without using the comparator or an (external) A/D.

    But first, will you do some homework and post the specs of the IR product you are using.......it will help us guide you better than "some 38 KHz IR product from Jameco".

    We're happy to help, but for you to learn you need to be part of the discovery process; its no good for me to give you the schematic and code, that way you won't learn much.

    I expect the final solution will be for you to write some simple "pulse density modulated" D/A code to generate a voltage to bias one CMOS SX input near its threshold, and then adding (or subtracting) the IR analog signal to push it over (or under) the threshold.

    We can get you there, but you need to be in a frame of mind to be guided, so please start with "discovering" the specs of the detector, then we'll take the next step. In the meantime also search for PWM D/A converters among the SX or SXlist sites, you'll need to understand that to write the code.

    Cheers form Maui, Hawaii,

    Peter (pjv)
  • WhelzornWhelzorn Posts: 256
    edited 2005-11-27 15:28
    certainly, here is the datasheet for the module I am using: www.jameco.com/wcsstore/Jameco/Products/ProdDS/165008.pdf (the datasheet came from jameco, but since the part is made by sharp, I'm sure you can get it from them as well). Specifically, it's the GP1U26X Series module. As you can tell, the center frequency is 40kHz, even though the product description calls is a 38kHz receiver module. This particular one seems to be discontinued by jameco, either that or they now carry it under a different number. Strangely enough, the datashees says that it outputs +0.5v when the conditions (detects the IR) are met.

    BTW pjv, I am not using an SX, it's a PIC. The reason I did not have the specs before is because jameco does not carry anything under that product # anymore.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2005-11-27 16:17
    OK, well, as I look at it, it's already to go as is.· The Internal Block Diagram on page 2 shows that the output is pulled-up to Vcc.· In fact, the ouput is labelled /Vout.· So, when it's detecting then the output goes·LO (and when it's not detecting it's HI.)

    So, as I see it, if you want a HI when you are detecting, then add an inverter to the output.

    What are you using as a IR-sender?· An IRED going at 38 kHz?

    [noparse][[/noparse] Maybe what you want really is a IR photo-transistor? ]
    376 x 215 - 9K
  • WhelzornWhelzorn Posts: 256
    edited 2005-11-27 17:27
    wow, now this discovery is maddening: the PIC's detecting pin will complete the circuit, shorting out the circuit and everything connected to it:
    PIC pin> ----(led)---- V+

    wired like this, the LED lights up. I tried the same with a BS2, and it does not light the LED up.

    Why would this happen? I do not think it is the detector module that I am having a problem with anymore, because it works on the BS2 without any sort of anything. I can wire Vout from the module right into pin 0-15 of the bs2 and it detects it and everything. This makes absolutely no sense.

    BTW, I continue to ask the basic stamp community because I notice that the stamps all use PIC's and don't have this problem

    edit: my IR sender ATM is a TV remote.

    Post Edited (Whelzorn) : 11/27/2005 5:36:13 PM GMT
  • pjvpjv Posts: 1,903
    edited 2005-11-27 18:44
    Hi Justin;

    If PIC processors are your target, then I'm not your guy.......I really dont like them.

    Cheers form Maui, Hawaii,

    Peter (pjv)
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2005-11-27 19:10


    W,

    What are you doing?

    Can you U/L a drawing?



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When you get 1st Place in the "Darwin Awards", you're a Winner & a Loser.
  • WhelzornWhelzorn Posts: 256
    edited 2005-11-28 00:26
    Ok, I fixed my problem. The internal pull-up resistors on the PIC programmer config were turned on, but that was only half of it. What was happening is since the 16F84(A) does not have internal pull-ups, the configuration was changing some other bit inside the PIC. Whatever this bit did, it overrided the pin configurations in the code. Once I fixed this, I realized that the PIC really DID need a pull up or pull down resistor, in order to tell it to detect either Vcc or Vss. Now I still needed a way to get the detector to output something remotely detectable (0.2v wouldn't cut it) so I used PJ allens transistor set-up (thanks, BTW!) and it works great now!

    Thank you all for the help!
Sign In or Register to comment.