Menu

vishay IR sensor

Help
2017-12-20
2017-12-24
  • stan cartwright

    stan cartwright - 2017-12-20

    I have some vishay sensors and realise now, they need a modulated 38KHz IR beam to work, not just 38KHz as that gives low range detection.
    I can't work out the data sheet. Does the IR have to be 8 pulses at 38KHz then 8 no pulses for same time then repeat a few times? https://www.vishay.com/docs/82479/tssp58038.pdf

     
  • mmotte

    mmotte - 2017-12-20

    Stan,
    several years ago i was working on a Vend light curtain and we used 10 cycles of 38khz to check each position.
    I see on the timing diagram it also suggests:* tpi 10/f0 is recommended for optimal function.

    We used very simple generator

    for next 10 cycles
    turn IR on
    wait 13us
    turn ir off
    wait 13us

    Hope this helps
    73
    Mike

     
  • stan cartwright

    stan cartwright - 2017-12-20

    Thanks Mike. I tried

    #chip mega328p, 16
    #option explicit
    dir portb.0 out
    IntOff
    do
    portb.0=1
    ;repeat 28
    ;end repeat
    wait 13 us
    nop
    portb.0=0
    ;repeat 28
    ;end repeat
    wait 13 us
    loop
    

    trial and error tested before your 13 us suggestion but frequency jumps around on poor scope and think pwm more acurate as the recievers are tuned. Is 38KHz pwm possible?
    If I send ten pulses at 38KHz then test the reciever out going low straight away, does it stay low long enough after the IR signal has stopped for it to be tested or would I need a hardware pwm signal?
    I'll experiment and see.

     
    • mmotte

      mmotte - 2017-12-21

      Stan,
      Attached is one of the development files from 2008.
      It looks like the vishay stays on for a bit after being pumped up. I was
      using If statement to detect if the sensor was blocked.

      Also note i must have been "tuning" the IR emmitter timing because some of
      the array of sensor / emmiters are 13us on and 7 us off for the generator.

      Remember this is GCB from 2008 on a linux box using gedit for the IDE. It
      worked quite well!

      73
      M

      On Wed, Dec 20, 2017 at 4:44 PM, stan cartwright stanleyella@users.sf.net
      wrote:

      Thanks Mike. I tried
      ~~~

      chip mega328p, 16

      option explicit

      dir portb.0 out
      IntOff
      do
      portb.0=1
      ;repeat 28
      ;end repeat
      wait 13 us
      nop
      portb.0=0
      ;repeat 28
      ;end repeat
      wait 13 us
      loop
      ~~~
      trial and error tested before your 13 us suggestion but frequency jumps
      around on poor scope and think pwm more acurate as the recievers are tuned.
      Is 38KHz pwm possible?
      If I send ten pulses at 38KHz then test the reciever out going low
      straight away, does it stay low long enough after the IR signal has stopped
      for it to be tested or would I need a hardware pwm signal?
      I'll experiment and see.


      vishay IR sensor


      Sent from sourceforge.net because you indicated interest in <
      https://sourceforge.net/p/gcbasic/discussion/579126/>

      To unsubscribe from further messages, please visit <
      https://sourceforge.net/auth/subscriptions/>

      --
      Mike Otte W9YS

       
  • stan cartwright

    stan cartwright - 2017-12-22

    The data sheet says 600us of 38KHz pulses and 600us low. Works fine. This device is fixed high gain and doesn't time out. It's pretty dumb and predictable. I'm trying irled-sensor-irled-sensor-irled-sensor-irled for bobot. ie left,forward,right sensing. I'll get back if it works ok.

    ;38KHz vishay tssp58038
    #chip mega328p, 16
    #option explicit
    
    dir portb.0 out
    
    do
    repeat 20 ;600us 38KHz
    portb.0=1
    wait 13 us
    nop
    portb.0=0
    wait 13 us
    end repeat
    wait 600 us
    loop
    
     
  • kent_twt4

    kent_twt4 - 2017-12-22

    Stan, couldn't help but notice this thread on the 38kHz IR sensor. Would you mind testing the GCB hardware PWM for AVR with this device? I know for a fact you will not get exactly 38kHz, but it would be good to know if the Vishay device will work within this tolerance.

    'This program demonstrates the PWMOn and PWMOff commands
    'of the fixed mode HPWM on OC0B pin.
    #chip mega328p,16
    
    'activate appropriate PWM output pins
    dir PortD.5 Out     'OC0B
    
    'define PWM_Freq in kHz
    #define PWM_Freq 38
    'define PWM_Duty in %
    #define PWM_Duty 50
    
    Start:
    
      'turn on/off single channel 38 KHz PWM on OC0B pin
      PWMON
      wait 600 us
      PWMOFF
      wait 600 us
    
    goto Start
    
     
  • stan cartwright

    stan cartwright - 2017-12-22

    It didn't work, nor did software 38KHz.
    pwm gives 37.74KHz to ir led (unknown-measures 1.1V on diode range and driven through 100R resistor). I can see the ir led is lit in photo (Not visible to eye)
    Circuit works if I make pb.0 +- glcd says on for off and off for on

    Start:
      'turn on/off single channel 38 KHz PWM on OC0B pin
      PWMON
      wait 600 us
      PWMOFF ;turn off here
    if portb.0=0 then
      GLCDPrint 0,0,"ON "
    else
      GLCDPrint 0,0,"OFF"
    end if
    ;  PWMOFF ;or turn off here
    ;  wait 1 s
    goto Start
    

    edit done my head hours looking for errors. I read users get range by changing 38KHz +- few hundred Hz. Probably differrent device. I'll test other 3pin ir receivers and this with a sig gen at 38KHz

     

    Last edit: stan cartwright 2017-12-22
  • kent_twt4

    kent_twt4 - 2017-12-23

    Stan, I am not exactly sure on your wiring, but the pin diode of the receiver will turn on the internal transistor which I believe will invert the polarity of the output pin. So that part is right?

    The data sheet says to block any stray illuminence of the IR led, so try a piece of shrink tube, or something, over the led to cover the sides. Also some ir leds can have a fairly narrow beam, and I notice the alignment of the IR led to the receiver window are not aligned, or in the same plane (i.e. receiver is parallel to the breadboard and the IR led is pointing straight up at 90 deg. Can you bend the led pins 90 deg. so they are in alignment, or pointing in the same direction as the receiver window)?

    Here is a link that shows how to hook up an indicator led to the 3 pin receiver module to let you know the status. https://learn.adafruit.com/ir-sensor/testing-an-ir-sensor Also, you can try a remote(s) to see if the receiver output pin will go low.

     
  • stan cartwright

    stan cartwright - 2017-12-23

    If the sensor detects 38KHz the output goes low. I did try moving the sensor and white card to reflect and black card to stop interference as per tubes. tv remotes not detected but I know vishays detect tv remotes well.
    The output is high so not reacting to ir. Not swamped I think.
    I noticed narrow pulses on the output at half the ir frequency.
    I tried another vishay tsop 38438 which is modulated output but couldn't detect.
    I have some unknown ir sensors from toys and tv to try. Some I've used with pic but doesn't solve if ir frequency is near enough to 38khz. I'll get back after experiments.

     

    Last edit: stan cartwright 2017-12-23
  • stan cartwright

    stan cartwright - 2017-12-23

    It works with different sensor (eaglemoss robot) but these are carp remembering picaxe tests and driving the ir led through a small tranny to get any distance.
    So yes, 38KHz pwm works. Note it goes low as a pulse..must scope. https://youtu.be/YTzxPeUw88k
    ps tv remotes overdrive the ir leds briefly...it seems.

     

    Last edit: stan cartwright 2017-12-23
  • kent_twt4

    kent_twt4 - 2017-12-23

    OK, good to know. I put a couple of tssop4838's and a Nano on order to play with. Thanks!

     
  • stan cartwright

    stan cartwright - 2017-12-23

    tssop4838 has agc. Does that make it unpredictable? I dunno. What are you going to use it for?
    Nano is like uno. Easy to use with gcb and 2K ram. compared to 64meg pic is it same speed as it does instruction every clock but pic is every 4 clock. 328 is 20MHz on arduino but 16MHz on gcb?
    anyway nice for 2 quid
    ps think about driving the ir led through a transistor for increas reflectance range.

     

    Last edit: stan cartwright 2017-12-23
  • kent_twt4

    kent_twt4 - 2017-12-23

    Mostly will use the tssop4838 to try the NEC? protocol or maybe just on/off function. For future reference, or just an excercise for the brain :)

     
  • stan cartwright

    stan cartwright - 2017-12-24

    gcb pwm 38KHz is 250 below and 39 is 250 above and can't be exact with software so maybe a device tuned to frequency that can be the same with gcb. must be a uctrl thing..clock divs.

     
  • kent_twt4

    kent_twt4 - 2017-12-24

    Less than one percent freq. error (at least at 38kHz) seems pretty good, shouldn't have a significant response problem from the IR detector if you follow the chart in the data sheet. Of course some frequencies will be spot on, try 40kHz for instance if my memory serves me correctly.

    In the case of the HPWM for AVR, the 8bit TMR0 was used for the PWMON and PWMOFF function because to the best of my knowledge every AVR has one including the Tiny's. And therein begins the process of tradeoffs, as certainately a 16bit TMR1 or the TMR2 with the refined prescaler would be better choices.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.