Hi all
This is a project that I've build a time ago to have some ambient light in photos I've taken of some projects that I did to display in Arduino day in my town.
Using 4 potentiometers you can change the LED color and brightness .
Materials needed
- Arduino - I've used a Micro Pro
- 4x 10k potentiometer
- 1x Adafruit Neopixel stick - or compatible
- 1x 18650 battery
- 1x 18650 battery holder
- Toggle Switch ON-OFF
- DC-DC Mini Step Up Power Module 1-5v to 5v boost converter
3D printed case
Assembly
Following the schematics, the assembly is very simple.
Wire the toggle switch to the battery and to the step-up .
Insert the battery holder next to the wall - there is a separator to keep the holder in place.
Wire all the potentiometers and the Neopixel strip
Everything wired
Let it be light
Use 4 M2.5x7 screws to close the LID
Code
Here's the Arduino code for it. It's very straightforward and it uses the FastLed library.
#include <FastLED.h> #define NUM_LEDS 8 #define DATA_PIN 9 CRGB leds[NUM_LEDS]; const int redPin = A3; const int greenPin = A2; const int bluePin = A1; const int brightPin = A0; // variable for storing the potentiometer value int redValue = 0; int greenValue = 0; int blueValue = 0; int brightValue = 255; //1.0 ??? //store old values int oldRedValue = 0; int oldGreenValue = 0; int oldBlueValue = 0; void setup() { // put your setup code here, to run once: Serial.begin(115200); Serial.println(); //LEDS FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS); //show leds fill_solid (leds, NUM_LEDS, CRGB(0, 0, 0)); FastLED.show(); } void loop() { // put your main code here, to run repeatedly: //Read colors to send redValue = map(analogRead (redPin),0, 1023, 0, 255); greenValue = map(analogRead (greenPin), 0, 1023, 0, 255); blueValue = map(analogRead (bluePin), 0, 1023, 0, 255); brightValue = map(analogRead (brightPin), 0, 4095, 0, 255); /*Serial.print("R: "); Serial.println(redValue); Serial.print("G: "); Serial.println(greenValue); Serial.print("B: "); Serial.println(blueValue); */ FastLED.setBrightness(brightValue); fill_solid (leds, NUM_LEDS, CRGB(redValue, greenValue, blueValue)); FastLED.show(); }
Hope you like it !
Files are attached
Top Comments