Touchless dimming lamp with PIR activated clockface and sunrise alarm.

Similar projects worth following
Started out as a no-touch lamp and.....evolved.

This is a pretty simple project based on the Lumich One papercraft lamp. It features a touchless on/off/dimming lamp and sunrise alarm, and a PIR activated bedside clock.

Like most things I make, the functionality was born of necessity. I required a bedside light that I didn't have to hunt to find the switch, dimmer capability, and a bedside alarm clock that doesn't "bother" my overly-light-sensitive-while-sleeping wife.

Main features:

  • Three(N) position touchless control interface.
  • PIR activated clockface
  • Sunrise alarm
  • Dimmer controlled lamp
  • DST compensation

Some notes here:

My wife is a finicky sleeper when it come to light. Call it thin eyelids or an inability to shut her damn eyes off at night, but she requires near total blackness to sleep well. Oh, and did I mention she doesn't like sleep masks? Now, having said that, after taping over all of the LED's in the bedroom, squashing every light crack, and making this lamp, I have to say that I rather enjoy it. The PIR is set to minimum sensativity and a 10 sec re-retrigger. There is a selector switch for high or low trigger signal. I think I have the code set to trigger = HIGH. This is directly tied to the clockface being on or off. It works well.

I straight jacked the sunrise RGB data from the internet. I have looked and there are several possible sources. Have a Google for yourself. If anyone would like to claim it, I will post ATTRIB. and no, I don't actually use the sunrise alarm, but snooze was cool to try to figure out.

In the original Lumich lamp, an ultrasonic Ping)) sensor was used to detect distance from the top. They are surprisingly noisy to me and my children, but not the wife, and 3 of the 4 cats don't much care for them either. If you have a pest problem, use the ultrasonic. The IR distance sensor, being available in several flavors, was an easy choice for me.

Working out DST compensation that I like has been weird. I hate it. I've tried three different ways and every one, I've screwed up in some ridiculous way. The current one goes from 24:59 to 1:00. But, trying to stay true to the "NoTouch" name, I will have figure[d] this out.

  • 1 × 16 unit Neopixel Ring
  • 1 × Chronodot RTC
  • 1 × PIR Sensor
  • 1 × IR Distance Sensor (30cm model)
  • 1 × Arduino Uno

View all 9 components

  • NTLamp Source 3D files

    Jeremy Lambert02/07/2015 at 21:22 0 comments

    source files for lamp here: NTLamp Source CAD

  • NTLamp Source Code

    Jeremy Lambert02/07/2015 at 21:11 0 comments

    Code dump:

    	Written by Jeremy Lambert
    	Copyright 2015 All Rights Reserved
    	This library is free software; you can redistribute it and/or
    	modify it under the terms of the GNU Lesser General Public
    	License as published by the Free Software Foundation; either
    	version 2.1 of the License, or (at your option) any later version.
    	This library is distributed in the hope that it will be useful,
    	but WITHOUT ANY WARRANTY; without even the implied warranty of
    	Lesser General Public License for more details.
    //NOTE: DST compensation is in with 24 hour bug fix.  set RTC with standard time.
    #include <Wire.h> 
    #include <Adafruit_NeoPixel.h>
    #include <Adafruit_LEDBackpack.h>
    #include <Adafruit_GFX.h>
    #include <avr/power.h>
    #include <RTClib.h>
    #include <Timer.h>
    #include "enums.h"
    #define SENSOR_PIN_IRD        3 //analog
    #define SENSOR_PIN_PIR        7 //digital
    #define LIGHT_PIN             5 //digital...changed this from 4 because I think the timer is on there
    #define NUMPIXELS             16 //neopixel ring
    #define DEBOUNCE_DELAY        10
    #define SUNRISE_DELAY         6000 //should generally be 6000 (6 secs a color click = 30 min sunrise)
    #define SUNRISE_TICK_COUNT    300
    boolean dimmerActive = false;
    int val1 = 0;
    int val2 = 0;
    int val3 = 0;
    int val4 = 0;
    int lastPWM = 0;
    int smoothPWM = 20;
    int readingPWM = 0;
    int currentLightPWM = 0;
    int DIMMER_STEP = 4;
    boolean clockfaceLEDState = false;
    uint8_t sunrise_index = 0;
    uint8_t mode = INACTIVE;
    int tickEvent = -1;
    Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, LIGHT_PIN, NEO_GRB + NEO_KHZ800);
    RTC_DS1307 RTC;
    DateTime Clock;
    Timer t;
    Adafruit_7segment matrix = Adafruit_7segment();
    //uint8_t redList[] = {  0,8,17,26,35,43,52,61,70,79,87,96,105,114,123,131,140,149,158,167,175,184,193,202,211,219,228,237,246,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,253,253,252,252,251,250,250,249,249,248,247,247,246,246,245,245,244,243,243,242,242,241,240,240,239,239,238,237,237,236,236,235,235,234,233,233,232,232,231,230,230,229,229,228,228,227,226,226,225,225,224,223,223,222,222,221,220,220,219,219,218,218,217,216,216,215,215,214,213,213,212,212,211,211,210,209,209,208,208,207,206,206,205,205,204,203,203,202,202,201,201,200,199,199,198,198,197,196,196,195,195,194,193,193,192,192,191,191,190,189,189,188,188,187,186,186,185,185,184,184,183,182,182,181,181,180,179,179,178,178,177,176,176,175,175,174,174,173,172,172,171,171,170,169,169,168,168,167,167,166,165,165,164,164,163,162,162,161,161,160,159,159,158,158,157,157,156,155,155,154,154,153,152,152,151,151,150,150,149,148,147,146,145,144,142,141,140,139,138,137,136,135,134,133,132,131,130,129,128
    //uint8_t greenList[] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,4,6,8,10,13,15,17,19,21,23,26,28,30,32,34,36,39,41,43,45,47,49,52,54,56,58,60,62,65,67,69,71,73,75,78,80,82,84,86,88,91,93,95,97,99,101,104,106,108,110,112,114,117,119,121,123,125,128,128,130,132,135,137,140,142,145,147,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,149,148,147,146,145,144,142,141,140,139,138,137,136,135,134,133,132,131,130,129,128...
    Read more »

View all 2 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates