If you have ever wanted to put a bunch of electronics into a box together, or make a custom control panel this instructable might help. I will show you how I mounted and wired electronics inside an electrical box as well as how I mounted buttons, switches, and connectors on the outside of the box.
All of this can be done with a simple outdoor electrical box from a hardware store. These are great because they have lots of thick yet soft plastic thats easy to work with and they come in many sizes. In this example I use a 8"x8"x4" box.
You can do all of this with a standard dremel tool but a few other tools will make it easier... so here is a basic tool list.
- Dremel or other rotary tool
- Spray adhesive (3m super 77 recommended, other glue could be used)
- Blue Painters tape (3m recommended)
- Metal or plastic stand-offs for mounting circuit boards
- Any electronic components for your project
- Any wires, sockets, or connectors needed for your project
- Drill Press (highly recommended)
- Printer (to print template)
- Gorilla Glue (good for some connectors that need to be glued)
All of this stuff should already be in your garage, if not you can find it all at the hardware store.
I'm building a box to hold a fermentation controller for beer. Here is a video of the finished working box.
OK so lets get started.
Step 1: Outside of the Enclosure
The first thing you should do is to lay out all of the electronics you want to put into the enclosure and all of the connectors and buttons you want to mount outside the enclosure in order to find the best layout and fit.
I would recommend using calipers and Adobe Illustrator or Inkscape to measure then draw accurate pictures or templates of how your parts will be laid out. Spend time in the planning phase to avoid problems later in the building phase. The enclosure is pretty cheap but if you make a layout mistake you will have to start over.
Here are some examples of my templates made with Illustrator and laying out the actual parts inside of the box. Remember to think about what devices will need to be connected and leave enough room for cables and connectors to fit.
Step 2: Transfer Template
It may take a few tries to get your template just the way you want it. I usually forget something or want to try a few designs so I end up printing a few templates and looking at them on the box to see which I like best. Its always good to verify the parts will not bump into each other inside the box or behind the top panel where they will be mounted. Leave space for screws and nuts that hold everything in place.
First take the 3M painters tape and cover the entire top of the surface you want to mount your parts onto.
Then spray the 3M painters tape with the 3M super 77 spray adhesive. This will allow you to stick the template to the sufrace without it being permanent.
Once you are happy with your templates position on the box use a hole punch or nail to mark the center of all of the areas that will need to be drilled out.
Use a drill press, drill or dremel to drill a small center hole (~1/8") on all of the areas you marked.
Use the correct size drill bit or dremel to roughly cut out each of the holes. Just like a coloring book, try to stay inside the lines. its better to make the holes too small then too large at this point.
Step 3: Finish Up the Rough Cuts
Once you have drilled and cut all of the holes to roughly the size they need to be peal off the 3M painters tape and the template as one piece. You will now see the rough edges of your cuts.
Take the actual pieces you want to mount and keep cutting and test fitting them until they all fit.
From there you can make the box look as good as you want to. Sometimes the holes and rough edges will never show or they dont need alot of work. Its a good idea to take a file to knock off the rough edges and to get the corners perfect.
After a little bit of work and a good template you should have something that looks close to a laser cut piece of plastic that perfectly holds your buttons, switches and connectors.
Step 4: Connectors
Here are pictures of the same process but this time done on the bottom for various types of connectors. Some screw into place, some need to be glued.
I prefer to test fit all of my connectors, then wire some longer leads onto them if required before gluing or screwing into place.
The 3 pin silver MIC connectors shown actually screw into place. The box however was too thick for them to reach all the way through. Instead I use a very small amount of Gorilla Glue and clamped them in place overnight. Gorilla glue expands so a little goes a long way. This worked out perfect for a nice solid connection.
For other connectors that screwed into place I drilled and tapped the holes which I will cover in the next step.
Step 5: Electronics
Now that all of the connections are done on the outside its time to mount the electronics on the inside. This is a bit quicker and easier as everything will most likely use the same drill bit and require much less cutting.
Layout your electronics again in the exact spacing and configuration you want them. Remember to leave room for wires and connectors.
Their are companies who make PCB standoffs that have a sticker backing, if you want you can use them. I like to drill standoffs for a secure fit, just like on a computer motherboard.
Use a sharpie marker to make a small mark on each of the mounting holes for the circuit boards.
Use your punch to mark the sharpie marks to give you a place to start drilling.
Drill a pilot hole with a 1/8" or smaller bit to find the exact center
Use the correct drill bit for your tap set to drill out the holes from the bottom side (which is much easier)
Use the correct tap to tap the holes, again from the bottom side. The plastic is thick so go slowly when tapping and remember to back off the tap then start again, 2 steps forward, one back, kind of approach.
From there simply screw in your metal or plastic standoffs.
Step 6: Mount and Test Fit the Electronics
At this point you should be able to mount all of the electronics, buttons, switches, connectors, etc. Make sure to test fit everything and see if the lid still closes and everything looks good. Now is the time to make the adjustments.
You can use a compressor or a can of air to blow out any remaining debris from drilling and cutting and clean everything up.
If you are happy with everything then you can start wiring!
I would recommend having everything you need on hand before you start,
All of the correct colors and gauges of wire
I would also recommend a pair of forceps, this will make it easier to insert small wires into hard to reach places inside the box.
Step 7: Wire the Electronics
When wiring the electronics you want to make sure the wire is exactly as long as it needs to be. Slack can sometimes be a good thing, however too much slack in a small box like this will lead to lots of clutter.
Try to cut all of your wires slightly long then you think they need to be. Then route them to where they will go and cut off the excess so that its a perfect fit.
Route wires under PCB's if you can to save space. if you have different voltages like AC/DC try to keep them physically separated as much as possible. If wires do need to cross each other try to do it perpendicular like a + intersection.
Use zip ties and sticky mounts to keep cables out of the way or grouped together.
You can also use various quick disconnects to make it easy to detach components you may need to replace. This is also useful for connections between the door and the inside of the box.
I left lots of slack and added disconnects to all of the wires going from the door to inside the box so that I could easily access and troubleshoot or remove the lid completely if needed.
Step 8: Fit, Finish, and Testing
Now that everything is in place and wired up I would HIGHLY recommend double checking and test each and every connection. A multimeter can usually get the job done. The last thing you want is to plug in your new device and see the magic smoke released from your electronics.
If you can, try testing in phases. Disconnect the PSU from everything and test it alone to see if it performs as expected. Section by section, plug in and test each PCB and device to be connected to your electronics. If a problem does pop up you will hopefully be able to figure out where it is and fix it before it does any real dammage.
In my case, I was building a fermentation controller. I reversed two of the wires on my temperature sensors which caused them to not report any data. Luckily, I was able to trouble shoot and trace the issue and did no permanent dammage to the sensors. When I finished the box, I manually tested the unit to see if it was controlling my freezers compressor and my heat source for my fermentation. Once I verified everything was working I filled a fermentor with water and gave the unit a trial run overnight to see if it would do its job. When I was confidant it would work reliably I filled the fermentor with freshly brewed beer and I am happy to report it works flawlessly.
Here are some additional tips to help you out
- Take your time, think about what you are doing
- Build a prototype or digital model (cardboard, paper, sketchup)
- Its ok to mess up. The boxes are cheap
- Plan for expandability and robust connections if possible
- Keep things simple whenever possible, break things down to their core functionality, use multiple boxes if necessary
- Keep in mind interference and voltages when working with AC and sensitive electronics
- Label everything you can, you will forget what the red wire does in 6 months, keep your notes (evernote)