Project tutorial
Glowing Embers Nightlight

Glowing Embers Nightlight © GPL3+

If you want to make a nightlight combining a military surplus shell canister with some LEDs, you're in the right place.

  • 985 views
  • 0 comments
  • 3 respects

Components and supplies

Apps and online services

About this project

Along with my other hobbies, I have an interesting collection of antiques I've collected. One antique has sat by my bedside for over 3 years, serving no purpose. This shell canister has mysterious phrases like FLASHLESS, PP-GL2-F3-S1 and ELECTRIC PRIMER. It has a 3 inch diameter. I still haven't figured out where it came from, but I do know that it's the "booster package" for a shell fired from a ship, artillery or other. With its heavy metal, cool oxidation and unique shape I knew I wanted to use it for something. If anyone knows about these primers please comment below.

Finally, the idea came. Nightlight. Arduino. Boom. Model 1 is here to make your bedroom look really, really cool. Once the darkness level is reached it will simply fade in and out. I know not everyone is going to have one of these canisters laying around but the circuit and code can still serve as a fun mini 20 minute project. Let's do it.

This project uses a simple layout with a photo resistor and a few LEDs. Any dark colored cylinder should work. We will be using an analog pin, 5V and ground pin for the sensor. The four colored LEDs of your choice will be powered by single PWM pin for the dimming effect.

I made the circuit on a mini breadboard and attached it the the back of my Uno. This keeps the size down so it could fit down the 3 inch diameter. One problem I found is that depending how dark your canister is the sensor may turn on the LEDs before you turn off your bedroom light. To correct this I attached the sensor to a wire extension so I could place the sensor by the top, to get an accurate reading from my room. I taped the photo resistor in place. When you have completed the circuit diagram it should look something like this.

That messy chunk of wires is pure joy...

The diagram is black for ground, red for 5V, orange for the analog, and blue for pin 9. Sadly, the frizing diagram can't show my exact layout because it would be confusing to view, but if you move all the parts close enough to get on a mini breadboard you should be fine.

The code will need enhancement depending on light amount in your room. For my present light environment I needed the light amount to == 0.

Hope you have a great day everyone and enjoy your nightlight! Arduino is just plain awesome for anything.

Code

nightlight codeArduino
const int photoPin = A1;  
int sensor_val = 0;
int ledPin = 9;
void setup() {
  pinMode(ledPin,OUTPUT);
  pinMode(13,OUTPUT);      //I didn't want the light on
  digitalWrite(13,LOW);
}
void nighttime(){
    for (int brightness = 0 ; brightness <= 255; brightness += 5) {
    analogWrite(ledPin,brightness);
    delay(60);
  }
  delay(350);
  for (int brightness = 255 ; brightness >= 0; brightness -= 5) {
    analogWrite(ledPin, brightness);
    delay(60);
  }
  delay(350);
}
void loop() {
sensor_val = analogRead(photoPin);
  if (sensor_val == 0){
    nighttime();
}
else{
  digitalWrite(ledPin,LOW);
  }
}

Schematics

2018-10-02_(2)_ofwmYS2tIg.png
2018 10 02 (2) ofwmys2tig

Comments

Similar projects you might like

The Troll Switch

Project tutorial by Aitor Gamarra

  • 3,081 views
  • 3 comments
  • 7 respects

Light Sequence Creator

Project tutorial by Reid Paulhus

  • 22,180 views
  • 8 comments
  • 43 respects

How to Use a Datalogger

by MisterBotBreak

  • 8,062 views
  • 2 comments
  • 21 respects

Kids RGB LED Star Nightlight

Project tutorial by Unexpected Maker

  • 6,738 views
  • 1 comment
  • 22 respects

LED Color Sequencer

Project tutorial by thefantasticode.Group

  • 16,591 views
  • 17 comments
  • 43 respects

How to Create a Data Displaying System with a TFT Screen

Project tutorial by MisterBotBreak

  • 6,504 views
  • 3 comments
  • 14 respects
Add projectSign up / Login