Wednesday, October 7, 2015

Arduino Driven Current Activated Power Controller

I like things to be easy, and I would really like it if the shop-vac connected to my miter saw box (or router or table saw if I've moved it) would simply turn on when I cut something.  It would definitely get used a lot more often if it happened automatically, cutting down on the amount of dust in the garage and my lungs.  There are existing products that solve this problem like the i-socket Autoswitch, but I decided it might be fun to try and build one myself with an Arduino.  So I did :)

Parts list:
1x Arduino (I used a Nano)
1x 30 amp ACS712 Current Sensor
1x relay.  I used a 30 amp relay just to be safe.
1x project box, I used a fairly large one to make wiring easier.
2x modular power outlets, I bought a 12 pack.
1x modular receptable (like you generally see on a computer power supply)
1x USB Power Adapter (I used an old iPhone charger), or something like this
1x Pack of terminal connectors
1x 16x2 LCD, with an i2c adapter (I used a version from ebay/china)
1x 1x4 LCD button (I used a version from ebay/china)
Romex electrical wire, I used 12 gauge I had lying around but for a 15amp circuit 14gauge is fine.

Finished product:

For the assembly I took my dremel and cut holes in the sides of the box, then I used the dremel to trim the "ears" on the outlets because they were a little too long to snap in to place.

Then I fit each of the power outlets and receptacle in to the box, and ran the eletrical wire.  Here's a drawing of how I ran the electrical in the box.



Then I did a thorough "walk through" of the power to make sure everything was connected properly, nothing was touching anything it shouldn't, etc. and made sure I wasn't going to set the house on fire when I plugged it in.  Then I connected the Arduino to the ACS712 and the relay, wrote a basic sketch to turn the relay on and off and uploaded it to the Arduino.  The relay toggled on and off as expected, so all I had to do was figure out how to the current sensor.

I ended up using some example code from a thread on SparkFun to read the current going through the ACS712, and then basic logic to enable the shop vac when the amount of current exceeds the set limit, and turn it off (after a configurable delay) when there is no current.   The sketch is available here.  If you don't want to use an LCD or the membrane buttons you can carve that logic out of the code.  The top line of the LCD displays the current amount of amperage, the configured / trip current, and the current state of the mode button which toggles buttons 3 & 4 from changing the current limit to the sleep timer.  The bottom line displays the sleep time, the override state, and pwr which is the relay state.

The ugly insides.

What would I do differently?
I'd use stranded wire to make the wiring easier
I'd figure out how to better mount stuff in the box so it looked good
Use a different power supply, I just ordered this and this to see what works best.

Saturday, August 29, 2015

Custom Kitchen Pantry Barn Doors

As part of our kitchen model (becoming house renovation) we decided our kitchen needed a dedicated pantry, and the best place to build one was where we generally had a mess of piled food and kitchen appliances, or the "bar" as we called it.  Also, because we suck at taking before pictures, pretend this is a before picture and there's no door in it :p
Normal doors wouldn't work with the space we had, so it was folding doors or barn doors.  We immediately ruled out folding doors and after some research we decided on a simple barn door look.  We planned to build it with framing lumber from lowes, with the sides being 2x6, the top and bottom 2x8, and the center pannels 1x6.

The opening is 61.5" wide and we wanted the doors to overlap by an inch on each side, so we made each door 32" wide.  We didn't have an extra 64" of space to the left to open the doors so we opted to make it so only one door could be open at a time.  This will make more sense when you see the final pictures below.  We bought the hardware from ebay without a track, and then bought a 100" piece of steel from a local mill.  We also decided to make our own door handles, so we did that as well.  We totally winged it, we sat on the floor in the hardware store and pieced it together to see what size we liked.


So, parts list:
2x 2" x 6" x 96" whitewood board - $4/ea
1x 2" x 8" x 96" whitewood board - used scrap we already had
8x 1" x 6" x 96" whitewood board - $6/ea
1x 3/8" x 1.5" steel bar - $20
Barn Door Hardware - $119 shipped

Door Handles (these are not the exact items we bought, but are similar):
2x 6" 1/2" steel pipe
2x 1/2" elbow
2x 1/2" floor flange
Door Handle Hardware: $35

Rustoleum white primer: $5
Rustoleum hammered black: $5

We started out by cutting the pieces for the frame of the door to length, then used a router with a 3/8" rabbet bit to cut a 3/4" deep, and 3/8" wide lip all the way around the inside of the door frame for the 1" x 6" panels to sit in.  The frame is held together using Kreg pocket screws.

The assembled frames (I didn't take a picture of the rabbet'd back side):

Next up we cut the center panels to length, and because 4x5.5 = 22, and our center panel needed to be 20" wide we used our table saw to rip 1" off of 2 of the 1x6 boards (we put these on the outside).

Here's a quick test fit of the doors, with the panels temporarily fitted.

At this point we decided which door was left and right and which was the top and bottom of each, based on how well they fit together.  Then we cut half an inch off the bottom of the doors because they were going to be a tad bit too tall for the overhead piece to the top right.

Once we were happy with the fit we started the finishing process.  We're a fan of the weathered look, and a simple way to get that is by mixing steel wool #0000 and vinegar in a container and wait a few days.  Then we applied the resulting mixture to several wood scraps so we could try different combinations of vinegar and stain.  We were planning to stain the doors after the vinegar solution, but ultimately we settled on two coats of the vinegar solution followed by several coats of satin polyurethane.

As usual we didn't take pictures of the sanding and staining process, but here's a breakdown.

  1. Sand the doors so that everything fit nicely and there were no high spots.  We started with a belt sander where more material needed to be removed (I don't yet have a planer) and then moved to a random orbital to get a finer finish.
  2. We gave it a rough / aged look by beating them up a bit.  We used a 3' piece of chain, and then proceeded to drop tools, hit the doors with hammers, poke them with screws, etc.  
  3. "paint" the doors with water to bring up all the rough bits
  4. Sand the doors, then repeat with water and sanding a few times.
  5. Coat the doors with the vinegar mixture, wait a day and apply a second coat.
  6. Lightly sand the doors with 220 grit
  7. Apply 4 coats of satin poly, hand sanding with 400 grit between coats.  The resulting finish is incredibly smooth.
Once we had everything stained I glued the center panels together (I didn't use any screws) so they wouldn't warp over time.

We only had 2x 24" clamps so I used a ratcheting strap to help hold the middle together, and then glued the other panel together a few hours later.  Because of this I went and bought more clamps so I don't run in to this problem again.

Then I fit the center panel in to the door and attached it using 1.5" brads from an 18ga brad nailer, spaced about 8" apart.  

We cleaned the handle hardware with mineral spirits and then used Rustoleum primer and hammered black paint.  We used the same paint on the barn door hardware (track included).

I installed the 100" long steel bar by myself, it was a bit tricky but not too bad.  I figured out where the first bolt would go and then held the bar with one hand and the drill with the other (after drilling a pilot hole in the stud).  Once the first lag bolt was installed I used a level and then inserted the 2nd through 7th lags.  With the track up I shimmed the bottom of each door (you can see them in the picture) until I had them sitting where I wanted them, hung the hardware on the track, drilled pilot holes in the door and installed the hardware.  Then I removed the shims.  This allowed me to get the doors exactly where I wanted them.  I stood on the stool to attach the hangers to the doors (pre-drilling the holes).

Once the doors were hung we installed the handles and then did some touch up painting on the screws:

And the final look:



To see what we did for shelving/lighting, see Arduino Controlled LED Pantry Lighting

Arduino Controlled Automatic LED Pantry Lighting

We recently started a pantry project, and having just finished the new barn doors we needed to install the shelving and Arduino controlled lighting.

Parts List:
1x Arduino (I used a Nano I had lying around)
1x relay
1x reed switch
3x LED lighting
1x 1x8 DC splitter
1x 10pack DC pigtails
1x 10 amp power supply
1x 5pack 4' DC extensions
1x project box


I built an Arduino controller with a reed switch to know when the door are open/closed, and a relay to turn the lights on and off based on the reed switch  Testing the set up:

And the final set up wired in place:  
  • The wire coming out of the right of the box on the far right is the output from the power supply
  • The wire coming out of the right (middle) of the box is the relay-controlled power supply output.  This feeds a 1->8 DC splitter, which feeds the lights.
  • The wire coming out of the left side of the box goes to the reed switch which tells the arduino when the doors are open or closed.  


I wrote a 10 line sketch that checks the state of the reed switch and turns the relay on or off based on the state, pausing for 100ms between loops.  It doesn't even remember the state, it just sets the output pin to the relay either HIGH or LOW 10 times/second.

Now when you open the doors the lights turn on, and when you close them they turn off.  No light switch! :)

Here's what the lighting looks like in the pantry.
Notes:

  1. Only one door is on the track right now, and we're waiting for the new flooring before installing the lower portion of the pantry:
  2. the 3rd shelf from the top (second from the bottom) is slightly more yellow than the other 3 shelves.  All 3 reels of lighting were labeled the same warm white but one is definitely not the same color.  I ordered another reel and will replace it when it gets here.


Related posts: