RGBWeb

Apr 26, 2014

An evolution of RGBDuino, using the web instead of Bluetooth

Microcontroller
Home Automation
This is not a maintained project. This project page is only hosted for historical purposes.

RGBWeb is an evolution of RGBDuino that removes the Bluetooth requirement by using an internet connection. This does, however require a server to remain running with the Arduino attached.

RGBWeb has also been built with many new features that RGBDuino never had. While many could be implemented on RGBDuino, I will probably not add the features. The code is all available on the project page for RGBDuino, and anyone is welcome to modify and add features. My only wish is that you give partial credit back to me, Corban Mailloux, if you make a new product with the code. I would also love to hear about developments people are making on my code, so please keep me updated at RGBDuino@corb.co.

RGBWeb is a project created to use an Android device and an Arduino to control a string of red-green-blue LEDs over the internet. The project consists of three main parts: the hardware side (Arduino), the server configuration, and the Android software.

Screenshot

This is what the app looks like:

RGBWeb screenshot

Hardware (Arduino)

The Arduino has very similar wiring to RGBDuino. The only difference is that RGBWeb does not have the Bluetooth module attached. See the RGBDuino project page for an image of the basic configuration.

Essentially, the Arduino receives commands over the USB (serial) connection. The power N-channel MOSFETS have their gate legs (left legs) connected to PWM pins 9, 10, and 11. Each gate leg is also connected through a resistor to GND. While there may be an optimal value for this resistor, I have found that this setup is not picky about resistance. The drain leg (middle leg) is connected to one of the negative returns from the LED strip. The source legs (right leg) are all connected to GND.

The 12 volt power source connects to GND and the common anode on the LED strip.

The parts I used were:

Server Configuration

The server configuration was the part of this project that gave me the most trouble. At different times, I've had this project running on two different types of servers. It was running on an Apache server running on my main computer, but now it is running on a Windows Server 2012 Datacenter machine that is my general purpose server.

I discovered that the biggest problem was ensuring a basic server was established and that the server was properly configured to run PHP.

I chose to write the server web pages in PHP because I have used it before and because I know that it can handle serial communications from the server to a locally attached device (specifically, an Arduino). Reading from a serial port is not, at the time of writing, possible on Windows, but that's okay for our purposes. It would be nice for future updates to be able to get a response from the Arduino, though.

I made two separate web pages in PHP to interact with the Arduino. One is only there to allow quick lighting control from any internet connected device from inside a web browser. All that web page does is display a text box to allow input of a HEX value of a color to display. I also added a JavaScript element called JSColor to allow more elegant color choosing. It uses PHP GET requests to receive commands. I didn't want to use POST for this because I want to be able to simply enter a URL and have it change the lights without clicking or adjusting anything.

Example
http://www.example.com/index.php?RGBColor=FFFFFF

This would set the lights on to white at full brightness.

The other web page is not much of a page at all; it contains almost no HTML and is only intended to be accessed by the Android app. It uses PHP POST requests sent by the Android app to get commands. This is the page that handles more complex features, such as password protection (very basic and unencrypted) and other custom commands like fading.

The actual PHP files, in the correct folder structure on on Github (see link below).

The basic setup of the server is like this:

  1. Set up any server system that allows PHP.
  2. Connect the Arduino (wiring is linked above) via USB to the computer that is running the server.
  3. Open the Arduino software and program the Arduino with the code provided, and note the COM port that the Arduino is on.
  4. Update the PHP code to reference the correct COM port, and to use a password of your choosing.
  5. Run the server.

Software

The Android app was written using MIT's App Inventor. The project source and a compiled APK version of the app are available on GitHub.

Any questions can be directed at RGBWeb@corb.co.