Skip to main content

InduinoX: IR receiver

From my previous post, you probably understood how IR remotes work in general. Now lets take a look at how we can read the signals coming from various remotes that you might have.

Fortunately for us the InduinoX board comes with an IR receiver. And the good news is that some one already wrote the code to read IR signal from arduino! Just copy the code from http://www.arduino.cc/playground/Code/InfraredReceivers, replace the value of IRpin from 2 to A1, because on InduinoX, the IR receiver is connected to analog pin 1. Compile and upload the code to InduinoX.

The code basically sets up the serial port to 115200 baud rate, then sets up timers (read this excellent tutorial on PWMs on arduino), finally the code waits on the IR receive pin for the signal to change (the signal changes when a button on a remote is pressed pointing to the IR receiver). Then the code keeps track of the time it takes for the signal to change from high to low and low to high. At the end of the signal transitions the code prints the timing information. The output looks like

0 0
2476 0
2476 1
3000 1
3000 0
3664 0
3664 1
4204 1
4204 0
5472 0
5472 1
:

Save the output to a file. The output can be used by gnuplot to display the graph of the signal. Make sure you have gnuplot installed on your machine. I used these commands

$ gnuplot
set yrange [-1:2]
plot  "/home/chandanp/temp/vol_up.txt" with lines title 'signal'

And my output looks like this


Notice how the signal repeats itself 2 times and then there is a partial signal at the end. If you happen to have an oscilloscope, you can use the probe on the IR receiver data out pin to see the output on the scope. I have a picoscope 2205 (perhaps a blog post on that later) and the output on the scope looks like this


Since the signal repeats itself every 45ms, here is a closer look at the signal.


Notice that the signal is inverted. Knowing that 0 is represented by 600ms of high and 600 ms of low and a 1 is represented by 1200ms of high and 600ms of low signal (see my previous blog post if you don't know how I arrived at these numbers), the code for volume up on my remote control is 0x490 (0100 1001 0000). In my next blog post, I will show you how I was able to change the volume on my TV by sending the signal 0x490 from InduinoX and pointing it at my TV!

Comments

Popular posts from this blog

Attesting General Power of Attorney in SF

Recently I had to go through the motions of getting a General Power of Attorney (GPA) document attested in San Francisco. I am an Indian by birth. My parents were trying to buy a house back in India for me. Since I did not want to travel to India they needed a GPA so that they can act on my behalf to sign all the documents required to buy the house. The problem however is that they needed it urgently because the seller lives in UK and wants to get all the things done quickly so he can go back. My parents send me a GPA document that they obtained from a lawyer. This is a document that will give the power to my parents to buy the said property in the document on my behalf. The lawyer said that I will have to get the document attested at an Indian Consulate in USA. The closest one for me is in SF and I can drive there in about an hour from where I live. So I though it will be like a day's work to get all the things done. I looked up at their  website  for the procedure t...

XBMC / Boxee remote control android app

I have been writing a few android apps over weekends at home and during 20% time at Google. However I never actually released any of them in the android market mainly because they were quick and dirty apps that fit my needs but perhaps would not be appealing to the general public. One such app that I quickly wrote over a couple of weekends is a XBMC remote. The media center that I use at home is XBMC and I have always wanted to have more control and faster access to my media. Using my remote to navigate through the menus is not as fast. Especially when I wanted to queue a lot of music it is very slow. So I wrote this nice little app called "XBMC remote" for my android phone to control XBMC from anywhere :). Give it a try. Search for "xbmc" in android market and install it if you use XBMC as your media center. When you first launch the app you will start with this screen. You will have to setup your web server address, username and password (if required) by ...

gtkdocize not found

If you are ever configuring an app and see the message "gtkdocize not found" in Gentoo, then you need to emerge gtk-doc. I had some hard time figuring this out so I am writing it in my blog for the next time. When I saw that error message I did an "emerge -s gtkdocize". Usually it is that simple in Gentoo. But not this time. The emerge command returned no results at all. Then I searched for gtkdoc and still no luck. After searching in Google, I still did not have a solution. After thinking for a while I decided to try to search for gtk-doc. Bingo! That worked! Interestingly, this is my first post from my Virtual machine :-)