Project showcase
Lithophane Lights

Lithophane Lights © GPL3+

Custom lights for your 3D printed lithophane case.

  • 1,353 views
  • 0 comments
  • 2 respects

Components and supplies

Ph a000053 iso (1) pnkpri8a6q
Arduino Micro
Any Arduino will work
×1

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

  • 3,256 views
  • 0 comments
  • 12 respects

Clap-Controlled Lights That You Can Actually Use

Project showcase by GadhaGod

  • 2,778 views
  • 1 comment
  • 8 respects

Automated Staircase RGB LED Lights

Project tutorial by Team NotEnoughTech.com

  • 54,015 views
  • 21 comments
  • 151 respects

Police Chaser Lights

Project showcase by Jolynn Awesome

  • 18,733 views
  • 2 comments
  • 31 respects

Arduino Controlled Traffic Lights for Kids Without Delay()

Project showcase by stemmayhem

  • 15,646 views
  • 9 comments
  • 50 respects

Motion Sensing Under Bed Lights

Project tutorial by T3ch Flicks

  • 13,634 views
  • 8 comments
  • 39 respects
Add projectSign up / Login