Trying to build an IR project


Closed Thread
Results 1 to 14 of 14

Hybrid View

  1. #1

    Question Trying to build an IR project

    Hi, I am trying to build an IR based transmitter and receiver. I have few questions I would like to ask:
    1) Can it be done using any PIC? I have a good stock of 12f635
    2) Is data transmitted by simply flashing led at 38-40kHz and controlling the time between each burst?
    3) Is 0 & 1 are the only type we can send - like for eg 38kHz for 12mS=0 & 38kHz for 30mS=1 or more data can be incorporated

    By knowing this I can atleast know how to proceed about it
    Thanks
    ___________________
    WHY things get boring when they work just fine?

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


    Did you find this post helpful? Yes | No

    Default

    1. Any PIC that can generate 38-40kHz should work.

    2. You can control the duration of both the bursts and the idle time between bursts.

    3. There are several methods used. You should Google for NEC, Sony, & Philips IR protocols. This will give you a good introduction to the most common protocols. If you want to get a bit more sophisticated, you can have multiple durations for both bursts and idle spaces. With 5 possibilities for each you can encode an enormous amount of data. For example, if you let ABCDE represent 5 burst times and abcde represent 5 idle times, you have a 10 letter alphabet to play with. However, the more complex the message, the more horsepower you need at the receiver.

    EDIT: Here's a website with many of the most used protocols.
    Last edited by dhouston; - 6th November 2009 at 19:15.

  3. #3
    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

  4. #4
    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.

  5. #5


    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

  6. #6


    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?

  7. #7
    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

  8. #8


    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