Introduction: Aruduino DIY Night Light / Disco Light
Hello! Welcome to my intractable, in this intractable I will teach you how to build a night light which can also be used as a small disco lamp.
For this project you do not need to have any experience and when I started I barely had any.
Materials:
Arduino Uno
Breadboard
Plastic box
Breadboard Wires
Transistors
9 Led's Any Colour
7 Resistors
Tools:
Dril
Sandpaper
Soldering Iron And Solder
Step 1: Drill Holes in a Piece of Wood.
Drill a grid of 3 by 3 in the wood the same size as your led's then label them like on the image.
Step 2: Solder the Led's Together.
Solder the Led's together, you can use any colours you want but don't put anything in the middle. Solder like this, move all the positive leads from the led's up and all the negative ones horizontal and solder them all together.
Step 3: Attach Resistors and Wires.
Now attach resistors to all positive sides like above and attach wires to them. Then attach an other colour wire to all negative sides.
Step 4: Make a Transistor Grid
Now we will make a transistor grid for the negative sides of the led's. Attach the base of each transistor to a pin on the Arduino with a resistor in the middle. Then attach the collector to the negative pin of the Arduino. Lastly attach the emitter to one of the negative wires. Now do this 3 times for each negative row.
Step 5: Attach the Positive Rows
Now attach the positive wires to another 3 pins on the Arduino (Preferably with PWM).
Step 6: Attaching the Last Led
Now put the last led in the breadboard and connect it to a pin on the Arduino and to the negative pin.
Step 7: Making the Enclosure
Now we will make the enclosure which will also make the lights look cool. To do this it is very simple, just grab the enclosure and sand it till it is how you want it.
Step 8: Done. Programming
Congratulations you're done. For the programming you can control every led, the middle led you can control with its own pin. For all the other led's you can use the transistor grid and the pins. Here is a quick example
int neg1 = 2;
int neg2 = 4; int neg3 = 7; int pos1 = 3; int pos2 = 5; int pos3 = 6; int middle = 9; int number = 0;
void setup() { pinMode(neg1, OUTPUT); pinMode(neg2, OUTPUT); pinMode(neg3, OUTPUT); pinMode(pos1, OUTPUT); pinMode(pos2, OUTPUT); pinMode(pos3, OUTPUT); pinMode(middle, OUTPUT); digitalWrite(neg1, HIGH); digitalWrite(pos1, HIGH); digitalWrite(pos2, HIGH); digitalWrite(pos3, HIGH); delay(200); digitalWrite(neg1, LOW); digitalWrite(pos1, LOW); digitalWrite(pos2, LOW); digitalWrite(pos3, LOW); digitalWrite(neg2, HIGH); digitalWrite(pos1, HIGH); digitalWrite(middle, HIGH); digitalWrite(pos3, HIGH); delay(200); digitalWrite(neg2, LOW); digitalWrite(pos1, LOW); digitalWrite(middle, LOW); digitalWrite(pos3, LOW); digitalWrite(neg3, HIGH); digitalWrite(pos1, HIGH); digitalWrite(pos2, HIGH); digitalWrite(pos3, HIGH); delay(200); digitalWrite(neg3, LOW); digitalWrite(pos1, LOW); digitalWrite(pos2, LOW); digitalWrite(pos3, LOW); digitalWrite(pos1, HIGH); digitalWrite(neg1, HIGH); digitalWrite(neg2, HIGH); digitalWrite(neg3, HIGH); delay(200); digitalWrite(pos1, LOW); digitalWrite(neg1, LOW); digitalWrite(neg2, LOW); digitalWrite(neg3, LOW); digitalWrite(pos2, HIGH); digitalWrite(neg1, HIGH); digitalWrite(middle, HIGH); digitalWrite(neg3, HIGH); delay(200); digitalWrite(pos2, LOW); digitalWrite(neg1, LOW); digitalWrite(middle, LOW); digitalWrite(neg3, LOW); digitalWrite(pos3, HIGH); digitalWrite(neg1, HIGH); digitalWrite(neg2, HIGH); digitalWrite(neg3, HIGH); delay(500); digitalWrite(pos3, LOW); digitalWrite(neg1, LOW); digitalWrite(neg2, LOW); digitalWrite(neg3, LOW); digitalWrite(neg1, HIGH); digitalWrite(pos1, HIGH); digitalWrite(pos2, HIGH); digitalWrite(pos3, HIGH); delay(200); digitalWrite(neg1, LOW); digitalWrite(pos1, LOW); digitalWrite(pos2, LOW); digitalWrite(pos3, LOW); digitalWrite(neg2, HIGH); digitalWrite(pos1, HIGH); digitalWrite(middle, HIGH); digitalWrite(pos3, HIGH); delay(200); digitalWrite(neg2, LOW); digitalWrite(pos1, LOW); digitalWrite(middle, LOW); digitalWrite(pos3, LOW); digitalWrite(neg3, HIGH); digitalWrite(pos1, HIGH); digitalWrite(pos2, HIGH); digitalWrite(pos3, HIGH); delay(200); digitalWrite(neg3, LOW); digitalWrite(pos1, LOW); digitalWrite(pos2, LOW); digitalWrite(pos3, LOW); digitalWrite(pos1, HIGH); digitalWrite(neg1, HIGH); digitalWrite(neg2, HIGH); digitalWrite(neg3, HIGH); delay(200); digitalWrite(pos1, LOW); digitalWrite(neg1, LOW); digitalWrite(neg2, LOW); digitalWrite(neg3, LOW); digitalWrite(pos2, HIGH); digitalWrite(neg1, HIGH); digitalWrite(middle, HIGH); digitalWrite(neg3, HIGH); delay(200); digitalWrite(pos2, LOW); digitalWrite(neg1, LOW); digitalWrite(middle, LOW); digitalWrite(neg3, LOW); digitalWrite(pos3, HIGH); digitalWrite(neg1, HIGH); digitalWrite(neg2, HIGH); digitalWrite(neg3, HIGH); }
void loop() { if(number == 0) { digitalWrite(pos3, LOW); digitalWrite(neg1, LOW); digitalWrite(neg2, LOW); digitalWrite(neg3, LOW); delay(200); } digitalWrite(neg1, HIGH); digitalWrite(pos1, HIGH); digitalWrite(pos2, HIGH); digitalWrite(pos3, HIGH); delay(200); digitalWrite(neg1, LOW); digitalWrite(pos1, LOW); digitalWrite(pos2, LOW); digitalWrite(pos3, LOW); digitalWrite(neg2, HIGH); digitalWrite(pos1, HIGH); digitalWrite(middle, HIGH); digitalWrite(pos3, HIGH); delay(200); digitalWrite(neg2, LOW); digitalWrite(pos1, LOW); digitalWrite(middle, LOW); digitalWrite(pos3, LOW); digitalWrite(neg3, HIGH); digitalWrite(pos1, HIGH); digitalWrite(pos2, HIGH); digitalWrite(pos3, HIGH); delay(200); digitalWrite(neg3, LOW); digitalWrite(pos1, LOW); digitalWrite(pos2, LOW); digitalWrite(pos3, LOW);
delay(200);
}