Simple LightBox



About: Im a curious maker, but am currently new to Instructables. Will post several projects the next year!

Pretty mutch this project is a box that changes colour when the button is pressed. Its green in the first mode and turns red in the second mode. If the button is hold down for 2 seconds it will go to the party mode.

I mainly use this for longer meetings where people start talking about personal stuff. This is to indicate that we should rather continiue the meeting then talking shit.

3D model:

Code written in PlatformIO:

<p>#include <br>#ifdef __AVR__
#endif</p><p>#define PIN 6</p><p>// Parameter 1 = number of pixels in strip
// Parameter 2 = Arduino pin number (most are valid)
// Parameter 3 = pixel type flags, add together as needed:
//   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
//   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
//   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)
//   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
//   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);</p><p>// IMPORTANT: To reduce NeoPixel burnout risk, add 1000 uF capacitor across
// pixel power leads, add 300 - 500 Ohm resistor on first pixel's data input
// and minimize distance between Arduino and first pixel.  Avoid connecting
// on a live circuit...if you must, connect GND first.</p><p>int r=3,g=4,b=5;</p><p>void setup() {
  // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
  #if defined (__AVR_ATtiny85__)
    if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
  // End of trinket special code</p><p>//button pin2
  pinMode(2, INPUT_PULLUP);
  pinMode(r, OUTPUT);
  pinMode(g, OUTPUT);
  pinMode(b, OUTPUT);
  strip.begin();; // Initialize all pixels to 'off'
// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  WheelPos = 255 - WheelPos;
  if(WheelPos < 85) {
    return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  if(WheelPos < 170) {
    WheelPos -= 85;
    return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  WheelPos -= 170;
  return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}</p><p>// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i</p><p>void rainbow(uint8_t wait) {
  uint16_t i, j;</p><p>  for(j=0; j<256; j++) {
    for(i=0; i</p><p>// Slightly different, this makes the rainbow equally distributed throughout
void rainbowCycle(uint8_t wait) {
  uint16_t i, j;</p><p>  for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel
    for(i=0; i< strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
}</p><p>//Theatre-style crawling lights.
void theaterChase(uint32_t c, uint8_t wait) {
  for (int j=0; j<10; j++) {  //do 10 cycles of chasing
    for (int q=0; q < 3; q++) {
      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, c);    //turn every third pixel on
      };</p><p>      delay(wait);</p><p>      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, 0);        //turn every third pixel off
}</p><p>//Theatre-style crawling lights with rainbow effect
void theaterChaseRainbow(uint8_t wait) {
  for (int j=0; j < 256; j++) {     // cycle all 256 colors in the wheel
    for (int q=0; q < 3; q++) {
      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, Wheel( (i+j) % 255));    //turn every third pixel on
      };</p><p>      delay(wait);</p><p>      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, 0);        //turn every third pixel off
int state =0, glow=127;</p><p>void loop() {
  // Some example procedures showing how to display to the pixels:
  //colorWipe(strip.Color(255, 0, 0), 50); // Red
//  colorWipe(strip.Color(0, 255, 0), 50); // Green
//  colorWipe(strip.Color(0, 0, 255), 50); // Blue
//colorWipe(strip.Color(0, 0, 0, 255), 50); // White RGBW
  // Send a theater pixel chase in...
//  theaterChase(strip.Color(127, 127, 127), 50); // White
////  theaterChase(strip.Color(0, 0, 127), 50); // Blue</p><p>  if(digitalRead(2)!=HIGH){
    int counter=0;
    if(counter>= 150){
    //reset All
    // for (uint16_t i=0; i < strip.numPixels(); i++) {
    //   strip.setPixelColor(i, strip.Color(0, 0, 0));    //turn every third pixel on
    // }
  if(state ==1){
    //green flashing
    for (uint16_t i=0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, strip.Color(0, glow, 0));    //turn every third pixel on
    //red flashing
    for (uint16_t i=0; i < strip.numPixels(); i++) {
      strip.setPixelColor(i, strip.Color(glow, 0, 0));    //turn every third pixel on
    //partymode if button hold for 2 sek
    //rainbowCycle(20);</p><p>  }if(state==5){

Step 1: Step 1: Leds and Controller

Cut led strip to length and solder them together. Remeber that the data pin is directional, and goes from pin 6 on the arduino nano. The RGB diodes goes from pin 3-5, and the switch is connected to pin2.

Step 2:

Solder battery together with a 1s BMS unit from ebay. This acts like a charger and a protection ic. The switch is connected between the battery and the bms to prevent vampire drain. Cut holes to the USB connector and the switch.

Flash the mcu with the included code and ur done. It needs the adafruit neopixel libary.



    • Arduino Contest 2019

      Arduino Contest 2019
    • Tape Contest

      Tape Contest
    • Trash to Treasure

      Trash to Treasure

    2 Discussions


    3 months ago

    Hello again,

    Thanks for expanding on your project and showing us how it was made.

    However, there is still a word in your introduction that runs afoul of our community standards (hint: four letter word that starts with 's'). I was wondering if you would mind changing that word so that I can go ahead and publish this?

    Thank You,


    3 months ago

    Hello there!

    We're glad you want to share something with the Instructables community!

    And we’re here to help you out.

    Due to some recent changes on the site, we are no longer able to publish stand-alone videos and other forms of incomplete posts. In order to be published live on the site, Instructables must consist of the following things:

    - Multiple steps showing how you made your project

    - Written instructions in each step

    - Your own original images

    Beyond making your Instructable simply publishable, this guide ( explains what is required to have your Instructables featured by our site editors. It’s very helpful, and definitely worth checking out.

    We would love to review your project again after you have made the necessary edits, and we will publish your project if it is eligible.

    If you have any questions, please feel free to ask right here or send us an email at


    Instructables Community Manager