T3ch Flicks
Published © GPL3+

Motion Sensing Under Bed Lights

Ever tried to get out of bed quietly at night only to trip over something and wake up the whole house?

IntermediateFull instructions provided16,879
Motion Sensing Under Bed Lights

Things used in this project

Hardware components

Power supply (5V 6A)
×1
WS2812B Led Strip
×1
Wire clips
×1
Motion Sensors
×1
Rocker Switch
×1
AC Plug
×1
Wire
×1
Arduino Nano R3
Arduino Nano R3
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)
Hammer
3D Printer (generic)
3D Printer (generic)

Story

Read more

Custom parts and enclosures

Motion Sensor Case Back

Motion Sensor Case Front

Power Box

Schematics

Project Schematic

Code

Motion Sensing LEDs

Arduino
Upload this to the Arduino to make the project work!
/*
   T3chFlicks - Motion Sensing Under Bed Lighting
   Free to use and distribute.
   Find the tutorial and parts list at https://t3chflicks.com/shop/kit/motion-sensing-under-bed-lights/
*/

#include "FastLED.h"
#define LED_DATA_PIN 9
#define NUM_LEDS 250
CRGB leds[NUM_LEDS];

int onTime = 30*1000; // 30 seconds
int motion_sensor_left = 10;
int motion_sensor_right = 11;
int motion_sensor_front = 12;
int fadeTimeDiff = 50;

void setup() {
  FastLED.addLeds<WS2811, LED_DATA_PIN, BRG>(leds, NUM_LEDS);
  pinMode(motion_sensor_left, INPUT);
  pinMode(motion_sensor_right, INPUT);
  pinMode(motion_sensor_front, INPUT);
}

void loop() {
  if (digitalRead(motion_sensor_left) == 1 || digitalRead(motion_sensor_right) == 1 || digitalRead(motion_sensor_front) == 1) {
    fadeIn();
    delay(onTime);
    fadeOut();
  }
}

void fadeIn() {
  for (int led = 0; led < NUM_LEDS; led++) {
    leds[led] = CRGB( 150, 60, 15);
  }
  for (int b = 0; b < 255; b += 2) {
    FastLED.setBrightness(b);
    FastLED.show();
    delay(fadeTimeDiff);
  }
}

void fadeOut() {
  for (int led = 0; led < NUM_LEDS; led++) {
    leds[led] = CRGB( 150, 60, 15);
  }
  for (int b = 255; b > 0; b -= 2) {
    FastLED.setBrightness(b);
    FastLED.show();
    delay(fadeTimeDiff);
  }
  for (int led = 0; led < NUM_LEDS; led++) {
    leds[led] = CRGB::Black;
  }
  FastLED.show();
}

Credits

T3ch Flicks

T3ch Flicks

7 projects • 59 followers

Comments