Final: Automatic Night Light

 

IMG_1314https://www.instructables.com/editInstructable/edit/E0X38G2JPINZ6L1/step/1

I made the Automatic Night Light named as SWIMCLOUD. It would detect the darkness and lights up by itself when people turn off the lights, so I do not need to turn on the night light by myself and do not need to afraid the darkness anymore.

IMG_3635

However, I used the transparent acrylic to build my model because of inspiration by below these photos. I think if I let people know what is the mechanism inside, and how it works, and it might raise the curious of this products and make it different from the common night light.

Then I laser cut the components which I want to build my model and used acrylic adhesive to stick it together.

For the circuit, I used the PIR sensor to detect the darkness on the Arduino board. And put cotton in the transparent cylinder to diffuse the lights, and make some change to let the lights suitable for the environment when people sleep.

Here is the circuit I built.

IMG_2787

And here are the process of model building.

IMG_3634IMG_3645IMG_3647IMG_3646

 

 

Here is the coding I used

#include <Adafruit_NeoPixel.h>
const int ldrPin = 5;
const int ledPin = 9;
const int brightness = 100;
#define PIN 9
Adafruit_NeoPixel strip = Adafruit_NeoPixel(8, PIN, NEO_GRBW + NEO_KHZ800);

int ldrState = 0;

void setup() {
Serial.begin( 9600 );
pinMode(ledPin, OUTPUT);
pinMode(ldrPin, INPUT);
strip.setBrightness(50);
strip.begin();
strip.show(); // Initialize all pixels to ‘off’
}

void loop() {
ldrState = analogRead(ldrPin);

if (ldrState <= brightness) {
colorWipe(strip.Color(0, 0, 0, 255), 50);
} else {
colorWipe(strip.Color(0, 0, 0, 0), 50);

}
Serial.print(“LDR Value = “);
Serial.println( ldrState );
delay(500);
}

// Fill the dots one after the other with a color
void colorWipe(uint32_t c, uint8_t wait) {
for(uint16_t i=0; i<strip.numPixels(); i++) {
strip.setPixelColor(i, c);
strip.show();
delay(wait);
}
}