control rgb led lights from your phone or web browser
Welcome to my guide on how to control rgb led lights from a smartphone or web browser using the DMX protocol. I started this project back in February 2015 as I wanted a better way to control RGB LED strips than this horrible remote control while keeping the DMX decoder we used to power them If you would like more background and details, I would appreciate it if you checked this original blog post on my website. You can also take a look at the video above to learn more about the visual effects. First access the IP address of Arduino (Ethernet shield) From your browser of choice, you will see a mobile device at that moment A ready-made web page that looks like this: a few buttons for your favorite colors and three text fields, enter any RGB value you want. Anyway, you choose a color and then the software will Code the RGB color combination as an http get request to effectively send the r, g, and B values back to the Arduino, as you can see at this point by checking the URL address: After receiving the above request, Arduino will generate the corresponding DMX signal to the decoder, the only job of the decoder is to power up the LED light strip to the desired color. Let\'s get started. Let\'s talk about the details. Here\'s the most comprehensive list of all the projects needed to build this system: Let\'s start with the power of things. Usually in the higher Power LED installation, you can connect the lamp to the 12v power supply of your choice and use it. In this case, however, we will put the DMX decoder in between, so now the power is on the DMX box and then the LED light strip is plugged into its output. My specific DMX decoder has 3 DMX input pins corresponding to GND reference voltage and D-signals. This is 3- Wire and Cable are connected to connect the box to Arduino and electronic devices. The other side of the setup is the Arduino giant micro-controller connected to the Ethernet shield. The board is also connected to a breadboard that contains all the electronic components, as well as a 9v power supply and Cat- 5 Ethernet cables. The next step is electronics. There is no soldering or something, only a few jumpers put these things in the breadboard. The whole circuit is shown in the figure. As explained here, here and there, this combination of the maxsfp transceiver, the 100 Ω resistor, and several jumpers will handle the digital output from the Arduino to the electricity-compliant RS- 485dmx5 12 signal. Finally, now that we have done the hardware work, we can shift our attention to the software that runs on the micro-controller. If you like gitClone to copy You can do it easily when pasting, because the source code can now be used as a repository on GitHub. The central piece is the library DmxMaster ( Original DmxSimple)by TinkerKit. After installing it by downloading. Zip File, which will be responsible for generating the digital output of pin 3 inserted into the transceiver to generate the above DMX signal. Its name is like this: the web page itself is just an HTML file stored in a microSD card and I wrote this file using jQuery Mobile because I am lazy and don\'t like writing CSS. Note that the file name is index. Htm and no index. html. This is by no means accidental, as it turns out that the Arduino SD card Library is having problems reading files with an extension of more than 3 characters when using traditional 8. 3 file name convention. As you can see above, it\'s made by 9 direct-access-to- Color buttons, a form with 3 text fields for custom RGB input, and an oversized button for turning off lights. Here is the complete code ( Syntax Highlight, click here) : Finally, you can see that jQuery scripts and styles are downloaded from CDN, not from SD card. This is because this method just makes waaay faster. If one day the internet connection is interrupted, the web page will continue to work; It just doesn\'t look so fancy. All of this code is included in the Arduino sketch. k. a. The \"C\" script to compile on the micro-controller. If you\'re new to the Arduino world, it\'s like using open- Source ide, insert the motherboard with USB Type-A to type- B. Cable, select the appropriate board model and serial port, and click \"upload \". When programming, you just need to remember which libraries to include ( Ethernet, SD) , And if your code should run once (inside setup)Indefinitely (inside loop) , Or available worldwide ( Outside of any feature). Here is the complete code with additional comments ( Syntax Highlight, click here) : The \"production\" code is finally available. When debugging, ino. If certain conditions are not met, ino throws more errors. If you have been following these instructions so far, you should already have a fully functional system. The final—and optional— The step is to turn on the light by using your sound. To do this, you need to install the Android phone of the Google app. You will also need to download the Tasker and the automatic voice plugin. Better explained in the video, but here\'s a summary: First, make sure \"OK, detect and open the first two options by opening the Google app> Settings> Voice>\" OK Google, the Google command is enabled on your phone. Also, give automatic voice access to allow Google Now integration by going to Settings> accessibility. If you \'ve never used Tasker before, here\'s an introduction. And step-by- Step: Now you can repeat the same step for the turn off lights command and any other command you want. When you\'re done, you should see something like the above in the profile tab. And. . . that\'s it. Next time you want to add some ambient light, just shout \"turn on the lights! \". . . There will be light. By following this guide, you should be able to build a system that easily controls RGB LEDs from your web browser or mobile phone via the DMX protocol. If you have any problems, please let me know in the comments below to see what I can do. I \'ve been using this setup for over a year now and it\'s rock solid. So far, it\'s only because of a power outage or someone (read: not me) The Arduino board has been kicked and some wires have been disconnected. There\'s nothing I can do about the power outage, but whether it\'s 3D- Print the chassis for the system ( Arduino breadboard) Or welding it into a PCB will make it more dust resistantproof. Remember to check out the full blog post for more information. . . If you have any ideas for improving this system, just let me know in the comments or tweet me! Continue hacking as usual.