Introduction: DIY Arduino RGB LED Strip IR Controller
Hey guys. In today’s instructable I will be showing you how you can make your own arduino based, infrared controlled, RGB LED strip controller.
The principle of the controller is quite simple. The 12v positive is connected directly to the 12v rail of the strip and the VIN pin of the arduino supplying it with power. Each mosfet source is connected to the ground of the power supply. The drain pins connect to each negative rail of the strip, for the red green and blue colors and the gate is connected through a 220ohm resistor to a PWM output pin of the arduino. When a PWM signal is sent from an arduino pin, it opens the gate of the mosfet allowing current to flow to the negative pins of the strip.
The IR receiver is connected to the 5v, ground and digital input pin of the arduino, decoding any IR signal sent in it’s direction.
Step 1: Breadborard Testing
As you can see from my schematic, I used an Arduino nano as the brains of the operation, 3 Logic level mosfets as drivers for each rail of the LED Strip, a 1838 IR receiver, 3 220ohm resistors and a 12v 5A power supply.
Let’s get everything setup on a breadboard. I’m using an Arduino mega for testing which turned out to be a bad idea because, as I found out later on, some pins were not working the same on the nano as they were on the mega, but I’ll get back to that later on.
Step 2: Arduino Code
Now let’s have a look at the arduino code.
First thing you have to do is download the latest IRRemote library from their github page. Extract the zip file and move it to your arduino libraries folder. Make sure you delete the existing RobotIRremote library from the root arduino libraries folder because it can interfere with the irremote library.
Next you can open the IRRecvDemo example sketch in your arduino IDE and change the receive pin on line 11 to 8 as that is what we are going to use on our arduino for receving the ir signal. Upload the sketch and open up the serial monitor. Now take a remote control you wish to use with your controller and press a button. If you have done everything correctly a code will show up on the serial monitor. Write down all the codes corresponding to the buttons on your remote, we are going to use them later on in our sketch.
Next, go to my github repository and download the sketch.ino file and open it up with your arduino IDE.
You can edit lines 16-39 where I defined the codes for each button on my remote, just change the HEX codes on the right side to the codes you wrote down earlier. I’m going to make a separate video and link it in the description explaining the code in detail.
A quick warning for anyone trying this project out, if you are using an arduino nano, please use exactly these pins that are setup in my sketch, some pins (5 and 11) freeze up the arduino if a pwm signal is being sent through them because the IRREMOTE library uses the built in timers of the arduino when interpreting the code and those pins need to be free. Also you can’t use the 13 pin for inputs, because it is connected to the built in LED indicator of the arduino. I have made the mistake of using those pins without properly testing first and had to order another board as a result, so please keep to these pins if you want to be safe. Upload the edited sketch to the arduino and test out all your buttons. If everything goes to plan, you should have all the buttons working correctly and displaying the colors you want. Intensity up and down buttons are used to dim the colors if you are in color mode, and speed up and slow down the animations if you are using one of the 4 animation I setup.
Step 3: PCB Order
Now it’s time to take our project from the breadboard to an actual PCB. I used the EasyEDA online app to create the schematic and the board layout. I will show you how you can get your PCB design printed and shipped professionally by JLCPCB.
When you open the PCB design in EASYEDA, you have to click on the gerber output button in the software. Next click on Download Gerber files.
Now head on to JLCPCB.com and click on the quote now button. Upload your gerber file and you should see how your finished PCB will look like.
Below you can edit the quantity, thickness, colors etc. I went with the default settings mostly, only changed the color to blue cause I think it looks nicer. When you’re done, click on the save to cart button. After that you can go to the checkout page, enter your shipping and payment information and when your done, you can expect your PCB’s to arrive very shortly.
After about a week of waiting my PCB’s have arrived nicely and securely packaged. I must say that I’m quite happy with the overall quality. For this price it is definitely not worth trying to make your own, make sure you check our their website and you will even have free shipping on your first order if you do so.
Step 4: PCB Assembly and Soldering
Now it’s time to assemble everything on our newly printed board. When soldering always try to solder the smallest parts first and then go on to the larger ones, makes it much easier. To connect the arduino, led strip and ir receiver i used female straight pin headers instead of soldering the components directly. That way if you accidentally fry your arduino or anything else, they can be changed easily, and you can reuse your board without any issues. The only components I soldered in directly were the mosfets and the dc power jack.
When everything is soldered in, we can connect our components. Make sure you connect the LED strip correctly, the 12v rail is the pin on the right side and the negative rails are pins 1, 2 and 3 from the left. And of course don’t put your arduino in the wrong way because you can fry it.
Step 5: First Power on and Conclusion
When you have all the components in place, connect the 12v power supply to the board and make sure everything works.
And that’s it! Your DIY Arduino based LED strip controller is ready. I hope you will have as much fun as I did building this project. I must say that I have learned a lot and hopefully you will too. All the parts used in the project and links I mentioned are in the video description. Thank you so much for all the support to my channel, it really means a lot. If you like the video, please leave a like and subscribe for future videos because that helps me out a lot. Have fun with your LED controller and I will see you in the next one! Cheers
Question 3 years ago on Introduction
I have two questions:
1. Can you explain (or give me a link/info source) why you need a resistor between the arduino output pin and the gate of the mosfets?
2. Why is the resistor value chosen to be 220ohm? Why not less or more?
These questions are solely to increase my understanding of electronics ^-^
Answer 2 years ago
Basicly you need resistor between cause transistor/mosfet will draw more current than arduino can handle and you will eventualy fry arduino. 220 ohm is some basic resistor for arduno, its simply calculatef by ohms law (I = U/R); u is voltage = 5V, R is ressistance of ressistor, I is current. (Arduno can supply max 20mA of current). Hope this helps ;)
Answer 3 years ago
Well I had the same question at first. Then I removed the resistors and connected it directly with a wire instead. But then I noticed that my Arduino atmega328p chip is heating up very quickly and I couldn't even touch it with my finger. Because of that, I was dangerously close frying up my Arduino. I replaced the wires with the resistors again. I used 100 ohm resistors, and mine works very well, it wont heat up anymore
3 years ago
Can i replace other mosfet? If i can replace, please tell me the name of mosfet. Thank You. (my english skill is not good)
5 years ago
Great first Instructable. You should think about entering this into the First Time Authors contest.