Mukesh Sankhla
Published © CC BY-NC-ND

DIY Lithophane Floating Lamp

A Lithophane Floating Lamp for your loved ones.

IntermediateFull instructions providedOver 2 days1,629
DIY Lithophane Floating Lamp

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
WS2812 Addressable LED Strip
Digilent WS2812 Addressable LED Strip
×1
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Solder Wire, Lead Free
Solder Wire, Lead Free

Story

Read more

Custom parts and enclosures

angle_TWZbNvC3QV.stl

base_NXTofF5A1g.stl

lampshade-wp3891853-avengers-endgame-wallpapers_60b5ovdAtH.stl

lamptop_oY3dzXhMTe.stl

top_tYgyOaBRhL.stl

Schematics

Circuit Diagram For Push Button

*You can choose the mode of triggering the lamp color modes either by push button or IR sensor.
*The code for both the option is same.
*Make all the connections as shown in circuit diagram.
*I have used WS2811 LEDs, I will recommend you to use any addressable LED Strip so that it can be more continent.

Circuit Diagrams for IR Sensor

*You can choose the mode of triggering the lamp color modes either by push button or IR sensor.
*The code for both the option is same.
*Make all the connections as shown in circuit diagram.
*I have used WS2811 LEDs, I will recommend you to use any addressable LED Strip so that it can be more continent.

Code

Arduino Code

Arduino
#include <FastLED.h>

#define LED_PIN     3
#define NUM_LEDS    20
#define LED_TYPE    WS2811
#define COLOR_ORDER RGB
#define BRIGHTNESS  255
CRGB leds[NUM_LEDS];
#define UPDATES_PER_SECOND 100

char ir_pin=A0;
int ir_value=0;
int mode=0;

CRGBPalette16 currentPalette;
TBlendType    currentBlending;

void setup()
{
  Serial.begin(9600);
  pinMode(ir_pin, INPUT_PULLUP);
  FastLED.addLeds<LED_TYPE, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS);
  FastLED.setBrightness(  BRIGHTNESS );

  currentPalette = RainbowColors_p;
  currentBlending = LINEARBLEND;
}
void fadeall()
{ 
  for(int i = 0; i < NUM_LEDS; i++) 
  { 
    leds[i].nscale8(250);
  }
}
void loop() 
{
  ir_value=digitalRead(ir_pin);
  if(ir_value==LOW)
  {
    mode++;
    delay(1000);
  }
  if(mode==0)
  {
    leds[0] = CRGB(255, 255,255);
    leds[1] = CRGB(255, 255,255);
    leds[2] = CRGB(255, 255,255);
    leds[3] = CRGB(255, 255,255);
    leds[4] = CRGB(255, 255,255);
    leds[5] = CRGB(255, 255,255);
    leds[6] = CRGB(255, 255,255);
    leds[7] = CRGB(255, 255,255);
    leds[8] = CRGB(255, 255,255);
    leds[9] = CRGB(255, 255,255);
    leds[10] = CRGB(255, 255,255);
    leds[11] = CRGB(255, 255,255);
    leds[12] = CRGB(255, 255,255);
    leds[13] = CRGB(255, 255,255);
    leds[14] = CRGB(255, 255,255);
    leds[15] = CRGB(255, 255,255);
    leds[16] = CRGB(255, 255,255);
    leds[17] = CRGB(255, 255,255);
    leds[18] = CRGB(255, 255,255);
    leds[19] = CRGB(255, 255,255);
    FastLED.show();
  }
  if(mode==1)
  {
    leds[0] = CRGB(0, 242, 2554);
    leds[1] = CRGB(0, 242, 255);
    leds[2] = CRGB(0, 242, 255);
    leds[3] = CRGB(0, 242, 255);
    leds[4] = CRGB(0, 242, 255);
    leds[5] = CRGB(0, 242, 255);
    leds[6] = CRGB(0, 242, 255);
    leds[7] = CRGB(0, 242, 255);
    leds[8] = CRGB(0, 242, 255);
    leds[9] = CRGB(0, 242, 255);
    leds[10] = CRGB(0, 242, 255);
    leds[11] = CRGB(0, 242, 255);
    leds[12] = CRGB(0, 242, 255);
    leds[13] = CRGB(0, 242, 255);
    leds[14] = CRGB(0, 242, 255);
    leds[15] = CRGB(0, 242, 255);
    leds[16] = CRGB(0, 242, 255);
    leds[17] = CRGB(0, 242, 255);
    leds[18] = CRGB(0, 242, 255);
    leds[19] = CRGB(0, 242, 255);
    FastLED.show();
  }
  if(mode==2)
  {
    leds[0] = CRGB(255, 70,0);
    leds[1] = CRGB(255, 70,0);
    leds[2] = CRGB(255, 70,0);
    leds[3] = CRGB(255, 70,0);
    leds[4] = CRGB(255, 70,0);
    leds[5] = CRGB(255, 70,0);
    leds[6] = CRGB(255, 70,0);
    leds[7] = CRGB(255, 70,0);
    leds[8] = CRGB(255, 70,0);
    leds[9] = CRGB(255, 70,0);
    leds[10] = CRGB(255, 70,0);
    leds[11] = CRGB(255, 70,0);
    leds[12] = CRGB(255, 70,0);
    leds[13] = CRGB(255, 70,0);
    leds[14] = CRGB(255, 70,0);
    leds[15] = CRGB(255, 70,0);
    leds[16] = CRGB(255, 70,0);
    leds[17] = CRGB(255, 70,0);
    leds[18] = CRGB(255, 70,0);
    leds[19] = CRGB(255, 70,0);
    FastLED.show();
  }
  if(mode==3)
  {
      static uint8_t hue = 0;
  for(int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CHSV(hue++, 255, 255);
    FastLED.show(); 
    fadeall();
    delay(10);
  }
  for(int i = (NUM_LEDS)-1; i >= 0; i--) {
    leds[i] = CHSV(hue++, 255, 255);
    FastLED.show();
    fadeall();
    delay(10);
  }
  }
  if(mode==4)
  {
    static uint8_t startIndex = 0;
    startIndex = startIndex + 1; 
    FillLEDsFromPaletteColors( startIndex);
    FastLED.show();
    FastLED.delay(1000 / UPDATES_PER_SECOND);
  }
  if(mode==5)
  {
    FastLED.clear();
    FastLED.show();
  }
  if(mode==6)
  {
    mode=mode-6;
  }
}
void FillLEDsFromPaletteColors( uint8_t colorIndex)
{
    uint8_t brightness = 255;
    
    for( int i = 0; i < NUM_LEDS; i++) {
        leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
        colorIndex += 3;
    }
}

Credits

Mukesh Sankhla

Mukesh Sankhla

22 projects • 34 followers
🧑‍💻Passionate software engineer at Siemens, dedicated to driving digitalization by day. 🧑‍🏭By night, I'm a Maker.

Comments