{"product_id":"interactive-lamp-i-love-you","title":"Interactive lamp-I LOVE YOU","description":"\u003ch2\u003e\u003cstrong\u003eInteractive lamp - I LOVE YOU – Arduino-Powered Touch Lamp for the Modern Space\u003c\/strong\u003e\u003c\/h2\u003e\u003cp\u003eImmerse 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.\u003c\/p\u003e\u003ch3\u003e\u003cstrong\u003eConstruction Guide – Your Path to Your Own Interactive Lamp:\u003c\/strong\u003e\u003c\/h3\u003e\u003cp\u003e\u003ci\u003eCertainly, 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\u003c\/i\u003e\u003cbr\u003eThe 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.\u003c\/p\u003e\u003cp\u003eHere is a detailed breakdown for the assembly:\u003c\/p\u003e\u003col\u003e\n\u003cli\u003e\n\u003cstrong\u003eTouch Sensor Assembly: \u003c\/strong\u003eAttach 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.\u003cbr\u003e \u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eElectrical Connection: \u003c\/strong\u003eConnect 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.\u003cbr\u003e\u003cspan style=\"color:#E14747;\"\u003e\u003cstrong\u003eCAUTION!:\u003c\/strong\u003e\u003c\/span\u003e 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.\u003cbr\u003e\u003cimg src=\"https:\/\/makerworld.bblmw.com\/makerworld\/draft\/522129\/2024-02-11_88c0855ca68b.jpg\"\u003e\u003cbr\u003e \u003c\/li\u003e\n\u003cli\u003e\n\u003cstrong\u003eProgramming: \u003c\/strong\u003eThe 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.\u003cbr\u003e \u003c\/li\u003e\n\u003c\/ol\u003e\u003cfigure class=\"table\" style=\"width:93.33%;\"\u003e\u003ctable class=\"ck-table-resized\"\u003e\n\u003ccolgroup\u003e\u003ccol\u003e\u003c\/colgroup\u003e\n\u003ctbody\u003e\u003ctr\u003e\u003ctd\u003e\n\u003cp\u003e#include \u003cbr\u003e#ifdef __AVR__\u003cbr\u003e#include  \/\/ Required for 16 MHz Adafruit Trinket\u003cbr\u003e#endif\u003c\/p\u003e\n\u003cp\u003e\/\/ Digital IO pin connected to the button. This will be driven with a\u003cbr\u003e\/\/ pull-up resistor so the switch pulls the pin to ground momentarily.\u003cbr\u003e\/\/ On a high -\u0026gt; low transition the button press logic will execute.\u003cbr\u003e#define BUTTON_PIN   2\u003c\/p\u003e\n\u003cp\u003e#define PIXEL_PIN    6  \/\/ Digital IO pin connected to the NeoPixels.\u003c\/p\u003e\n\u003cp\u003e#define PIXEL_COUNT 81  \/\/ Number of NeoPixels\u003c\/p\u003e\n\u003cp\u003e\/\/ Declare our NeoPixel strip object:\u003cbr\u003eAdafruit_NeoPixel strip(PIXEL_COUNT, PIXEL_PIN, NEO_GRB + NEO_KHZ800);\u003cbr\u003e\/\/ Argument 1 = Number of pixels in NeoPixel strip\u003cbr\u003e\/\/ Argument 2 = Arduino pin number (most are valid)\u003cbr\u003e\/\/ Argument 3 = Pixel type flags, add together as needed:\u003cbr\u003e\/\/   NEO_KHZ800  800 KHz bitstream (most NeoPixel products w\/WS2812 LEDs)\u003cbr\u003e\/\/   NEO_KHZ400  400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)\u003cbr\u003e\/\/   NEO_GRB     Pixels are wired for GRB bitstream (most NeoPixel products)\u003cbr\u003e\/\/   NEO_RGB     Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)\u003cbr\u003e\/\/   NEO_RGBW    Pixels are wired for RGBW bitstream (NeoPixel RGBW products)\u003cbr\u003eint numPixels = 81;\u003cbr\u003eboolean oldState = HIGH;\u003cbr\u003eboolean oneTime = LOW;\u003cbr\u003eint     mode     = 0;    \/\/ Currently-active animation mode, 0-9\u003cbr\u003eint numOfMode = 4; \/\/ x-1\u003cbr\u003eint   oldMode = numOfMode + 1;\u003cbr\u003elong button_pressed = 0;\u003cbr\u003eboolean pressed = LOW;\u003cbr\u003eint brithness = 254;\u003cbr\u003e\/\/Manage brithness\u003cbr\u003eboolean getDark = LOW;\u003c\/p\u003e\n\u003cp\u003evoid setup() {\u003cbr\u003e Serial.begin(9600);\u003cbr\u003e pinMode(BUTTON_PIN, INPUT_PULLUP);\u003cbr\u003e strip.begin(); \/\/ Initialize NeoPixel strip object (REQUIRED)\u003cbr\u003e strip.setBrightness(brithness);\u003cbr\u003e strip.show();  \/\/ Initialize all pixels to 'off'\u003cbr\u003e}\u003c\/p\u003e\n\u003cp\u003evoid loop() {\u003cbr\u003e \/\/ Get current button state.\u003cbr\u003e boolean newState = digitalRead(BUTTON_PIN);\u003cbr\u003e \u003cbr\u003e \/\/ Check if state changed from LOW to HIGH (button press).\u003cbr\u003e if ((newState == HIGH) \u0026amp;\u0026amp; (oldState == LOW)) {\u003cbr\u003e   \/\/ Short delay to debounce button.\u003cbr\u003e   delay(20);\u003cbr\u003e   \/\/ Check if button is still low after debounce.\u003cbr\u003e   newState = digitalRead(BUTTON_PIN);\u003cbr\u003e   if (newState == HIGH) {     \/\/ Yes, still HIGH\u003cbr\u003e     \/\/start analyse if long press or short press\u003cbr\u003e     button_pressed = millis();\u003cbr\u003e     pressed = HIGH;\u003cbr\u003e   }\u003cbr\u003e }\u003cbr\u003e \/\/if it was pressed analyse\u003cbr\u003e if (pressed == HIGH){\u003cbr\u003e   \/\/get Stystem time\u003cbr\u003e   int time_system = millis();\u003cbr\u003e   \/\/calculate pressed time \u003cbr\u003e   int pressed_time = time_system - button_pressed;\u003cbr\u003e   \u003cbr\u003e   if ((newState == LOW) \u0026amp;\u0026amp; (pressed_time \u0026lt;= 1000)){\u003cbr\u003e     ++mode;\u003cbr\u003e     if (mode \u0026gt; numOfMode) {\u003cbr\u003e       mode = 0; \/\/ Advance to next mode, wrap around after #8\u003cbr\u003e     }\u003cbr\u003e     \/\/if lamp is off, next tapp will activat it again\u003cbr\u003e     if (brithness == 0){\u003cbr\u003e       mode = 0;\u003cbr\u003e       brithness = 254;\u003cbr\u003e       strip.setBrightness(brithness);\u003cbr\u003e       strip.show();\u003cbr\u003e      \u003cbr\u003e     }\u003cbr\u003e     \/\/deaktivate press analyse\u003cbr\u003e     pressed = LOW;\u003cbr\u003e     \u003cbr\u003e   }else if ((newState == HIGH) \u0026amp;\u0026amp; (pressed_time \u0026gt; 1000)\u0026amp;\u0026amp; (brithness \u0026gt; 0)){\u003cbr\u003e     \/\/Get darker or brither\u003cbr\u003e     if (getDark == HIGH){\u003cbr\u003e       brithness = strip.getBrightness();\u003cbr\u003e       if (brithness \u0026lt; 254){\u003cbr\u003e         brithness = brithness + 1;\u003cbr\u003e         if (brithness \u0026gt; 254){\u003cbr\u003e           brithness = 254;\u003cbr\u003e         }\u003cbr\u003e         strip.setBrightness(brithness);\u003cbr\u003e         strip.show();\u003cbr\u003e       }\u003cbr\u003e     }else{\u003cbr\u003e       brithness = strip.getBrightness();\u003cbr\u003e       if (brithness \u0026gt; 0){\u003cbr\u003e         brithness = brithness - 1;\u003cbr\u003e         if (brithness \u0026lt; 0){\u003cbr\u003e           brithness = 0;\u003cbr\u003e         }\u003cbr\u003e         if (brithness == 0){\u003cbr\u003e         \/\/strip is off\u003cbr\u003e         mode = -1;\u003cbr\u003e         pressed = LOW;\u003cbr\u003e       }\u003cbr\u003e         strip.setBrightness(brithness);\u003cbr\u003e         strip.show();\u003cbr\u003e       }\u003cbr\u003e     }\u003cbr\u003e   }else if ((newState == LOW) \u0026amp;\u0026amp; (pressed_time \u0026gt; 1000)\u0026amp;\u0026amp; (brithness \u0026gt; 0)){\u003cbr\u003e     \/\/Manage state after getting dark or ligther switch\u003cbr\u003e     getDark = !getDark;\u003cbr\u003e     \/\/deaktivate press analyse\u003cbr\u003e     pressed = LOW;\u003cbr\u003e   }\u003cbr\u003e }\u003cbr\u003e Serial.println(mode);\u003cbr\u003e if (oldMode != mode) {\u003cbr\u003e   oneTime = HIGH;\u003cbr\u003e } else {\u003cbr\u003e   oneTime = LOW;\u003cbr\u003e }\u003cbr\u003e if (mode == 4) {\u003cbr\u003e   rainbow(2, oneTime);\u003cbr\u003e }\u003cbr\u003e if (mode == 3) {\u003cbr\u003e   colorWipe(strip.Color(  0,   255,   0), 10, oneTime);\u003cbr\u003e }\u003cbr\u003e if (mode == 2) {\u003cbr\u003e   colorWipe(strip.Color(  255,   0,   255), 10, oneTime);\u003cbr\u003e }\u003cbr\u003e if (mode == 1) {\u003cbr\u003e   colorWipe(strip.Color(  0,   255,   255), 10, oneTime);\u003cbr\u003e }\u003cbr\u003e if (mode == 0) {\u003cbr\u003e   colorWipe(strip.Color(  255,   255,   255), 10, oneTime);\u003cbr\u003e }\u003cbr\u003e if (mode == -1) {\u003cbr\u003e   colorWipe(strip.Color(  0,   0,   0), 10, oneTime);\u003cbr\u003e }\u003cbr\u003e \/\/ Set the last-read button state to the old state.\u003cbr\u003e oldState = newState;\u003cbr\u003e oldMode = mode;\u003cbr\u003e delay(5);\u003cbr\u003e}\u003c\/p\u003e\n\u003cp\u003e\/\/ Fill strip pixels one after another with a color. Strip is NOT cleared\u003cbr\u003e\/\/ first; anything there will be covered pixel by pixel. Pass in color\u003cbr\u003e\/\/ (as a single 'packed' 32-bit value, which you can get by calling\u003cbr\u003e\/\/ strip.Color(red, green, blue) as shown in the loop() function above),\u003cbr\u003e\/\/ and a delay time (in milliseconds) between pixels.\u003cbr\u003eint i = 0;\u003cbr\u003evoid colorWipe(uint32_t color, int wait, boolean oneTime) {\u003cbr\u003e if (oneTime == HIGH) {\u003cbr\u003e   i = 0;\u003cbr\u003e }\u003cbr\u003e if (i \u0026lt; numPixels) {\u003cbr\u003e                                     \/\/ad one more pixel\u003cbr\u003e \u003cbr\u003e   strip.setPixelColor(i, color);         \/\/  Set pixel's color (in RAM)\u003cbr\u003e   strip.show();                          \/\/  Update strip to match\u003cbr\u003e   ++i; \u003cbr\u003e   delay(wait);                           \/\/  Pause for a moment\u003cbr\u003e }\u003cbr\u003e}\u003c\/p\u003e\n\u003cp\u003e\u003cbr\u003elong firstPixelHue = 0;\u003cbr\u003e\/\/ Rainbow cycle along whole strip. Pass delay time (in ms) between frames.\u003cbr\u003evoid rainbow(int wait, boolean oneTime) {\u003cbr\u003e if (oneTime == HIGH) {\u003cbr\u003e   firstPixelHue = 0;\u003cbr\u003e   i = 0;\u003cbr\u003e }\u003cbr\u003e if (firstPixelHue \u0026lt; 3 * 65536) {\u003cbr\u003e   if (i \u0026lt; numPixels) {\u003cbr\u003e     \u003cbr\u003e     \/\/ Offset pixel hue by an amount to make one full revolution of the\u003cbr\u003e     \/\/ color wheel (range of 65536) along the length of the strip\u003cbr\u003e     \/\/ (strip.numPixels() steps):\u003cbr\u003e     int pixelHue = firstPixelHue + (i * 65536L \/ 500);\u003cbr\u003e     \/\/ strip.ColorHSV() can take 1 or 3 arguments: a hue (0 to 65535) or\u003cbr\u003e     \/\/ optionally add saturation and value (brightness) (each 0 to 255).\u003cbr\u003e     \/\/ Here we're using just the single-argument hue variant. The result\u003cbr\u003e     \/\/ is passed through strip.gamma32() to provide 'truer' colors\u003cbr\u003e     \/\/ before assigning to each pixel:\u003cbr\u003e     strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));\u003cbr\u003e     ++i;\u003cbr\u003e   }else{\u003cbr\u003e     i = 0;\u003cbr\u003e   }\u003cbr\u003e   firstPixelHue += 256;\u003cbr\u003e   strip.show(); \/\/ Update strip with new contents\u003cbr\u003e   delay(wait);  \/\/ Pause for a moment\u003cbr\u003e }else{\u003cbr\u003e   firstPixelHue = 0;\u003cbr\u003e }\u003cbr\u003e}\u003c\/p\u003e\n\u003c\/td\u003e\u003c\/tr\u003e\u003c\/tbody\u003e\n\u003c\/table\u003e\u003c\/figure\u003e\u003cp\u003eAlthough 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.\u003cbr\u003e \u003c\/p\u003e\u003cp\u003eJoin me on this innovative journey and be the first to know about my latest creations. \u003cbr\u003e\u003cstrong\u003eFollow me to not miss any updates.\u003c\/strong\u003e\u003cbr\u003e \u003c\/p\u003e\u003cp\u003eI am always open to new ideas. So, if you have new or different ideas, feel free to share them with me!\u003c\/p\u003e\u003cp\u003eDesign by chris on MakerWorld (license: BY-SA).\u003c\/p\u003e","brand":"Mymadmanlab","offers":[{"title":"Default Title","offer_id":67408266199344,"sku":"MW-181394","price":4.99,"currency_code":"USD","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0987\/0809\/5280\/files\/0_b3f13237-78c4-4ae3-ac85-0e46ec55a53f.png?v=1785215835","url":"https:\/\/mymadmanlab.com\/products\/interactive-lamp-i-love-you","provider":"Mymadmanlab.com","version":"1.0","type":"link"}