Introduction: Fancy Room Lighting Control Panel
This Instructable will show you how I made a control panel that has three 12 volt power output ports which can be controlled with knobs at the front. I will be connecting the lighting in my basement to the three outputs, so that it can be controlled through the panel.
The panel has a nice and ambient light pulsation when it's passive, and when you turn the knobs, the internal light indicates how much the knob is turned, with a separate color for each knob.
Even though I am no expert, merely a beginning hobbyist, I will assume that you have some basic knowledge of electronics (more specifically, how a mosfet works). If not, this is a good resource: https://www.youtube.com/watch?v=o4_NeqlJgOs
Step 1: Overview
Here's a list of the resources I have used. I have linked to a search where relevant, but for instance the 12 volt power supply is something I found on my "old electronics" shelf. There are many different variations of power supplies, and many might work, but for me it had to be something that looked subtle, or that could easily be hidden or covered up, as it would be on the wall. It also has to deliver a decent amount of current, depending on how much light it will be supplying power to.
Arduino Nano: http://goo.gl/ltyX2M
Voltage step-down: http://goo.gl/6Q1ScO
RGB LED-strip: http://goo.gl/GDIoMA
Female power connector: http://goo.gl/jP5O3E
Metal angle fitting
Soldering iron & station
Contour saw (can use hacksaw instead)
Step 2: Perf Board & Mosfets
As I didn't have a large enough perf board, I used two separate perf boards which I joined together by putting the Arduino in the middle. At the picture you can see that I soldered the Arduino directly to the perf board, which is not ideal. When it broke later I soldered on some female to male heder pins instead, so that I could take the Arduino in and out effortlessly.
Next thing I did was to attach four mosfets in line next to each other to the perf board. The mosfet is what will switch on and off the power outputs, and can do PWM dimming (PWM vs Potentiometer) for the light. The observant reader will understand that we need one mosfet for each power output, and ask why I used four, when I initially said it will have three power outputs. The answer to this is that I thought I would be using the fourth mosfet internally with the button. I haven't done that yet, but I still might. If you're following my design, feel free to only use three mosfets, or to add a fourth power output.
Step 3: Creating a Common Ground
The ground of the Arduino and the ground of the power supply needs to be tied together, as I understood it when I did the research for this project. I don't have deep enough understanding of the electronics to comment on why, but If anyone could give a more thorough explanation that would be welcome.
To achieve this, I used the wire from some resistors (as I didn't have any other thin uninsolated wire) to create a line of wire running parallel with the mosfets, with some spacing between. From now on I will refer to this wire as the common ground.
Then I connected every source port of the mosfet to the common ground we created before. Now four wires, one from each mosfet, should connect to the common ground cable.
Finally I drew a regular cable from the GND pin of the Arduino, to the exposed common ground wire.
Step 4: Mosfet to Arduino
To be able to control the mosfet from the Arduino, we have to be able to deliver a small current to the mosfet, which will tell it to open. This current goes to the gate pin, and connects to an available pin that can be written to on the Arduino. This has to be done for all four mosfets, and all of the mosfets needs to connect their gate to a separate arduino pin. So in total: four different wires, going from four different mosfet gates, going to four different pins on the arduino.
Step 5: Prepare for Power
In this step we'll prepare the external electronics units, as the power connectors and the potentiometers which the knobs will attach to. We can't connect it right to the Arduino yet, as it has to go through our wood frame, and we haven't made that yet.
So we solder a black wire for negative to the long pin of the power connector, and a red one for postive to the shorter pin, which should be right in most cases. To make it a little sturdier, I covered the connector with some appropriate sized shrinking tube. I made four of these as well: 1 for input power (connects to our power supply), and 3 for output power (connects to our appliances which we want to control, e.g. lighting). Just prepare them, and put them away for later use.
Step 6: Potentiometers!
Surprisingly enough, we'll use four potentiometers as well. These are prepared the following way:
Negative wire to leftmost pin, goes to Arduino ground.
Positive wire to rightmost pin, goes to Arduino 5v output.
Middle wire (signal wire), goes to an analog Arduino pin (any analog input).
Now the potentiometer, which is a variable resistor, decreases the voltage that goes to the analog input pin when it is turned. When we read the value later from the analog input in the code, it will map the voltage value to a value between 0 (low) and 1023 (high), which we can make use of.
Step 7: Assembling an Acceptable Frame
As a programmer and computer engineer, I am a relative beginner to both electronics and woodworking, I don't expect to be able to produce perfect results - neither give the best advice on the subjects. But what I definitely can and will advice you to do, is to try new things out and not be afraid to fail. If the outcome is not the most perfect, it doesn't matter, what matters is that you're doing it, and it's going to take you somewhere!
I began the frame - or the box if you will, by cutting out some wooden pieces with equal width. Using a router, I made an indentation in the wood right next to the edge, which was as deep into the wood as my acrylic glass was thick (about half a cm, 0.2 inches). This is to make the acrylic lie flush with the wood later, to make a nice and flat surface.
I cut 2 equally sized short pieces of wood using the miter saw on a 45 degree angle, and then I did the same with 2 equally sized longer pieces of wood. Make sure that the mitered edge is so that the shortest side of the wooden pieces will be the one facing inwards, else they can't join together to form a rectangle.
By using wood glue, many clamps, and some time, these should form a nice looking frame in the end.
Step 8: Contours
Using the contour saw, I cut out out a piece of wood that was exactly the size of the inner edges of the box, so the piece would slide in. I was a little rough with the saw, so I used a file to grind it down a little bit. I am going to use this a socket to mount the final panel on, so the fit better be snug.
Furthermore I measured the length and width of the routed out edges at the front. This is the size my acrylic glass would be, and hence the front of the panel. Using the contour saw again, I cut it out, and crossed my fingers it would fit.
Step 9: Holes and Paint!
This step is very simple, we want to drill holes to stick our potentiometers through. So plan out how you want to arrange your knobs and buttons, then mark it, and drill holes. To not crack the acrylic, I suggest starting out with a thin drill bit, and then increasing the size. I had to use a really large one in the end, as the thread on the potentiometer didn't get through the thick acrylic glass. I drilled a hole wide enough for the screw to fit in. Luckily the knob will cover this up later.
Lastly, I removed the plastic protection on the acrylic glass on the backside, and spray painted it white. This might not be needed if you are able to get your hands on some opaque acrylic.
Step 10: More Holes, Stain & Power Again
Next I planned out where my power connectors would go. For my setup, the most practical will be to have them going out the top. If it's possible I believe going from the bottom would have been a more subtle solution. I wanted to separate the input connector from the output connectors, so I ended up with three holes on one side, and one on the other.
I found some nice stain in the garage, and rubbed it on with a piece of cloth, before I threaded the power connectors we made earlier through the holes we just drilled. If they're hanging loosely in there, it might be a good idea to apply some hot glue on the inside. For me it was a tight fit, and I really had to use some force to get them in so I think mine will be fine without any glue.
Step 11: Last Part of Electronics
For the input power connector: connect the negative to the common ground, then connect the positive wire to something where several wires can attach to it. I just selected an empty spot on the perf board, and used solder bridges to connect to it later.
For all the output power connectors: Connect the positive wire to the positive wire from the input power connector, then connect the negative wire to the drain of the mosfet.
To power the arduino we need to step the voltage down from 12 volt to 5 volt. Using a multimeter I turned the tiny variable resistor on the voltage step down board until the output part was 5 volts with a 12 volt input. I connected the in positive & negative on the voltage step down board to the positive and negative wire of the input connector, and then I hooked up the out part of the step down board with the VIN and GND pins on the Arduino.
By loading in some code, connecting a 12 volt power source to input, and a LED-panel to one of the output, I could verify that it was actually working.
Not on the first try though.
Step 12: I Mean, This Is the Last Electronics Part
To make the box a little fancier, I attached some RGB LED-strip all the way around the edge of the box, just below where the acrylic would sit. The positive and negative wires goes to 5v out and GND pins on the Arduino respectively, while the signal attached to any available digital pin on the Arduno. This way we can control it with the Arduino. Personally I am a big fan of the FastLED library.
The observant reader will also notice that I need some practice in cable management. Cough!
Step 13: Finishing Up!
Alright, we're close now.
I fetched the acrylics, because with the time I spent fiddling with the electronics the paint had tried several times already. I removed the protective film on the front side, then pushed the potentiometers through, and tightened the nut around the screw, so it would stick in place. Then I pushed on the Aluminium knobs, and put the acrylic on top of the box. The acrylic had a snug fit here as well, and would stay well in place. Personally, I like to be able to take it off easily so I wont glue it to the frame or anything, but if you're worried some silicone around the edges would probably keep it safe.
Lastly, I drilled the wooden socket to the wall, and then pushed the whole panel firmly in place on top of it.
Final message to observant reader: You might notice I left out talking about the button. Well, that's because I never found a use for it. I attached it to 12 volt so that it lights up blue, but I haven't really given it a function yet. (the 4th mosfet was initially there to be able to control the LED light on this button). It looks cool though.
Step 14: Why It's Cool
I like this a lot because the light control is centralized and digital. Which means I anytime can extend the functionality, and make it controlled by another interface. Also I am a sucker for LED lights, and I love how the light on the backside of the panel will change color and gradually wrap itself around the box, following how much and in which direction you turn the potentiometer. Basically working as an indicator to when light is off, when it's full, and when it's half-dimmed. The box itself also has a certain aesthetic appeal, and when it left alone (no knobs turned) for about 5 seconds, it will start a light pulse. Blue if any of the potentiometers are turned in an on position, and orange if all the potentiometers are turned all the way down.
Here is a link to my github and the code I wrote for this. I will not comment it here, but if you have any questions about it (e.g. you are trying to use it, but you don't understand / can't get it to work) I promise I will help you out if you contact me. Having that said, I really encourage you to try to write something cool on your own!
I know this was a long one, if you're still reading this, I want to say thank you and to tell you to stick with us here and on YouTube for more content!
Until next time,
Hansi, Natural Nerd