Project showcase
Lithophane Lights

Lithophane Lights © GPL3+

Custom lights for your 3D printed lithophane case.

  • 149 views
  • 0 comments
  • 0 respects

Components and supplies

Necessary tools and machines

3drag
3D Printer (generic)

About this project

A lithophane is a variable thickness sheet of material in which light can show through. The think parts will show darker than the thin parts. With 3D printing technology we can convert pictures to lithophanes using this site http://3dp.rocks/lithophane/ and then print.

Using a small number of WS2812 LEDs we can then customize the back light colors.

Code

CodeArduino
#include "FastLED.h"
// Number of RGB LEDs in the strand
#define NUM_LEDS 10
// Define the array of leds
CRGB leds[NUM_LEDS];
// Arduino pin used for Data
#define PIN 6 
// Pin used for select button
#define SelectPin 5
//Define LED Type
#define LED_TYPE WS2812
//Select State
int SelectMode=1;
int iled = random(0,NUM_LEDS-1);
int iled2 = random(0,NUM_LEDS);
int icolor = random(1,254);
int icolor2 = random(1,254);
uint8_t gHue = 0; // rotating "base color" used by many of the patterns

void setup()
{
  FastLED.addLeds<LED_TYPE, PIN, GRB>(leds, NUM_LEDS);
  FastLED.setBrightness(255);
  pinMode(SelectPin, INPUT_PULLUP);
}


void loop() {
  if (digitalRead(SelectPin) == LOW) {
      ++SelectMode;
  while (digitalRead(SelectPin) == LOW) {}
  }
  if (SelectMode > 8) {
    SelectMode=1;
  }
  memset(leds, 0, NUM_LEDS * 3);
  switch (SelectMode) {
    case 1:
      memset(leds, 0, NUM_LEDS * 3);
      FastLED.show();
      delay(10);
    break;
    
    case 2:
      leds[0].setHSV( 20, 255, 255);
      leds[1].setHSV( 40, 255, 255);
      leds[2].setHSV( 55, 255, 255);
      leds[3].setHSV( 40, 255, 255);
      leds[4].setHSV( 40, 255, 255);
      leds[5].setHSV( 1, 255, 255);
      leds[6].setHSV( 1, 255, 255);
      leds[7].setHSV( 160, 255, 255);
      leds[8].setHSV( 150, 255, 255);
      leds[9].setHSV( 140, 255, 255);
      FastLED.show();
      delay(10);
    break;
    
    case 3:
      gHue++;
      fill_rainbow( leds, NUM_LEDS, gHue, 7);
      //leds[random(0,NUM_LEDS)].setHSV( 1, 1, 255);
      FastLED.show();
      delay(10);
    break;
    
    case 4:
      gHue++;
      fill_rainbow( leds, NUM_LEDS, gHue, 7);
      //leds[random(0,NUM_LEDS)].setHSV( 1, 1, 255);
      FastLED.show();
      delay(50);
    break;
    
    case 5:
      for(int i = 0; i < NUM_LEDS; i++ ) {
        leds[i].setHSV( 1, 255, 255);
        FastLED.show();
        //delay(100);
      }
    while (digitalRead(SelectPin) == HIGH) {}
    break;
    
    case 6:
      for(int i = 0; i < NUM_LEDS; i++ ) {
        leds[i].setHSV( 30, 255, 255);
        FastLED.show();
        //delay(100);
      }
    while (digitalRead(SelectPin) == HIGH) {}
    break;
    
    case 7:
      for(int i = 0; i < NUM_LEDS; i++ ) {
        leds[i].setHSV( 160, 255, 255);
        FastLED.show();
        //delay(100);
      }
    while (digitalRead(SelectPin) == HIGH) {}
    break;
    
    case 8:
      for(int i = 0; i < NUM_LEDS; i++ ) {
        leds[i].setHSV( 220, 255, 255);
        FastLED.show();
        //delay(100);
      }
    while (digitalRead(SelectPin) == HIGH) {}
    break;
  }
}


  // one at a time
/*  for(int j = 0; j < 3; j++) { 
    for(int i = 0 ; i < NUM_LEDS; i++ ) {
      memset(leds, 0, NUM_LEDS * 3);
      switch(j) { 
        case 0: leds[i].r = 255; break;
        case 1: leds[i].g = 255; break;
        case 2: leds[i].b = 255; break;
      }
      FastLED.show();
      delay(10);
    }
  }*/

/*  // growing/receeding bars
  for(int j = 0; j < 3; j++) { 
    memset(leds, 0, NUM_LEDS * 3);
    for(int i = 0 ; i < NUM_LEDS; i++ ) {
      switch(j) { 
        case 0: leds[i].r = 255; break;
        case 1: leds[i].g = 255; break;
        case 2: leds[i].b = 255; break;
      }
      FastLED.show();
      delay(10);
    }
    for(int i = NUM_LEDS-1 ; i >= 0; i-- ) {
      switch(j) { 
        case 0: leds[i].r = 0; break;
        case 1: leds[i].g = 0; break;
        case 2: leds[i].b = 0; break;
      }
      FastSPI_LED.show();
      delay(1);
    }
  }*/

  /*// Fade in/fade out
  for(int j = 0; j < 3; j++ ) { 
    memset(leds, 0, NUM_LEDS * 3);
    for(int k = 0; k < 256; k++) { 
      for(int i = 0; i < NUM_LEDS; i++ ) {
        switch(j) { 
          case 0: leds[i].r = k; break;
          case 1: leds[i].g = k; break;
          case 2: leds[i].b = k; break;
        }
      }
      FastLED.show();
      delay(3);
    }
    for(int k = 255; k >= 0; k--) { 
      for(int i = 0; i < NUM_LEDS; i++ ) {
        switch(j) { 
          case 0: leds[i].r = k; break;
          case 1: leds[i].g = k; break;
          case 2: leds[i].b = k; break;
        }
      }
      FastLED.show();
      delay(3);
    }
  }*/

Schematics

circuit diagram
Untitled sketch bb 72de9cwopp

Comments

Similar projects you might like

IoT Controlled Planter Lights

Project showcase by John Weers

  • 1,571 views
  • 0 comments
  • 8 respects

Automated Staircase RGB LED Lights

Project tutorial by Team NotEnoughTech.com

  • 27,609 views
  • 19 comments
  • 98 respects

Police Chaser Lights

Project showcase by Jolynn Awesome

  • 5,571 views
  • 0 comments
  • 20 respects

Railroad Crossing Lights

Project showcase by eldo85

  • 2,811 views
  • 4 comments
  • 6 respects

Zelda Treasure Chest (With Lights and Sound)

Project tutorial by Brian Lough

  • 1,532 views
  • 1 comment
  • 8 respects

Remote Controlled Lights

Project showcase by jsheng

  • 1,294 views
  • 0 comments
  • 8 respects
Add projectSign up / Login