Trying to build an IR project


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    I found this article to be helpful:

    http://www.picbasic.co.uk/support/Article.pdf



    steve

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    Go here for good info.
    http://www.rentron.com/remote.htm
    Dave
    Always wear safety glasses while programming.

  3. #3


    Did you find this post helpful? Yes | No

    Wink

    I have used a couple of methods for the transmitter, all work equally well.

    1). Bit bang. Togggle a pin for a duration of 1ms or whatever cadence your receive module allows for logic "1" output. Most RX module output is inverted due to a pullup resistor on the data out line. Look at the data sheet pulse width and duration diagrams. So in your code you shift a bit and test for 1 or 0 then either pause for a zero or toggle at 38Khz for a duration of 1ms (or whatever your receive module wants to see) and do it until all 8 bits have been sent out.

    Advantage: you use only 1 TX pin.
    Disadvantage: you are stuck in the main loop while transmitting.

    2). Hardware PWM. Configure either a 16F88, 16F877A..etc with hardware PWM to output a 38Khz pulse train. Use a 2nd I/O to output your data using serout and put your IR LED between the PWM out port and data out port. The LED will flash at 38Khz encoding your data being transmitted.

    Advantage: no bit banging, you can use the built in serout to transmit serially.
    Disadvantage: 2 pins

    Nick

  4. #4


    Did you find this post helpful? Yes | No

    Question

    Quote Originally Posted by Macgman2000 View Post
    I have used a couple of methods for the transmitter, all work equally well.

    1). Bit bang. Togggle a pin for a duration of 1ms or whatever cadence your receive module allows for logic "1" output. Most RX module output is inverted due to a pullup resistor on the data out line. Look at the data sheet pulse width and duration diagrams. So in your code you shift a bit and test for 1 or 0 then either pause for a zero or toggle at 38Khz for a duration of 1ms (or whatever your receive module wants to see) and do it until all 8 bits have been sent out.

    Advantage: you use only 1 TX pin.
    Disadvantage: you are stuck in the main loop while transmitting.
    One thing to begin with, I never know which PIC has HPWM, is it normally written in the datasheet?

    I have 12F635 - is it capable to follow the above method? Is it possible you can write few lines of the code mainly to get 38kHz, I can try to manage the rest of the code. Thanks a lot
    ___________________
    WHY things get boring when they work just fine?

  5. #5
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by financecatalyst View Post
    Hi, Very useful document. I may be wrong but I want to confirm if it is a mistake in the document or my understanding. In listing 9 of the document, it says :
    Code:
     If IR_Dec<>0 then goto again
    Should it not be 1 instead of zero as in the same document towards the top it says television Device id is 1?
    Yes, the Sony TV device code is 1, so that bit of code is probably wrong.

    1) By the way have you got any resourse like this which can explain the transmitting part as well?
    I don't have any URL's handy for transmitting but I ran across lots of that info during my brief research on receiving and decoding Sony protocol. I'm sure Google is your friend though.

    2) Does it means that all Sony TVs can be controlled with same remote controll?
    No. There's at least 3 different Sony protocols that I found in my brief search. Sony12, Sony15, and Sony20.
    They are similar, but the number of transmitted bits varies. (12, 15, 20). The extra bits allows addressing more devices and commands.
    For my purpose the simplest one, sony12 was adequate, so that's what I used.

    FWIW, here's a site with a lot of good Sony IR info:
    http://www.hifi-remote.com/sony/


    If you are going to play with IR remotes, I'd like to recommend one of Tommy Tylers "USB IR Widgets". (Infrared signal recorder)
    It plugs into a USB port and receives signals from your remote. The software that you download for it gives a great visual representation of the signal, gives duration times for the bits and spaces, operating frequency of the remote, what button was pressed, and what protocol it speaks (if the software recognizes it.) and more. For about $30 it's a handy (and fun) learning tool. If you are building your own PIC based IR transmitter,it should be a great diagnostic tool.
    You can read out about the USB IR widget, and download it's software and operating instructions here. (About 1/2 way down the page):
    http://www.hifi-remote.com/forums/viewtopic.php?t=9405

    I have NO affiliation with Tommy or his store, but I bought a widget and like it, and it shipped fast after I ordered it. No complaints here.


    Good luck!


    steve

  6. #6
    Join Date
    Dec 2005
    Posts
    1,073


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Byte_Butcher View Post
    For about $30 it's a handy (and fun) learning tool. If you are building your own PIC based IR transmitter,it should be a great diagnostic tool.
    Or you can capture the pulsetrain with a soundcard and IR receiver for about $1.50

  7. #7
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by dhouston View Post
    Or you can capture the pulsetrain with a soundcard and IR receiver for about $1.50
    Absolutely! Many different tools to suit your tastes and budget....

    I started with a IR receiver (about $1.50) and my old Hitachi scope.

    Then I progressed to the IR receiver, stuffed into my soundcard and recorded with Audacity ( http://audacity.sourceforge.net/ ) , which I've used for various signal capture fun for years.

    The IR Widget just takes it a step further because the software helps tell you things about a remote that you would otherwise have to calculate or guess at yourself based on recorded scope patterns.

    It's just another tool in the box. Use it or not as you please.


    steve

  8. #8


    Did you find this post helpful? Yes | No

    Default

    I am not at the office today so the best I can do (between "honey do" items) is the following for a 12F or 12C series. I think it was posted on rentron.com, this is an example not finished.

    Use the inline assembler command in PBP and pop in the code segments that toggle at 38Khz..... you may need to do some massaging though with the code. Use a scope on the data out pin of the IR receiver to make sure your code gives you good solid data output. Do not test RX in close proximity to TX, put your tx out about 10ft or so to make sure even at low signal levels the data makes it through. The analog filters severely reduce signals that are slightly outside of it's center band.

    So for every "1" call this in a subroutine with a counter to count 10x through the loop before exiting, for every "0" just pause an equal duration to a "1" for symmetry . If you can... set up your bit duration and start/stop bits so that it is compatible to Serin set for 1200bps on RX side for example....for ease.

    Monday I will post 16F code to set the hardware PWM output to 38Khz.



    PROCESSOR 12c508
    #include "p12c508.inc"
    __CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF & _IntRC_OSC
    #DEFINE PORT B'11111101'
    MOVF OSCCAL
    MOVLW PORT
    TRIS GPIO

    BEGIN
    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
    BSF GPIO, 1 ;1uS Begin HIGH duty cycle
    NOP ;2uS
    NOP ;3uS
    NOP ;4uS
    NOP ;5uS
    GOTO BEGIN ;2uS (26uS total for 38KHz)
    END

  9. #9


    Did you find this post helpful? Yes | No

    Arrow

    Quote Originally Posted by Byte_Butcher View Post
    I found this article to be helpful:

    http://www.picbasic.co.uk/support/Article.pdf



    steve
    Hi, Very useful document. I may be wrong but I want to confirm if it is a mistake in the document or my understanding. In listing 9 of the document, it says :
    Code:
     If IR_Dec<>0 then goto again
    Should it not be 1 instead of zero as in the same document towards the top it says television Device id is 1?

    1) By the way have you got any resourse like this which can explain the transmitting part as well?
    2) Does it means that all Sony TVs can be controlled with same remote controll?
    Last edited by financecatalyst; - 6th November 2009 at 20:14.
    ___________________
    WHY things get boring when they work just fine?

Similar Threads

  1. Replies: 17
    Last Post: - 12th April 2014, 02:17
  2. PIC16F877A pwm use for IR transmission
    By mcbeasleyjr in forum General
    Replies: 0
    Last Post: - 11th July 2009, 18:51
  3. Plz help in completing RC-5 IR remote lamp dimmer project
    By vu2iia in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 3rd April 2008, 08:44
  4. PIC10F200 Automated IR Light Switch
    By Bruce in forum Code Examples
    Replies: 7
    Last Post: - 3rd May 2007, 11:40
  5. how to get pic to pic communication
    By kinsiro in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th August 2005, 17:12

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

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