Tuesday, 4 March 2014

How To interface ir receiver to arduino

 
There are different types of ir sensor available in market (sm0038 ,TSOP1738) according to need of application you can use it.
among them IR sm0038 easily available in market and cost about 0.45 $ (on ebay.com) and 20 to 25  indian rupees on Indian market.
it is very cheap and easily available sensor.so we work with this sensor
working and description of ir SM0038 sensor

The TSOP will help you to interface your TV remote with the Arduino and in the Process learn the basics of Wireless Communication. The TSOP outputs a constant HIGH signal when idle and as it receives data, it tends to invert the data. i.e when an IR LED is transmitting data onto the TSOP, every time the IR led goes high, the TSOP will go LOW and vice versa. Remote control signals are often bytes of data that is encoded and transmitted by pulsing(switching ON & OFF the IR LED at a specific frequency) Most TV remote controls work at 32-40 KHz frequency and most receivers can receive this rangHere's a basic outline of how the data is sent. Every time you press a button on a Sony remote control, it sends out a 13Bit data. The first bit is a start bit indicating there are 12 bits of data following it. The next 7 bits are the command bit which will vary depending upon the keys being pressed. The last 5 bits are the address bits which will the same for all buttons but vary for remote controls of different devices.
The black bars in the following image correspond to high signals (called marks) and the white spaces in between correspond to low signals (called spaces). The duration of the 'marks' varies according to the bit being transmitted. It is 2.4ms for the start bit, 1.2ms for HIGH bit and 0.6ms for LOW bit. The duration of the 'spaces' is a constant 0.6ms. Every mark is followed by a space. Any data can be converted to binary format and transmitted in this manner. In fact this is the basic form of all types o serial communication.



PIN CONFIGURATION OF SM0038






Interface IR receiver SM0038 with arduino






HERE ARE EXAMPLE CODE FOR THIS CIRCUIT CONFIGURATION


Step to configure Different Remote

(1)  Download Sample code and Lode  it.
(2)  Now open serial monitor and press any key
(3)  Now find same code
(4)  Replace it with Ir_receiver code value
(5)  Load ir_receiver code


DOWNLOAD CODE FROM HERE

 ir_receiver.ino

ir_sample.ino




If any query you can post in comment  




7 comments:

  1. when i tried uploading the code it said:

    Arduino: 1.6.5 (Windows 8), Board: "Arduino Uno"

    C:\Program Files (x86)\Arduino\libraries\RobotIRremote\src\IRremoteTools.cpp:5:16: error: 'TKD2' was not declared in this scope
    int RECV_PIN = TKD2; // the pin the IR receiver is connected to
    ^
    Error compiling.

    This report would have more information with
    "Show verbose output during compilation"
    enabled in File > Preferences.


    what should be done???

    ReplyDelete
    Replies
    1. delete irrobot file and upload ken sherifs ir library

      Delete
  2. Hi, I solved it, I got the IDE 1.6.4. You have to rename the zipfile of the library to: IRremote
    Then you just add the library again, and you are ready to go ;)

    ReplyDelete
  3. Nice post. Excellent, What's next

    ReplyDelete
  4. i am getting this error

    Arduino: 1.6.8 (Windows 7), Board: "Arduino/Genuino Uno"

    C:\Users\Admin\Desktop\arduino-1.6.8\libraries\RobotIRremote\src\IRremoteTools.cpp:5:16: error: 'TKD2' was not declared in this scope

    int RECV_PIN = TKD2; // the pin the IR receiver is connected to

    ^

    exit status 1
    Error compiling for board Arduino/Genuino Uno.

    This report would have more information with
    "Show verbose output during compilation"
    option enabled in File -> Preferences.

    ReplyDelete
  5. Nice post man, its working http://a-r-d-u-i-n-o.blogspot.com/

    ReplyDelete