Introduction: Night Night Box

I found myself in an odd situation recently. We switched cable carriers; they replaced our cable box; but the new box did not have a clock. So, I purchased a small digital clock. The clock sits on top of our TV in our bedroom across from the bed. My wife began complaining that the clock's light was too bright during the night and it bothered her while trying to sleep. So, the simple solution is to just close the door to the cabinet at night (or get another clock). So the next complaint was that she would become sleepy and comfortable and wanted to know if there was away to block the light from the clock remotely so she did not have to get out of bed to close the cabinet door. So, the complicated mechanisms started being considered. In the end, I 3D printed a box, with a hinged front, controlled by a servo with an IR remote connected to an arduino. I probably over complicated it, but the most important thing is it works and in the end, happy wife equals happy life.

Step 1: First the Box

I measured the clock's dimensions and drew out a rough calculation of how I wanted the night box to function. I then utilized Autodesk's 123D Design to create the night box and door. I separated the box into two sections, one for the clock and the other to house the servo.

Step 2: 3D Print

I then used my 3D printer (De Vinci 1.0 from XYZ Printing) to print out the box and cover.

Step 3: Paint and Hinges

A little black paint and some very small hinges put the box together. I used clear plastic for a panel to allow the IR signal to reach the sensor inside the night box. I used sandpaper to rough up the pane so it looks frosted. The IR signal does not seem to have any problem going through the panel.

Step 4: Placement

I fiddled around with the location of both the box and the servo to make sure everything would function they way I wanted it to.

Step 5: Servo

Using 123D Design I created a holder for the 9g servo. Then 3D printed it to fit into the night box.

Step 6: Measurements for Arm

I attached an arm to the servo and screwed it into the separating wall between the two sections of the interior of the night box.

Step 7: Electronics

I connected an Arduino Uno to a breadboard and attached an IR switch. It is one of those cheap Chinese switches with four channels. I used one channel for the arm being completely up and another for it being down. The holes in the back of the nighbox are for allowing the electronics to go from one part of the box to another. I have not finished the picture schematic but I'll post that as soon as I'm done. It's essentially just a normal wiring for a servo with a signal and ground for the IR switch.

Step 8: Arduino Code

#include

const int buttonPin = 2;

const int buttonPin2 = 8;

int buttonState = 0;

int buttonState2 = 0;

Servo servoA;

int position = 0;

void setup() {

servoA.attach(9);

pinMode(buttonPin, INPUT);

pinMode(buttonPin2,INPUT);

}

void loop() {

buttonState = digitalRead(buttonPin);

buttonState2 = digitalRead(buttonPin2);

if(buttonState ==HIGH && position < 90){

servoA.write(position++);

delay(5);

}

if(buttonState2 == HIGH && position > 3){

servoA.write(position--);

delay(5);

} }

Step 9: Completed Project

So I now have a little black box on top of my TV stand. The door is open during the day revealing the time. When night falls and my wife gets comfortable in bed, she reaches up and punches the IR remote closing the door. When she gets up in the morning and wants to see the time, she hits the remote again and the door raises. Personally, the light does not bother me so it's just a little something to make her more comfortable. But it was an interesting build. I hope to improve on it with time, but just needed to get it operational at this point.