VS1838B remote

+ Reply to Thread
Results 1 to 19 of 19

Thread: VS1838B remote

Hybrid View

  1. #1

    Default VS1838B remote

    These popular 3 pin infrared receivers --


    are used a lot with the arduino stuff but has anyone run across any picbasic code using them? don't want to start from scratch based on my previous attempts to use picbasic for a remote. (a pain if I remember right). THANKS.

    just need it to do a simple on/off which is easy if you just detect basic IR but don't want the possibility of ambient light triggering it so just one basic on/off data stream would work.

  2. #2

    Default Re: VS1838B remote

    I'm thinking the way to do it is use COUNT and just look for X amount of pulses from the 38khz ired xmtr. If > X then high a pin.
    Should work I hope. ?

  3. #3

    Default Re: VS1838B remote

    Bummer. Never used COUNT before, maybe I'm missing something?


    COUNT portb.5, 1000, CT
    IF CT > 10 then
    HIGH porta.7
    CT = 0

    Getting nothing. Using 16f628a and 4mhz.

    I have no doubt there are more than 10 pulses in a second with the ired data out.

  4. #4

    Default Re: VS1838B remote

    Presto -- thought I had the count set at 10 (was 20) -- working great now.
    Like the way I have conversations with myself on the forum?

    Kind of a cool way to use these ired units for a simple foolproof switch actually.

  5. #5
    Join Date
    May 2012
    Merseyside, UK

    Default Re: VS1838B remote

    Hi ...

    I am using same code ish

    count ir,500,realtrig ' Looks for real trigger
    if realtrig >15 then 'if real ir then turn light on
    gosub Seconds 'then on 88 Seconds
    Works fine for me also..... But I I am getting false triggers due to mains spikes (My circuit is on a 12v Battery then LDO down to 5v....Was wondering what your circuit looked like ... If I was missing anything maybe ...


  6. #6
    Join Date
    May 2004
    NW France

    Default Re: VS1838B remote


    I think the best way would be to use the PULSIN command ( or use the PIC Capture HW function ...) ... just to be sure no false signal incoming : you can have one or two valid pulses windows ( signal 0 and 1 ... i.e. )
    count counts ... everything !!!

    may be you also could have a look to RC5 like IR codes ...

    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!

  7. #7
    Join Date
    Oct 2005

    Default Re: VS1838B remote

    Once upon a time , there was a brilliant and very helpfull gentleman named Bruce Reynold.
    He posted some Infra Red routines for PIC's in PICBASIC at his site Rentron.com which now is lost.
    The general idea was to create a routine ,at the encoder ,which lasted in total 26μs and a dutycycle of 25% toggling a port bit on and off thus having a frequency of 38Khz.
    I kept a copy and maybe you can get an idea

    PROCESSOR 12c508
    #include "p12c508.inc"
    #DEFINE PORT B'11111101'

    BCF GPIO, 1 ;1uS
    NOP ;2uS each nop is 1uS long
    NOP ;3uS
    NOP ;4uS
    NOP ;5uS
    NOP ;6uS
    NOP ;7uS
    NOP ;8uS
    NOP ;9uS
    NOP ;10uS
    NOP ;11uS
    NOP ;12uS
    NOP ;13uS
    NOP ;14uS
    NOP ;15uS
    NOP ;16uS
    NOP ;17uS
    NOP ;18uS
    NOP ;19uS low on gpio.0
    BSF GPIO, 1 ;1uS Begin HIGH duty cycle
    NOP ;2uS
    NOP ;3uS
    NOP ;4uS
    NOP ;5uS
    GOTO BEGIN ;2uS (26uS total for 38KHz)

    I remember that he also had a working example with a pair of pic16f628 for remote control.
    Maybe somebody can help further.
    Last edited by gebillpap; - 28th March 2020 at 16:13.

  8. #8

    Default Re: VS1838B remote

    I remember the Rentron stuff -- excellent. Thanks for that code, I'll look into it and play with pulsin. It should be more accurate sounds like.

    It's working 98% of the time but alas, that isn't good enough. The goal is a foolproof on/off switch just sensing Ired.
    Noise is the problem with those receivers.

  9. #9

    Default Re: VS1838B remote

    Never used pulsin. So if I knew the pulse width of the 38khz signal, I can compare it to a result pulsin gives? I just read something where it says it measures just one pulse, either low or high state and then goes to next instruction? Why a word variable if it just measures once?

    I get frustrated with some of the PBP commands. The manual is too vague. Wish for every command they could have done another page just with code examples and an explanation of what's going on. (just me venting).

  10. #10

    Default Re: VS1838B remote

    I found that Rentron code. Wow. It's all there and well commented -- I'll try it out. His comments really spell it out and teach.

Similar Threads

  1. Remote Ip remote relay switch
    By jetpr in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 23rd June 2014, 17:07
  2. Remote control help
    By paulthegulll in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 2nd November 2010, 09:01
  3. IR/RF Remote Control
    By jhorsburgh in forum General
    Replies: 2
    Last Post: - 6th February 2008, 02:23
  4. need help in decoding RC-5 IR-remote
    By vu2iia in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th August 2007, 04:34
  5. Remote control
    By Radiance in forum General
    Replies: 2
    Last Post: - 6th August 2003, 15:13

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts