Saturday, March 28, 2009

Using a Junction Box for an Arduino Enclosure

Soon after my prototype circuit was running on the bench, I began wondering what could I put this in? I did some searches, and other than an outrageously priced recycled plastic soap container, I couldn't really find anything being marketed to the Arduino community as a practical enclosure. I looked at the other things out there like Pelican boxes, and then one day I was at the hardware store and saw some standard outdoor electrical boxes. I ran back out to my car and grabbed my Freeduino board and the harness kit from NKC Electronics.
I was happy to find that a standard metal outdoor junction box was adequately sized. and a square PVC box fit the chassis plate nicely too. I had already realized with the other things that I had considered that an enclosure for my project would cost nearly as much, or even more, than my precious Arduino itself. If you go to a large building supplies store you can get these boxes for under $10.Of course you don't actually get a finished enclosure for under $10. You've got to put a top on it. There are lots of options there. The fancy clear plastic shielded weatherproof outlet cover will set you back as much as an Arduino board itself. I settled on a standard outlet cover that had a nice rectangular hole in it that whispered "put the LCD here" when I saw it. I think it cost about $8. When I got it home I found that the metal plates for the face/switch/outlet mounting on the metal box made getting the Arduino board inside very hard. Additionally the rectangular hole in the cover was about an 1/8" too short on the long dimension, while being about a 1/4" wider than the LCD on the narrow dimension.

OK now to see how much work modifications take...

The first thing I tackled was cutting down the bracket inside the enclosure so that the Arduino board would easily fit. At first I just thought I had to make room for the USB connector as you can notice in the photograph, then I realized that the LCD shield stacked on top would need even more clearance. I carefully left the four corner tapped holes while cutting back to about the middle of the line connecting the threaded holes. On one side I took a little more off by angling the corner, the picture is a little fuzzy but you can see it.
Also notice in the photo to the right that the conduit connector in the housing ended up hitting the USB/Serial connector and had to be ground down a little bit to provide proper clearance. I realized that I have to add another shield for a DS1307 clock circuit so I'll probably have to take the serial connector off of my installed board - a Freeduino serial v2.0 kit upgraded with a 328.
It turned out that the LCD shield had to be modified by lopping off the corners of one end where there were no traces or routes, while still keeping the four mounting holes on the shield. A few passes with the file to take a little extra off the box and I felt like I could get the LCD in the enclosure while it was on the Arduino and also mounted to the top - which constrains the angle one can use to insert the boards.

A rotary tool and file were used to notch one end of the top plate so that the LCD would fit. The trim pot for the backlight sticks up quite a bit on the shield so the plate needed to be drilled out both for clearance and access to the pot screw. Next I took a piece of paper and put it on top of the LCD shield buttons and made little marks where the buttons were. I then attempted mark the mounting hole pattern of the shield on the underside of the top by holding the shield in position and inserting a guide pin through each hole and striking it with a hammer to leave a mark at the desired spot. Using these spots as reference points I now transfered the LCD button pattern and used a drill press to drill out the holes. I'm still thinking that I'll take a small screw driver or stick or something to push the buttons through the holes: not the most user friendly option. Perhaps something could be put in the holes to provide a tactile surface....

Being an idiot and not thinking about what I would need, I had ignored several opportunities in the last week to buy a few standoffs, so now I needed to fabricate some. Fortunately I found some 1/4" aluminum rod, so I cut off a couple inches, mounted it in a vice on the drill press and bored it out for a #6x32 screw. I happened to find a couple suitable screw in my miscelaneous screw bin left over from when my father worked at the Stanford linear accelerator back in the '60s! My hole stayed pretty well centered and I tapped it out, grinding my tap down a little on the tip to get a little better bottom thread. With an inch or so tapped out, The LCD mounting points on the cover at the bottom end (visible in the photo above) ended up being in a transitional area where a ridge in the molding prevented mounting a standoff, so once again the rotary tool was used to grind down the area so that a proper mounting could be established.

I carefully measured the distance from the top plate to the top of the LCD board, which was different at each end because of the grinding, and cut the desired standoff length from my short length of threaded rod. Tapping it out a little deeper after cutting off the first two pieces. The spring hinge on the top accidentally slammed shut while I was doing a test fitting and I ended up loosing (only) one of the standoffs and had to make another one after searching for 10 minutes. I screwed the standoffs onto the LCD module, and put it on the upside down cover plate and experienced one of those very short moments of satisfaction in the material world. The button holes ended up pretty close but slightly skewed, and the hole for the reset button on the far end had to be enlarged a little, not too bad for a prototype. I mixed up a little epoxy and seated the standoffs in the epoxy while they were still attached to the LCD shield to maintain their alignment. The next morning I mounted the Freeduino board to the LCD shield and fit it into the box. It only goes in one way, and I have to be a little careful, but it seems like it will work fine.

Total modifications and fabrication took about 4 hours. I haven't mounted the finished project with wires attached yet, but if your time is cheap, I'll tenatively give this a enclosure a good recommendation to anyone else who wants to try using it. It's relatively inexpensive, and uses commonly available parts.
Tools used:
  • Rotary tool with cutoff disk
  • drill press & drills,
  • 1" mill file, hack saw,
  • #6x32 tap, guide pin, hammer.
  • Outdoor Metal Junction box (1/2" pipe thread connections)
  • Weatherproof Cover Plate
  • 4 6x32 3/8" machine screws,
  • 1.5"x1/4" dia. aluminum rod, epoxy.

No comments:

Post a Comment