In the following steps I will explain how to make a TV remote that you can control with the swipe of your hand. This project utilizes an Arduino Pro Micro, the APDS-9960 RGB and Gesture Sensor, and an IR Led.you'll need a couple other components to get to the finished project & I'll list those in the first step.
In total, this project only cost me around $10 including the breadboard, jumper wires, and IR receiver.
Why did I make this project?
I was searching for a way to control a TV I got at a thrift store and not having to search for a universal remote that worked for my off-brand TV box and the off-brand TV. I also used one of the gestures to control my A/C unit!. This project really has only 6 simple gestures but with a little creativity, one could possibly make this project with many many more IR commands which mirror buttons pressed on your remote. for this instructable, I only show the basic controls but you can follow the same steps to add, remove, or change the commands I use ie. vol up, vol down, channel up, and channel down.
Let's make some stuff!!
Step 1: What You'll Need to Make This Awesomness
Arduino Pro Micro/Leonardo or Clone (I'm using pololu a-star Micro which is slightly smaller than the Arduino)
APDS-9960 RGB and Gesture Sensor
TSOP38238 IR Receiver
USB Cable to connect to your microcontroller
That's it. all of these items can be found for cheap on ebay, amazon, radio shack, or your local electronics store and like i said earlier i was able to spend less than $10 on this.
Step 2: Setup to Catch & Decode Your IR Remote Signals
Now in the opening of this Instructable, I said i didn't want to waste time trying to find a universal remote that would work and in the time being I used an old barely workable Galaxy S5 and an IR Remote APP I found in the app store but it was too much of a hassle to use.
If you don't have the remote, you can simply ask the wonderful and all knowing Google for the hex codes for your appliances & in turn skip this step.
You'll want to wire up your board as follow:
IR Receiver Arduino pin
left pin 11
center pin GND
Right pin 5v
Now I know that was a lot of work but we still have more to do.
Step 3: Catch & Decode Your IR Remote Signals
This is almost as hard as the previous step.
First, you'll need to make sure the IRLIB IR library for arduino is installed. I use Codebender so It's already there but if you prefer the Arduino IDE, there are plenty of simple instructions online one how to spend 2 minutes to set it up.
Next, we'll upload the code and open a serial monitor.
As soon as you open the serial monitor, you're up and running. Simply point any IR remote at the IR receiver and hit a button.
In the serial monitor, you'll see something like this:
Decoded NEC(1): Value:FD807F (32 bits)
Raw samples(68): Gap:40826
Head: m8850 s44500:m500 s600 1:m550 s550 2:m500 s600
3:m550 s600 4:m500 s600 5:m500 s600 6:m500 s600 7:m550
s550 8:m500 s1750 9:m500 s1700 10:m500 s1700 11:m550 s1650
12:m550 s1700 13:m500 s1700 14:m500 s600 15:m550 s1700
16:m500 s1700 17:m500 s600 18:m500 s600 19:m500 s600
20:m550 s600 21:m450 s650 22:m500 s600 23:m500 s600
24:m500 s600 25:m500 s1700 26:m550 s1700 27:m500 s1700
28:m500 s1700 29:m550 s1700 30:m500 s1700 31:m500 s1700
Mark min:450 max:550
That looks like a lot to deal with but you only need the first line: Decoded NEC(1): Value:FD807F (32 bits)
All I did was hit each button on the remote that I needed and as I got my result, I copied & pasted the first line to a txt file so I didn't have to remember them & now I'll now ask you to do the same. Hit the buttons you want to use on any remote for the specific appliance you want to control (6 total if you follow me directly) and save them somewhere you can get to em. Don't forget to label each one.
Let us move on, we're almost done
Step 4: We're Almost Done!
Now that we have our IR codes, we simply place them in the right spot in the code and upload it.
In my case see the picture for a guide it was NEC (you might have Sony, Samsung, etc.), ######## (some random hex number), and a 2 digit number (yours might only be 1 digit)
If you look at the code (below), you can see that I have a different hex code under each motion ie. up has "61A030CF" these are the different directions you'll be moving your hand to send the IR signal to your TV or Whatever so place your codes where you think you'll like them best.
After you have your code done, simply upload it to your micro controller and we'll next look at the wiring.
I know, you feel you need a break but after this you won't even have to look for the remote to relax!
Step 5: Let's Wire It Up!
Disclaimer: in Fritzing, they don't have the module we're using but they have some the same size so I used that. Also, like i said, I'm using a Pololu A-star (Leonardo Clone) and not a Pro Micro from Arduino. They have slightly different foot prints and pins but I'm sure most of you are using something a little closer to the Arduino brand so I'll give you the Pin connections for yours and not mine so Don't take the picture Literally please.
Arduino -- APDS 9960
2 -- SDA
3 -- SCL
1* -- INT
GND -- GND
3.3v -- VCC
IR Led connects the long lead to pin 9 on Arduino and short to GND. Some say that a current limiting resistor is necessary but without frequent use and constant power, it is not needed.
* The Interrupt pin is changeable in the code where you see "#define APDS9960_INT 1" near the top.
Step 6: We're Done!
Plug your microcontroller into a power source and start waving!
Just point it at your appliance and wave your hand over the device.
If you want to make sure your Gesture Remote is working properly, you can use a digital camera to see the IR flashes when you gesture or plug it into your computer and open a serial monitor and you'll see the feedback of what gestures you're using.
I even went as far as to design a board in fritzing and send it off to Osh Park PCB Manufacturing to get 3 boards made for only $5 in a week so I can have a permanent installation in my end table.
The best thing about this is that since the microcontroller has the usb connector attached, I can update it to control other devices without having to disconnect wires or remove it from its board when i get a new TV or want to control other IR controlled devices.