This is an android app that I did to control my fan. Kept loosing the controller for it, so I thought of making an app since I almost never loose my phone. The following steps could be use to control anything from your phone that has a IR receiver, like your TV.
Step 1: Materials Required
2. Oscilloscope Probe
3. 2 pin Infra Red (IR) receiver
5. 10k resistor
6. Arduino (Used as power supply only. You can also use any 5v power source.)
7. Cellphone with IR transmitter
8. Fan (For this I used a Lasko high velocity fan)
Step 2: Reading the Signal From Oscilloscope
First I connected my IR receiver in series with the 10k resistor, and the oscilloscope probe in parallel with the resistor (make sure your probe is on x10 mode), as shown in the schematic. Then with the control that came with my fan I pressed each button once and got a signal on the oscilloscope.
Step 3: Decoding Signal
To decode the signal you might want to first check out the link posted underneath, it will save you time. But if you can't find your signal online and have to do it manually like I did, you have to use your cursor on the oscilloscope to measure the length of the pulses in ms, as well as the space that follows it (see picture above). In my case I only measured two pulses and two spaces because the others were the same. My first pulse (M1) measured about 1.300ms and the space that followed it (M2) measured about 0.400ms. I let this type of measurement (M1&M2) equal Logical '1'. I then measured the other pulse (M3) which was about 0.440ms followed by a space (M4) that measured about 1.200ms. I let this type of measurement (M3&M4) equal Logical '0'. At the end, for this button I had 12 bits (110110010000). I then repeated step 2&3 for the other buttons.
Step 4: Programming
Using android's ConsumerIrManager APIs you can now program your phone to transmit IR signals. The most important method is transmit which takes in two parameters, the IR carrier Frequency and the on/off pattern represented as cycles. For this I chose the IR carrier Frequency to be 38KHz. For pattern I used the two microsecond numbers that represented each bit and transmitted them in reverse order. This allowed the bit on the farthest right to be transmitted first.
Step 5: Testing Out the App
You can download the app for free here: https://play.google.com/store/apps/details?id=com....