Introduction: RGB LED Motion Sensor Lamp


Materials & Tools Needed:
Arduino Uno
PIR Motion Sensor
1, LED
1, 220 ohm resistor
Jumper Cables 
Breadboard
Heat Shrink
SN75468N 16 pin IC chip
3, MOSFET N-channel transistors (I ordered mine from Adafruit)
5v DC Relay (I bought mine from Radioshack)
Perfboard
RGB LED Analog Flex Strip (I ordered mine from Adafruit)
Solderless Analog RGB LED Strip Clip Sampler (I ordered mine from Adafruit)
Alligator Clamps
Xacto knife
3, 24x3 inch shipping tubes
Strip of Aluminum Sheet Metal
Plywood
Sharpie
Wire Ties
Pop Rivet Tool
Pop Rivets, the appropriate amount to hold your lamp design together
Clamps (Not completely necessary but it makes using the pop rivet tool so much easier!)
Drill 
Skill Saw
Yardstick
Small Screwdriver
1032 Tap
Chanferring Tool
Sandpaper
Extra 22 guage wire for connecting all the pieces together
Soldering gun & solder
Battery pack and batteries (for plugging into arduino and testing before soldering)

I figured after buying all the various components this lamp cost me about $60.

Step 1: Testing Your PIR Motion Sensor

First thing that needs to be done is to test the PIR Motion sensor. I followed this instructable, which is the basic schematic I followed that is shown here. I do warn though, the PIR sensors from Radioshack are not set up exactly as the one in the shematic shown so I had to do some shuffiling around with my wires and LED/resistor placement, but overall it was relatively simple to test it and get it working.

Step 2: Using the Solderless Clips

I used Adafruits very own tutorial to connect my RGB LED strip to the solderless clips. All you need to do is cut along the predetermined lines and take off the extra clear plastic with the xacto knife and then clip it into the solderless clip and now you have the wires from the clip. To make it a bit more manageable, I soldered extensions onto these wires with the extra 22 gauge wire.

At this point, I also uploaded the code Adafruit has on their website to the arduino so the colors will change or you can copy the code from below:

// color swirl! connect an RGB LED to the PWM pins as indicated
// in the #defines
// public domain, enjoy!

#define REDPIN 5
#define GREENPIN 6
#define BLUEPIN 3

#define FADESPEED 5     // make this higher to slow down

void setup() {
  pinMode(REDPIN, OUTPUT);
  pinMode(GREENPIN, OUTPUT);
  pinMode(BLUEPIN, OUTPUT);
}


void loop() {
  int r, g, b;

  // fade from blue to violet
  for (r = 0; r < 256; r++) {
    analogWrite(REDPIN, r);
    delay(FADESPEED);
  }
  // fade from violet to red
  for (b = 255; b > 0; b--) {
    analogWrite(BLUEPIN, b);
    delay(FADESPEED);
  }
  // fade from red to yellow
  for (g = 0; g < 256; g++) {
    analogWrite(GREENPIN, g);
    delay(FADESPEED);
  }
  // fade from yellow to green
  for (r = 255; r > 0; r--) {
    analogWrite(REDPIN, r);
    delay(FADESPEED);
  }
  // fade from green to teal
  for (b = 0; b < 256; b++) {
    analogWrite(BLUEPIN, b);
    delay(FADESPEED);
  }
  // fade from teal to blue
  for (g = 255; g > 0; g--) {
    analogWrite(GREENPIN, g);
    delay(FADESPEED);
  }
}

Step 3: Wiring Your Breadboard to the Arduino

Using the schematic shown here you can wire your breadboard. 

Step 4: Soldering

Now the fun comes, soldering. Start by placing the 3 N-channel MOSFET transistors on your perf board. Place the rest of the components in the perf board. Measure, strip, and solder the ground wires to 1 and 1/4 inch to the left (negative) leg on the back of board. Solder 5 inch of wire to the last ground wire (green in my picture).

Next solder the red wire to the opposite lef that will run to pin number 4 on the arduino. Solder the white wire that will run to pin 6 on the arduino. Solder the LED strip wires to the mittle of the transistors (green, red, and black wires). To help organize you can tie the wire to hold them in place. 

Add the 16 pin IC chip and solder the ground to pin 8 (green wire). Solder 5v to pin 9 (red). Solder pin 16 wire to a coil on the relay (red wire). Solder the 5v power supply to the other coil leg on the relay.

Solder white wire (positive) to voltage wire from LED strip to a relay leg. The black wire should be soldered to the other relay leg for the Vin on the arduino. Solder the out wire (black wire) for the PIR sensor to pin 1 on the IC chip. I had to add the SN75468N 16 pin IC chip because the PIR sensor didn't have enough power to drive the relay.

Finally, strap the wires down with stripped copper wire so the wires won't get ripped out accidentally. This can be done by twisting the wire with pliers, cut, and flatten against the board.  

Step 5: Cut the Shipping Tubes

I suggest making your own variation of the design so it looks exactly how you want it to! For the design I made here, these are the measurements. To make the design with the angled edges, I had to measure and cut each tube one at a time depending on the last to get the correct measurements. The tubes were cut with a skill saw.

The Tube measurements from the top to bottom are:
4.25 inches for the first tube
6.5 inches for the second tube
9 inches for third tube 
11.25 inches for the fourth tube
14 inches for the fifth tube
16.5 inches for the sixth tube


Step 6: Measure the Plywood Backing

Cut the tubes down the back so they are in half. Next, lay the half tubes out on top of the plywood and measure with a straight surface. Next cut the plywood to the shape that fits your design. 

If you want to have a floating look, like I did, make sure you measure the plywood to be .25 and .50 inch in more than the tubes.

Step 7: Putting the Tubes Together

Drill holes where you are going to put the pop rivets and clamps to put the tubes together. 

Step 8: Make the Brackets

Use the yardstick and sharpie to mark the aluminum sheet metal at 1, 2, and 2.5 inches. These will become the brackets. Cut the strip at 2.5 inches and then bend the bracket at the 2.5 inch so there is a half inch 90 degree angle. Drill a hole in all the brackets. Next, use the pop rivets to attach these brackets to the tubing. 

Mark the brackets placement in the plywood backing and drill holes in the plywood backing where the brackets will sit.


Step 9: Lots of Drilling

Design how the light will shine through the tubes. I made a pattern out of dots after various attempts of pattern designs I finally decided on this one. The next thing to do is to draw the design on the tubes with pencil and to drill the holes. 

Now drill in all those holes. I will tell you, this took a bit of time but it was awesome when it got done! Lastly, sand the holes so the edges are deburred. I did realize that after we used the spray paint that the process of sanding left a texture that could be seen as bad if it's not what you are going for, so beware.

Now is the part where you can take out the spray paint and paint the tubes and plywood colors of your choice. Since I chose a silver, I actually painted the inside of the tubes as well so the light would reflect better than just off of the brown cardboard. Am I really sure this changed how the light reflected? No, not really but that was my idea behind painting the inside.

Use the 1032 tap to make threads in the holes for the brackets. Next drill holes where the brackets will sit on the plywood. A tip, is to use a chamfering tool to make the holes wide enough so that the screws will sit flush with the plywood and not scratch the wall where you will eventually be hanging the lamp. 

Step 10:

Finally, peel the tape off the back of your RGB LED strip and stick it on the inside of the plywood backing. Now drill holes around the arduino and perf board to allow them to stay in place. To help keep things organized and for extra security of the components, drill 2 holes around the RGB LED strip and wires and use wire ties to tighten it to the plywood backing. 

Secure the PIR motion sensor to a location that you desire. I found that I could hide mine inside the tubes near the bottom and that the higher the lamp is hanging, the wider the range it picks up on. Attach the brackets to the plywood with screws using the screwdriver. Make sure to cut the excess wire ties off so they aren't sticking out everywhere once you're done securing your components and pieces.

Now, you can add a picture hanging bracket to the back if you so desire to. 

Enjoy your new lamp!