Simple RGB Strip Controller is as the name implies, a very simple RGB strip controller and is built on the Arduino platform. This controller accepts very simple commands via the Arduino's serial port to change the color output on the RGB strip connected to it. This controller uses the PWM outputs of the Arduino to change the color of the LEDs and is designed to work with simple 12V 5050 RGB LED strips.
This project consists of an Arduino Sketch to configure the Arduino as a Simple RGB LED Controller. This sketch uses the ArduinoSerialCommand library for command processing so you will need to download and install this library in your Arduino libraries directory before the project can be bilt.
- Arduino Nano
- 3x 5kOhm Resitors
- 3x Low RDSon N-Channel MOSFET (I used NXP PSMN022-30PL)
- Hookup Wire
- Breadboard
- 12V 5050 RGB LED Strips
Below is a wiring diagram for this project showing how to hook up the Arduino to the RGB LED Strips.
INSERT DIAGRAM HERE
As should be obvious the Arduino cannot drive the RGB LED strips directly. Instead, the Arduino drives the gates of three low RDSon N-Channel MOSFETs whose channels are connected between the RGB LEDS and ground. When the PWM output is high, the MOSFET turns on allowing current to flow through the LED strip. When the PWM output is low, the MOSFET turns off thus stopping the flow of current through the LEDs. The brightness of the LEDS is controlled by changing the pulse width of the PWM output.
In theory the gate of a MOSFET draws no current so in theory there should be no problem connecting the outputs of the Arduino directly to the gates of the MOSFETs. However, you will notice in the diagram that there are resistors between the Arduino pins and the gates of the MOSFETs. In reality, when the signal into the gate goes high there is significant current flow as the gate of the MOSFET is essentially a capacitor and current must flow to charge it to turn the MOSFET on. These resistors limit this current flow so that it does not exceed the current output capability of the Arduino. These resistors also prevent the MOSFETs from turning on too fast which can produce oscillations and create other undesired effects in the system.
Commands are sent to the controller as text strings and must be terminated with a carriage return character '\r'. Commands consist of the command itself followed by any parameters. Command parameters can be in the following formats.
Parameter | Description |
---|---|
<0xRRGGBB> | The RGB color value given as a series of hex digits. For example "0099FF" |
<NR1> | Floating point decimal number. For example "1.25" |
The controller supports the following commands:
Command | Description | Example |
---|---|---|
C <0xRRGGBB> | Color: Immidiately sets the color to the passed value. | "C AA00FF\r" |
CF <0xRRGGBB> | Color Fade: Fades the color to the passed value. The length of fade is set by the fade time. | "CF 2299AA\r" |
FT <NR1> | Fade Time: Sets the amount of time in seconds for a fade to complete. | "FT 2.0\r" will set the fade time to 2 seconds |