Control anything remotely with Infrared signals.

 by Hammock Boy
Featured
Screen shot 2012-04-25 at 8.13.21 AM.png
photo 1.JPG
photo 2.JPG
Who would have thought that just about every Arduino attachment can be controlled in some way with a TV remote? Now its time to find out how.
 
Remove these adsRemove these ads by Signing Up

Step 1: Setup and Materials

suite-1.gif
The setup for this is quite basic. The real challenge is finding neat products for this and writing the code.

Materials.
1x Arduino
1x Servo available @ Hobbyking Sparkfun etc.
Jumper wires
1x Infrared receiver diode available @ Sparkfun Allelectronics Radioshack etc.
4x AA Battery and holder Ebay is the cheapest for the holder
1x TV remote

Anything that you want to control

See the attached sketchup for the setup. If you do not have sketchup you can download it here.
http://sketchup.google.com/intl/en/download/
go4th557 says: Sep 9, 2012. 5:46 PM
I finally figured it out but it is only picking up zeroes no matter what button I push on a multitude of remotes.
Hammock Boy (author) in reply to go4th557Sep 9, 2012. 6:45 PM
It sounds like you are using it as a button. What pin do you have it attached to? Perhaps try of the PWM pins such as 10 or 11. When you downloaded the library and dropped it into the Arduino folder on your computer there should be a file inside called IRremoteInt.h Inside of that is where you change Wprogram.h to Arduino.h

Can you send me a screen shot of your program with any of the error messages? Sorry this is causing you so much trouble.
shail363 in reply to Hammock BoyApr 29, 2013. 3:58 AM
Dear Hammock
I have small issue with controlling servo with remote and will really appreaciate for your help.
I have implemented IRremote to control hobby king Digital Servo motor.Problem I am facing is that there is lot of Servo jittering. It makes sufficient noise.Did you face this problem? I am trying to maintain position of servo to 90 degree in the loop.(Without Iremote is works fine) Can you please let me know whether do you have any solution to elimiate Servo motor jittering?

Thank you in advance.
go4th557 says: Sep 9, 2012. 12:33 PM
I can not get this program to work no matter how hard i try. I've downloaded the library and no matter what I do, it gives me multiple errors.
Hammock Boy (author) in reply to go4th557Sep 9, 2012. 1:57 PM
Have you gone into the library and changed to . I know this gave me an hour of frustration before I changed it.
Hammock Boy (author) in reply to Hammock BoySep 9, 2012. 2:00 PM
What I was typing disappeared. Anyway if you go into the library at the top you should see WProgram.h in-between greater than, less than signs. If you have not already change that to Arduino.h
go4th557 in reply to Hammock BoySep 9, 2012. 4:41 PM
Do I find this in the library going through my program files or do I change it in the program itself? I had a little difficulty understanding what you meant.
knexpert1700 says: Sep 8, 2012. 9:16 AM
Do I have to use a ground terminal on the IR reciever? I have two IR recievers and they only have positive and negative.
Hammock Boy (author) in reply to knexpert1700Sep 8, 2012. 1:43 PM
Can you send me the link to the data sheet? It sounds like each ground will plug into an analog pin and then you will have to use the analogRead() function.
invisiblelight386 says: May 5, 2012. 8:04 AM
One more question. i have been trying to use this code along with code for the Arduino motor shield. the two codes by their self work fine but when put together the motor shield does not work. could there be any conflicting pins or variables that might be interfering? 
Hammock Boy (author) in reply to invisiblelight386May 5, 2012. 9:30 AM
There is a list of pins that the motor shield uses at http://arduino.cc/en/Main/ArduinoMotorShieldR3

one of them is A0 it also uses A1 so try A2 and see what happens.
Hammock Boy (author) in reply to Hammock BoyMay 5, 2012. 9:33 AM
After reading the motor shield page again it might be better to try using pin A4.
invisiblelight386 says: Apr 28, 2012. 1:21 PM
I downloaded the library and put it into the Arduino library folder. I copied your code into a sketch and when i tried to upload it i get a < 'IRrecv' does not name a type > error when compiling. I'm not sure what this means ( still pretty new to the Arduino / C++ platform.
Hammock Boy (author) in reply to invisiblelight386Apr 28, 2012. 2:36 PM
I had this exact same problem and spent way to much time trying to fix it. Fortunately there is any easy fix. Open up the Infrared library and change (see picture).

Please let me know if that doesn't work.
Picture 2.png
invisiblelight386 in reply to Hammock BoyApr 29, 2012. 7:59 AM
opened the IRremoteInt.h in text edit and changed the code but i am still receiving the same error message when compiling. any other thoughts?
invisiblelight386 in reply to invisiblelight386Apr 29, 2012. 10:59 AM
i deleted the library and re-downloaded it and then change the code again and now it seems to be working fine. thanks. this is going to be the main controls on all my robots for a while.
Hammock Boy (author) in reply to invisiblelight386Apr 28, 2012. 2:32 PM
I had this exact same problem and spent way to much time trying to fix it. Fortunately there is any easy fix. Open up the Infrared library and change

#include
to
#include
in IRRemoteInt.h.

Please let me know if that doesn't work.
Hammock Boy (author) in reply to Hammock BoyApr 28, 2012. 2:34 PM
For some reason not all of the text posted. The attached photo shows what you need to change in the Infrared library.
Picture 2.png
go4th557 in reply to Hammock BoySep 9, 2012. 5:10 PM
I did this but when i try to save it, I am given a message that says access denied. I am the Admin of my computer so I have no idea why.
Hammock Boy (author) in reply to go4th557Sep 9, 2012. 6:52 PM
You could create a new admin account for all of your arduino projects?
coolblue says: Apr 26, 2012. 7:12 AM
Hello. This project is a great ideea, tough it sould de more specific since, i guess, you entered for te arduino challenge. Nvermind, i woud like to ask if you could control more than one servo with this. Thanks.
Hammock Boy (author) in reply to coolblueApr 26, 2012. 8:18 AM
You can control up to 12 servos on an arduino (6 on PWM and 6 on analog pins using the servo library). So if you had a remote control with 24 buttons then each servo could have two different values it would move it individually. For example if you pressed the power button on the remote then servo 1 could move to 160 degrees. Then you could press the #2 button and that same servo would move to 50 degrees. All the while the rest of the servos would remain unchanged. To do this in the code you will need 24 unsigned longs (1 for each of the 24 buttons on the remote control. Please Let me know if this is not clear or if you have any questions.
Kdemon says: Apr 25, 2012. 6:54 PM
I had this idea too, but I wanted to wire it into my light switches should I could just point and turn off the light when watching a movie.
Hammock Boy (author) in reply to KdemonApr 26, 2012. 4:31 AM
You could definitely do that as long as the path to the infrared receiver is not blocked by any solid objects. Great idea.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!