Interactive lamp-I LOVE YOU

Copyright Claim

Interactive lamp-I LOVE YOU

Boost
1
2
0
GIF

Print Profile(1)

All
P1S
P1P
X1
X1 Carbon
X1E
A1

0.24mm layer, 2 walls, 15% infill
0.24mm layer, 2 walls, 15% infill
Designer
6.2 h
2 plates

Boost
1
2
0
0
1
0
Released

Description

Interactive lamp - I LOVE YOU – Arduino-Powered Touch Lamp for the Modern Space

Immerse yourself in the aesthetics of light with my 3D-printed, Arduino-powered lamp. This inaugural creation of mine combines the elegance of design with the precision of engineering, inviting you to experience the warm aura of the digital age. With a gentle touch on the innovatively integrated touch sensor, the lamp comes to life, cycling through a spectrum of lighting scenarios—from soothing color gradients to dynamic light plays, adding an extraordinary atmosphere to any room. It is thus a dreamy gift for your loved ones.

Construction Guide – Your Path to Your Own Interactive Lamp:

Certainly, if there are any aspects of this lamp project that may seem unclear to you, please let me know. This lamp is an old project of mine, and I can adjust the description accordingly if needed. Thank you! :D
The lamp is based on an Arduino UNO, which serves as the heart of this project, and a WS2812B LED strip (I recommend 30 LEDs per meter), which provides the diverse color display. For power supply, you will need a 5V DC connector and a simple switch to turn the lamp on and off.

Here is a detailed breakdown for the assembly:

  1. Touch Sensor Assembly: Attach aluminum foil to the underside of the lamp base to create the touch sensor. This should be placed centrally on the lampshade to make the entire surface touch-sensitive.
  2. Electrical Connection: Connect the Arduino UNO to the LED strip and the touch sensor according to the attached circuit diagram. Make sure to place the connections correctly to ensure safe operation.
    CAUTION!: All electrical components should be connected in parallel. The Arduino should only process and send the appropriate electrical signals. The switch should be connected in series with the 5V power supply.

  3. Programming: The Arduino program already contains pre-installed programs that generate various lighting scenarios. You can adjust the number of LEDs in the code to match the size of your lamp. The brightness of the lamp can be adjusted by pressing and holding. The program is just an example and can be customized as desired.

#include
#ifdef __AVR__
#include // Required for 16 MHz Adafruit Trinket
#endif

// Digital IO pin connected to the button. This will be driven with a
// pull-up resistor so the switch pulls the pin to ground momentarily.
// On a high -> low transition the button press logic will execute.
#define BUTTON_PIN 2

#define PIXEL_PIN 6 // Digital IO pin connected to the NeoPixels.

#define PIXEL_COUNT 81 // Number of NeoPixels

// Declare our NeoPixel strip object:
Adafruit_NeoPixel strip(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);
// Argument 1 = Number of pixels in NeoPixel strip
// Argument 2 = Arduino pin number (most are valid)
// Argument 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)
int numPixels = 81;
boolean oldState = HIGH;
boolean oneTime = LOW;
int mode = 0; // Currently-active animation mode, 0-9
int numOfMode = 4; // x-1
int oldMode = numOfMode + 1;
long button_pressed = 0;
boolean pressed = LOW;
int brithness = 254;
//Manage brithness
boolean getDark = LOW;

void setup() {
Serial.begin(9600);
pinMode(BUTTON_PIN, INPUT_PULLUP);
strip.begin(); // Initialize NeoPixel strip object (REQUIRED)
strip.setBrightness(brithness);
strip.show(); // Initialize all pixels to 'off'
}

void loop() {
// Get current button state.
boolean newState = digitalRead(BUTTON_PIN);

// Check if state changed from LOW to HIGH (button press).
if ((newState == HIGH) && (oldState == LOW)) {
// Short delay to debounce button.
delay(20);
// Check if button is still low after debounce.
newState = digitalRead(BUTTON_PIN);
if (newState == HIGH) { // Yes, still HIGH
//start analyse if long press or short press
button_pressed = millis();
pressed = HIGH;
}
}
//if it was pressed analyse
if (pressed == HIGH){
//get Stystem time
int time_system = millis();
//calculate pressed time
int pressed_time = time_system - button_pressed;

if ((newState == LOW) && (pressed_time <= 1000)){
++mode;
if (mode > numOfMode) {
mode = 0; // Advance to next mode, wrap around after #8
}
//if lamp is off, next tapp will activat it again
if (brithness == 0){
mode = 0;
brithness = 254;
strip.setBrightness(brithness);
strip.show();

}
//deaktivate press analyse
pressed = LOW;

}else if ((newState == HIGH) && (pressed_time > 1000)&& (brithness > 0)){
//Get darker or brither
if (getDark == HIGH){
brithness = strip.getBrightness();
if (brithness < 254){
brithness = brithness + 1;
if (brithness > 254){
brithness = 254;
}
strip.setBrightness(brithness);
strip.show();
}
}else{
brithness = strip.getBrightness();
if (brithness > 0){
brithness = brithness - 1;
if (brithness < 0){
brithness = 0;
}
if (brithness == 0){
//strip is off
mode = -1;
pressed = LOW;
}
strip.setBrightness(brithness);
strip.show();
}
}
}else if ((newState == LOW) && (pressed_time > 1000)&& (brithness > 0)){
//Manage state after getting dark or ligther switch
getDark = !getDark;
//deaktivate press analyse
pressed = LOW;
}
}
Serial.println(mode);
if (oldMode != mode) {
oneTime = HIGH;
} else {
oneTime = LOW;
}
if (mode == 4) {
rainbow(2, oneTime);
}
if (mode == 3) {
colorWipe(strip.Color( 0, 255, 0), 10, oneTime);
}
if (mode == 2) {
colorWipe(strip.Color( 255, 0, 255), 10, oneTime);
}
if (mode == 1) {
colorWipe(strip.Color( 0, 255, 255), 10, oneTime);
}
if (mode == 0) {
colorWipe(strip.Color( 255, 255, 255), 10, oneTime);
}
if (mode == -1) {
colorWipe(strip.Color( 0, 0, 0), 10, oneTime);
}
// Set the last-read button state to the old state.
oldState = newState;
oldMode = mode;
delay(5);
}

// Fill strip pixels one after another with a color. Strip is NOT cleared
// first; anything there will be covered pixel by pixel. Pass in color
// (as a single 'packed' 32-bit value, which you can get by calling
// strip.Color(red, green, blue) as shown in the loop() function above),
// and a delay time (in milliseconds) between pixels.
int i = 0;
void colorWipe(uint32_t color, int wait, boolean oneTime) {
if (oneTime == HIGH) {
i = 0;
}
if (i < numPixels) {
//ad one more pixel

strip.setPixelColor(i, color); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
++i;
delay(wait); // Pause for a moment
}
}


long firstPixelHue = 0;
// Rainbow cycle along whole strip. Pass delay time (in ms) between frames.
void rainbow(int wait, boolean oneTime) {
if (oneTime == HIGH) {
firstPixelHue = 0;
i = 0;
}
if (firstPixelHue < 3 * 65536) {
if (i < numPixels) {

// Offset pixel hue by an amount to make one full revolution of the
// color wheel (range of 65536) along the length of the strip
// (strip.numPixels() steps):
int pixelHue = firstPixelHue + (i * 65536L / 500);
// strip.ColorHSV() can take 1 or 3 arguments: a hue (0 to 65535) or
// optionally add saturation and value (brightness) (each 0 to 255).
// Here we're using just the single-argument hue variant. The result
// is passed through strip.gamma32() to provide 'truer' colors
// before assigning to each pixel:
strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
++i;
}else{
i = 0;
}
firstPixelHue += 256;
strip.show(); // Update strip with new contents
delay(wait); // Pause for a moment
}else{
firstPixelHue = 0;
}
}

Although this project may be some time ago, the joy of creating and sharing remains unchanged. I am currently developing a new generation of this lamp that uses images instead of text and is equipped with additional interesting features.

Join me on this innovative journey and be the first to know about my latest creations.
Follow me to not miss any updates.

I am always open to new ideas. So, if you have new or different ideas, feel free to share them with me!

Comment & Rating (0)

Please fill in your opinion
(0/5000)

No more