Introduction: Lego + Sugru Panel Mount Connectors (with RetroPie Case As Example)
Runner Up in the
Game.Life 4 Contest
Update 3/16/2014: thanks to everyone who voted for this project in the Game.Life 4 contest!
The motivation for this project came when I combined my Raspberry Pi voice-controlled electrical outlets with a RetroPie. Due to the number of peripherals and cables involved (a powered USB hub, microphone, two USB controllers, breadboard, wireless remote, plus the normal HDMI and power cables for the Pi), this led to a pretty tangled mess of wires that didn't exactly look great sitting in the TV cabinet. So, I wanted to build a nice case to hold everything that looked something like a regular game console - ideally with external connections for the USB devices, an HDMI port, a power switch, and a single power cord (shared by the Pi and the USB hub).
The normal way to do this would be with a custom project box and regular panel mount connectors, like these HDMI and USB ones from Adafruit. To do that, you need to either machine or laser-cut a custom panel to fit all the connectors, and I don't have the means to do so (yet....cough, cough, Full Spectrum Laser contest). I've seen a bunch of cool Raspberry Pi LEGO cases out there - but most of them just enclose the Raspberry Pi itself, without all the extra space for a USB hub and breadboard, or sturdy external panel mount connectors.
Enter Sugru, a self-setting rubber that you can mold by hand, kind of like Play-Doh or modeling clay*. Let it sit for 24 hours and it hardens into a tough, slightly flexible rubber. I'd recently used it for the first time to waterproof a small DC motor for a different project, and realized it would be great for this: build a case out of LEGOs, and use Sugru to firmly seal in the panel mount connections - no machining or lasering required. Rather than using regular panel mount connectors (which have screw terminals that I wouldn't need for this approach), I could use either very short extension cables or female-female couplers to create the panel mounts. The result is a very fun and kid-friendly approach to building a stylish case, without requiring any tools.
So, you could use this idea for ANY project that requires panel mount connections - it doesn't have to be Raspberry Pi-related. I'll just be using my RetroPie "console" as an example since it contains a variety of different connectors (HDMI, USB, barrel jack). I'll also include a power switch (a nice addition since the Pi doesn't have one built in), but that part requires a bit of soldering. It should be pretty easy to adapt the process for any other connections you need for your project (VGA, RCA, pushbuttons, slide switches, etc etc).
*Sugru has an Instructables account where they post their own projects that use Sugru. I am in no way affiliated with the company, nor is this an endorsement of the product. I first found out about Sugru when I won a couple packets as a prize in a different contest, and decided this would be a cool use for it. If you know of a different, cheaper, or better material to use, please mention it in the comments below (for example, I'm curious if plain old modeling clay would work, but my hunch is that it would be too brittle once dried).
Step 1: Materials
- Sugru, available in different multi-packs and color combinations. I used one individual pack per connection. Right now it only comes in red, yellow, blue, black, and white, but you can mix those colors to make new ones.
- Assorted LEGO bricks - colored to fit your personal style, of course; and quantity will depend on the overall size of your case and number of connectors. Take a look at the next couple steps to get a rough idea for how many pieces you'll need for a single panel mount. You can buy individual LEGO bricks at the Pick a Brick shop.
- 6" USB-A male to female extension cables (I have a 7-port USB hub, but one port powers the Pi, so I ordered 6 of these). Edit - after using them, these cables are not very flexible, which makes it difficult to cram them into a small case. I didn't want to spend more money on new cables, but I wouldn't recommend these very highly.
- 6" HDMI male to female extension cable. Note: I actually already had a very short male-male HDMI cable, so I ordered an HDMI female-female coupler to use along with that cable. Either approach should work fine. Edit - as with the USB cables, short HDMI cables don't seem to be very flexible - keep that in mind if you're designing a very small case.
- 1.3mm barrel jack male-female extension cable. Be careful with your power cable! Unfortunately there are a bazillion different barrel jack sizes. I bought this one hoping it would be compatible with my Plugable 7-port USB hub. I got the diameter right, but the plug is a couple millimeters too long - fortunately it still fits and everything powers on OK. The cable itself is obnoxiously long to fit inside a case (six feet), but you can cut it and solder the ends back together to make it shorter.
- Rocker switch and some extra hookup wire if you'd like to add a power switch. Unlike the other connections, this one requires soldering. You'll also want some electrical tape or heat shrink tubing to cover up exposed wire.
- Edit - I just discovered the SparkFun carries a barrel jack power switch. I don't use this in my instructions, but if you want to avoid soldering altogether, you could use that instead of cutting up a barrel jack cable and soldering it to a separate switch. Again, make sure the plug size is compatible with your project - this one will NOT work with the Plugable USB hub I listed above.
Step 2: Dry Run With LEGOs
Sugru has a working time of about 30 minutes. That means that you need to plan your LEGO build out in advance - don't open all the Sugru, then panic as you try to assemble your whole case in half an hour! You should already have an idea of how many and what kind of ports you need for your project. The next thing to decide is how you want them to be arranged. Do you want to build a somewhat permanent case out of LEGOs with multiple ports built into the same walls? There's nothing wrong with that, but I decided to opt for a more modular approach - I built an individual box around each port. While the end result is a little bulkier than it could have been, it means I can swap ports out or move them around if I ever decide to do a different project in the future.
I'd recommend just doing a "dry run" - build the LEGO structures without using any Sugru. Make sure your cables fit snugly, with a little room around the sides to pack in some Sugru and hold them in place. As you can see above, I tried this for my USB, HDMI, and barrel jack connectors. I used 4x4 plates for the base and top of each box, and 1x4 plates/bricks for the side walls (as needed depending on the height).
Step 3: Use the Sugru
- Use scissors to open the pack of Sugru and peel it out of the wrapper.
- Mold the Sugru around the end of the cable/coupler as pictured. Try to spread it out evenly, but the exact thickness on each side will depend on the spacing relative to your LEGO structure (i.e. you might need more on the top and bottom instead of the sides, or vice versa). Also try to get some Sugru along the front and back edges of the connector, to help hold it in place better when it gets pushed/pulled on.
- Re-assemble your LEGO enclosure, and this time tightly pack your Sugru-enclosed cable inside. Make sure to press all the bricks together firmly.
- Take an end-on look at the connector to make sure the Sugru is filling up all the gaps between the cable and the LEGOs. If there are large gaps, your panel mount might be loose in the end. If necessary, try adding more Sugru, or re-designing your LEGO enclosure to have a tighter fit.
- Repeat as needed for each additional connector.
Step 4: Bonus Step: Power Switch
Making a power switch isn't much different from making the panel mount connectors. The only difference is that you'll need to solder some sort jumper wires onto the terminals on the back of the switch, so you can easily access them from inside the case. The rest of the steps are the same - do a dry run with LEGOs to build an enclosure for the switch, then seal it in with Sugru.
I used heat-shrink tubing to seal up my soldered connections, which you can shrink using a hair dryer. Electrical tape will also work just as well.
Step 5: Bonus Step: Wiring the Power Switch
- Cut your power cable in half. If your cable is obnoxiously long for fitting inside your case, you can trim some length out of the middle. You can see in the pictures above that I trimmed my 6-foot cable down to a more reasonable length.
- Your power cable has two smaller wires inside it: V+ and ground. Peel the cut ends of the cable apart and strip some insulation off to expose the wires.
- Uh oh! I was hoping for additional layers of colored insulation on the inside, to tell me which wire was V+ and which one was ground (usually red and black, respectively). No such luck, as both the wires were black. But no worries - you can use a multimeter in continuity-test mode to check which wire is connected to the outside of the barrel jack, and which one is connected to the center pin. Use a multimeter to do this for both halves of the power cable (this also isn't a "how to use a multimeter" tutorial - but if you're having trouble, message me or leave a comment).
- You'll need to know whether your DC adapter is center-positive or center-negative. Center-positive is more common, so if you're not sure, that's probably your safest bet - but it's a good idea to find out for sure, so you don't fry your whole project!
- Twist the two ground wires together. In my case, with a center-positive barrel jack, those are the wires connected to the outer shells. If you're using heat-shrink tubing, slide some onto the wire BEFORE you twist them together.
- Twist the two V+ wires onto the two jumper wires you soldered to the power switch earlier, as pictured. Again, remember to slide the heat-shrink tubing on first.
- Solder the wires together and shrink on the heat-shrink tubing, and you're all set! You should now have a working power switch, and you won't need to unplug the barrel jack connector to turn things off.
- Important: if you're using a Raspberry Pi, remember that you can corrupt the SD card by suddenly cutting the power. Always properly shut down your Pi with a command like sudo halt before you turn off the power switch (question for the RPi/Linux experts out there - what's the difference between sudo halt and sudo shutdown -h now? I've seen both).
Step 6: Let the Sugru Sit for 24 Hours
Be patient! Sugru takes 24 hours to harden completely. You don't want to start plugging things in and deform the ports while the Sugru is still soft. Let your creations sit out overnight.
Step 7: Build Your Case
Now for the really fun part - building the actual case! Your panel mount connectors should be all ready to go, so it's mostly a matter of figuring out cable management and fitting all the components nicely in the inside of the case, and aesthetics on the outside of the case. You might want to make a diagram first to help you figure out how everything will fit together. Again, I've provided a diagram in case you're following my build exactly, but you'll probably need to adjust this part for your project.
Here you can see my approach: on the outside, I wanted four front-facing USB ports along with the power switch for easy access, and then the HDMI and barrel jack on the back of the case (similar to what you'd find on a regular game console, DVD player etc). Inside, I have the Raspberry Pi, USB hub, wireless remote, and a perf board (I switched over from the solderless version, didn't want things falling apart inside the case).
There is certainly room for improvement in the future - particularly with cable management inside the case. Here's an open question for the electronics gurus out there, because I don't know much about digital data transmission: can cutting up a USB or HDMI cable and re-soldering it using thinner, more flexible wires (e.g., standard 22 AWG stranded hookup wire) mess things up? The stiffness of the USB and HDMI cables was a big limiting factor, but I have no idea if those cables are specially designed, and a sloppy solder joint or wire with different resistivity could prevent them from working properly. Any insight you can provide in the comments would be much appreciated!
One last thing to consider when designing you case is easy access to the inside, in case you need to debug or change something. My windows allow me to access the Pi's SD card, but that's about it. If something didn't work on my first boot-up, I would have had to take off the roof to double check connections. Building in hinges for the roof might have been a better decision, but luckily for me everything worked on the first try.
Step 8: Plug It In!
Much better! I now have a stylish case that doesn't look so out of place in the TV cabinet, right alongside the Wii, DVD player, and cable box. Plug everything in and fire it up for a test run. If something doesn't work, you'll have to go back inside the case and double check all the connections.
As always, if you have your own variation or build to show off, or some suggestions for improvements on the process, please leave a comment!
We have a be nice policy.
Please be positive and constructive.