loading

This tutorial shows you how to send IR signals to an RGB strip using an arduino. It uses two libraries, one of which compiles everything you need into an easy to use format, with built in patterns. YouTube videos coming soon :)

Step 1: Gather Materials

Materials you need include:
Arduino (we use an UNO, other boards work)

A Breadboard (usually white with tons of pins)

LED Strip, we use RGB

Reciever/Controller for your RGB Strip

Remote for RGB strip (Most likely not necessary)

Arduino IDE (software)

Some libraries/files from github will need to be downloaded, find at github.com/MaxAtStar

Step 2: Download the Library

Go to https://github.com/MaxAtStar/IR-for-LEDS or, if link does not work, visit https://github.com/MaxAtStar and look for the IR for LEDS Commit (Commit is a folder of files I have uploaded)

Visit the library branch found here

Once at the library branch you have some options, you may read through the code and copy+paste into your own .h and .cpp files, if you wish to go this route, I recommend notepad++. If you trust me, you can downad the library here.

If you wanted to copy and paste the file, I will eventually come back with a tutorial for that route. Please note, it takes extra work and verification to copy+paste the file, an extra space where one shouldn't be, can cause the code to break.

Now that you downloaded your files, navigate to your Arduino Saves folder, usually located in C:\Users\YOURPROFILENAME\Documents\Arduino

For Example, even though my Profile name is CakeArmy, it shows up in file explorer as: C:\Users\cakea\Documents\Arduino

You may also use the quick access panel to quickly navigate to your documents folder, click arduino, and click libraries.

Whichever route you go, you should be in your Arduino Libraries Folder.

Extract the library zip file into a folder called irforleds. Make sure that when you extract this there is not an irforleds folder inside of your main irforleds folder. You should have ONE FOLDER now, with a .h, .cpp, and eventually a readme file and more tricks.

Now that you have my main library, you need to download a library called IRRemote. The problem with this library is that it conflicts with an existing Arduino integrated library RobotIRRemote. In order to proceed to you need Admin access on your computer.

Once you have admin access navigate to "C:\Program Files (x86)\Arduino" without the quotes. If you changed your install location this will be different. Please note, sketchbook location is NOT going to be where these files are located. Once at this location, navigate to the "Libraries" folder. In the Libraries folder you must delete a folder, or move a folder, called "RobotIRRemote". Please note, the caps might be different for you. Make sure Arduino is NOT OPEN. If you would like to save this folder as a backup, you can click compress folder (or the apple equivalent), and when it says it cannot save to that location (that location being the programfiles/arduino/libraries folder) click Yes when it asks if you would like to save to desktop.

Now, you open up arduino. If one of your previous sketches opens, do control + n to open a new tab. Navigate to the Sketch tab and hover over include library and scroll to your right to Manage Libraries. This will now open a new tab where you can find the other IR library your board needs. (As far as I know, all boards except one Adafruit board, I will try to add later, requires this library.) Search "IRRemote". The author of this library is shiriff. You can download the latest version or, if you have issues, you can download the version I am using at the time of writing this, 2.0.1.

All libraries are done, for most, this will be the most complicated part.

Step 3: Sending Signals and Configuring Your Board.

For most people who just want one of the predefined patterns in my library, this will be the last step. For those who want to make their own patterns (which I recommend completely!).

Navigate to my simplified IR code for leds on GitHub and copy+paste that into a new sketch. Currently, you do NOT need to include the IRRemote library as I have already done that for you (you're welcome). Now, if you just want to have something cool going, you are done! For those who want to make their own patterns see the next couple steps. Those that are leaving at this step, thank you for using my Tutorial, please check out the ToS & Contact information @ the bottom of the page. A diagram of how to hook up your board is listed here & on GitHub.

Step 4: Making Your Own Patterns.

For those who want to make their own patterns, this is the section for you. I will eventually be making a youtube video specifically on this topic. If I have not linked a YT video here, send me an email in the contact information below telling me to get to work and I'll do it ASAP.

So, you want to make your own patterns, eh? This will either be easy or EXTREMELY hard and confusing. Don't worry, it took me months to perfect this code & make a completely and user-friendly library.

I recommend downloading a program called Notepad++ found here. Make sure to download the x64 version unless you are running linux, in which case, email me with some linux recommendations *wink*. Installing notepad++ is super easy, just make sure to not download their browser settings. When you open Notepad++, chances are, it will say there is an update and extra packages available. For our purposes, you do not need these.

Navigate to "C:\Users\cakea\Documents\Arduino\libraries\irforled", in your documents folder. This is the same place where we installed the irforled folder. Once again, this may vary from person-to-person if you decided to move your sketch folder. If you still need assistance finding it, do control+comma and it will be in the "Sketchbook Location".

Firstly, open the "irforled.cpp" file. Your system will most likely ask how you want to open this type of file, and select notepad++. Make sure "always use this application" is selected. Here is where you will find your different colors & patterns I have premade. At this point, you have the option of either: making your pattern in your Arduino Sketch or in my library folder. Either way, the steps will generally stay the same. I will be showing you how to edit my Library to configure a new pattern. Steps for both ways will be posted on GitHub. Scroll past all of the unsigned integers to where my predefined patterns are. Currently @ this point I only have 1 by default. This will most likely change in the future. You should be able to see how this works in general, but here is an outline. It is VERY IMPORTANT to DO THIS STEP:

When you do an irsend.sendRaw, you need to make sure the number after my integer (my integers are the colors, for example "orange" or "brightnessup") is correct. Usually the number 68 is used, this means 68 numbers in the integer. For some other patterns, especially basic ones like Red, the number can change. The other common numbers are 56 & 4. To find the number for the color you want, scroll up to my unsigned integers, look for your color, and the number is in the boxes for example, red, says "unsigned int red[4]=..." The number to use is 4. Start a void for your pattern, if in the library the format should be: "void patternOne::basicpattern()" then open and close your brackets ({}). Inside those brackets, which we will call squiggly brackets, and places where I forget, just brackets. You should be able to figure out which one to use if you have expirence with arduino or if you use context clues. Write your pattern. Make sure each line ends with a semicolon ( ";").

Once you are done with your pattern, save your .cpp file and open the irforled.h file. This is the file where the different voids and functions are declared so arduino knows what you are talking about. under class "patternOne" you should see the following: "class patternOne { public: void basicpattern(); }; ". The semicolon at the end of the squiggly bracket IS NOT AN ERROR. This is different from when you are doing a void in a sketch. Under the "public" section add another line under void basicpattern and put the name of your void there. For example, if in the .cpp file you put: "voidpatternOne::myawesomePattern()" then you put "void myawesomePattern();". Make sure your capitalization is correct. If it is not, you code will NOT work. Save your .h file.

Step 5: Conclusions/Contact/Videos/TOS

Thank you for using this tutorial. Make sure to click "I made it" and "favorite" this project! It helps me alot and motivates me to make this tutorial better, more tutorials, and keep updating my library. For example, if nobody is liking this, I will eventually stop updating my library. When I do so, I will put INACTIVE in the title.

Contact:

To contact me send me an email over at:

maxatstar@gmail.com

I am sure you guys can find my school/business email, but please do not send emails there, that is only for business inquiries and school work. You can also contact me by heading over to my GitHub. The GitHub commit for this project is located here.

Terms of Service / Terms of Use

The irforled library has been made by myself. The IRRemote code is made by a developer by the name of: shirriff. The only information/website I can give to you is this GitHub I found with his code.

<p>Thanks for sharing :)</p>
<p>Np</p>

About This Instructable

225views

1favorite

License:

More by MaxS-Star:Controlling LED Strips With IR & an Arduino 
Add instructable to: