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 also was built with some new features that RGBDuino never had.
RGBWeb is a project created to use an Android device, an Arduino, and a server 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.
This is what the app looks like:
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:
- MOSFETS: “N-Channel MOSFET 60V 30A” from SparkFun
- Arduino: Arduino Nano (but any Arduino or clone should work)
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 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.
For example, this would set the lights on to white at full brightness:
The other web page is not much of a page at all; it’s a custom API and is only intended to be accessed by the Android app. It uses PHP POST requests sent by the Android app to execute 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:
- Set up any server system that allows PHP.
- Connect the Arduino (wiring is linked above) via USB to the computer that is running the server.
- Open the Arduino software and program the Arduino with the code provided, and note the COM port that the Arduino is on.
- Update the PHP code to reference the correct COM port, and to use a password of your choosing.
- Run the server.
The Android app was written using MIT’s App Inventor and the Arduino code uses only standard Arduino libraries. The project source code and a compiled APK version of the app are available on GitHub.