Control LED strip with Arduino and potentiometer(s)

Hello,

Intended Outcome: Build an LED project that allows users to use -

Mode 1

  • Have an LED strip auto-cycle through its colors on a loop.
  • Users can select the brightness of the LEDs using a potentiometer

Mode 2

  • Users can select a specific color using a potentiometer
  • Users can select the brightness of the LEDs using a potentiometer

Summary:
The Arduino board would be connected to an LED strip with a switch to turn the project on/off and a switch to activate Mode 1 or Mode 2. The users could use Mode 1 to have the LED strip auto-cycle through its colors with the ability to dim and brighten the LEDs with a potentiometer or use Mode 2 to manually select the color of the LEDs with a potentiometer while also dimming and brightening the LEDs with a potentiometer.

Supplies:
Arduino - 1x Arduino Uno
LEDs - 2x strands of twenty-five 12mm WS2801 RGB LEDs
Switches - 2x SPST
Potentiometers - 2x 1M, 2x 500k, 2x 100k
Power - 1x 5V wall adapter
Resistors - various between 1k,10k, and 4.7k

Open Questions:

  • What other hardware is required to build a project like this? (transistors, power supply, resistors)
  • How would I go about setting up code to enable the Modes?
  • Can I modify the existing strand test in the example library for WS2801?
  • Am I completely missing important aspects of this proposal?

Conclusion:
I am looking to attach the LED strips to my bed's headboard as an option for bedroom lighting rather than relying on the overhead lights or a crappy lamp. Mode 1 would have the LEDs auto-cycle through the colors (think strand test) with the users controlling brightness via a potentiometer. Mode 2 would allow users to select a specific color for the LEDs and control brightness via potentiometers (one potentiometer for brightness and one potentiometer for color selection). Any and all assistance regarding this project is greatly appreciated!

So 50 WS2812B LEDs total? They will need 60mA each at full white, x 50 = 3A.
How big is your supply?
You need one like this
https://www.mpja.com/5-Volt-DC-Plug-Power-Supply-4A-Regulated/productinfo/18520+PS/
and maybe a splitter cable
https://www.mpja.com/DC-Power-Splitter-Cable-55_21mm-38cm-Quad-Male/productinfo/32500+CB/
one to the Ardiuno, one to each LED strip,
cut off the ends, or use a couple of these
https://www.mpja.com/55_21mm-Power-Jack-to-Terminal-Strip/productinfo/19454+PL/

Set up modes:

void setup(){
pinMode (switch1, INPUT_PULLUP);
pinMode (switch2, INPUT_PULLUP);
:
:
}
void loop(){
mode1 = digitalRead (switch1);
mode2 = digitalRead (switch2);

mode = mode2 <1 + mode1;  // 00, 01, 10, 11 also 0,1,2,3

switch (mode){
  case 0:
  // whatever
  break;
  case 1: 
  // whatever
  break;
  case 2:
  // whatever
  break;
  case 3:
  // whatever
  break;
  }
:
:
} // end of loop

Make sense?

  1. Your pots are too high value. Maybe the 100K will work ok but 10K is ideal. You should also have a couple of resistors for the data lines to the strips, a low value around 330R to 510R is best. These should be placed in the data lines close to the strips. Also a couple of large value caps, perhaps 470uF, across 5V and ground, close to the start of each strip.

  2. There are lots of examples of this, it's a commonly asked questions here, so search the forum.

  3. Probably not. Example code for patterns is often "blocking" code, which uses delay() inside loops. Using that code will prevent your code from monitoring the buttons and pots. The pattern code will need to be re-written to use millis() and remove loops so it does not block. This is another very frequently asked question on the forum.

  4. Potential use of the strips as a gentle "sunrise" wake-up alarm. You could attach an rtc module to trigger the sequence at your preferred wake up time. This could be a later enhancement to the project.