Monday, October 26, 2015

Custom Stairway + Hallway Lighting Project - Part 6 (Milestone!)

My parents came into town this past weekend though only for a short time.  They had a wedding to go to in a city about 2 hours away.  They were here Saturday Night through this morning.  That said, Sunday my father and I made great progress on the cabling and I finally have finished results for the first segment of the house: the stairs.  That said, I'm really sore today.  Spent alot of time contorting myself around the furnace closet to pull and run wires.  Thankfully only minor scrapes and bruises were had.

Before they got here, I needed to get the rails up.  To get the rails up I needed to put ends on both the Cat5 and the power wires.  This was a mostly uneventful affair.  I am using XT60 polarized terminals for the power.  Normally these things are used for RC cars/planes battery connections, but their ratings make them ideal for this application as well.  The only hard part about this is getting 16 gauge wire and connectors to hold them hot enough to flow solder, but not so hot as to melt the wires and or the connectors is a pain.  But overall it looks pretty good.


I used a standard keystone jack for the networking.  Between this and the XT60, getting the rail off the wall is pretty easy.  I did offset the connectors by about 1" in length so that only 1 connector would need to come out of the hole in the wall at a time.


The first order of business when my father and I started was to cut a hole in the wall of the HVAC room.  The nice thing is that this room is unfinished (seriously even the mudding is terrible, they didn't bother to sand or anything).  I used my Black and Decker oscillating saw to do the cuts.  That has to be one of my favorite tools.  It cuts drywall like butter and for the most part is clean cuts if you are careful. I forgot to take a picture after we took this out, but it was an empty space with studs, so you probably can imagine that (or maybe not).


Initially the plan was to use my 12" long 5/16" bit to drill down, but we figured out that with the studs and the floor joists that was just too short.  We ended up getting a 9/16" 36" boring bit.  A little costly, but it worked like a charm.  We got the wires fished and ends put on them. The hole in the wall is just a little bigger than the keystone, but small enough that the end of the rail hides it entirely.


I needed power in the closet so we pulled it in from an outlet on the other side of the wall.  Of course that was on the other side of the wall from where everything else was.  We used wire molding to get it over to the other side.  There is a drain near where the outlet ended up (about 3' below it), so we ended up using a GFCI outlet, just in case.  Normally this stuff is stick on, but we used some screws into the studs to re-enforce it.  The space on the left of the room is only about 12" wide.  Lots of contorting around to get back there.



We also ran some molding to carry the cat 5 and power wires from the wall over to the box.


And then we hung the box.  2 screws into a stud and 2 into metal drywall anchors.  I do plan to put some Velcro wraps around the cables to clean them up some.  I also need to print out cable labels too.


And finally. Let there be light....



We finished late and initially the bottom stairs sensors weren't functioning.  Quick diagnosis showed that the values were all over the place as if the pins were floating (not connected).  But girl child was needing to go to bed, so it waited until this morning.  I found that the connector at the end of the cable in the closet had 2 of the wires switched.  (specifically +5V and the input for the resistor.  Thankfully that specific configuration couldn't have hurt anything, but it would make everything crazy unstable.

So what's next?  Well there is some fine tune programming that needs to happen.  I need to adjust the light sensor levels so that the lights don't turn on during the day and also program the logic to adjust the max light level based on the initial light levels. (so the brigher it is in the room, the the brighter the lights are.  When it's really dark and your eyes are used to it being dark full power is too bright.

Once that is done then it will be time to plan out the details for the other 2 hallways.  I have the general plans of course, but I need to figure out exact measurements so I can buy the lights and channels.  I also still need to pick up a couple more photo resistors and PIR sensors.

Friday, October 23, 2015

Custom Stairway + Hallway Lighting Project - Part 5

It has taken me almost 2 weeks to get through the next steps of the project.  I spent an hour or 2 most afternoons/evenings working on the smaller of the 2 hand rails.  A lot of that time was just spent figuring out how to approach it.

There were several problems to solve.  First, how to route the path into the wood to hold the aluminum channel.  Second, how to get the wires through wood.  the power wires only needed to be at one end, but due to how my walls are laid out I needed to run the sensor wires the entire length of the wood.

I started with drilling the access holes to bring power into the rail.  These holes were drilled with a 5/16" bit and a hand drill.  Overall I ended up coming very close to my target.  On the right I added some red lines to give you a general idea of where the holes were drilled.  Keep in mind I had to drill off center so that I'd miss the area where the holes were drilled for the brackets. 





My approach for this rail was to use a 1/4" routing bit on the routing table.  I drew up lines on where I wanted the cuts to go.  For some reason I didn't take a picture directly after this step, but here is what it looked like right before.


Here you can see part of the routing job and also the connecting hole.  Overall I was not pleased with the routing job.  There were quite a few problems with it.  The first of which was that the bit I had really wasn't designed for hogging out that much wood.  The second was that it was very difficult to measure exactly where to set the backplane when you can't see the thing you're routing out.  It was also difficult to control and that caused bumps.   That said it did work and all the less desirable look of it will be hidden under the aluminum channel.  You'll also note that in the center of the channel it is deeper than on the edges.  This is the place where the I/O lines will run.


So even though it didn't look great underneath it looked pretty good with the channel in.  This was a dry fit of course, there was a lot of work left to do.



I needed to figure out exactly what shape the sensor box was going to be. Below are all of the pieces (except a small capacitor) that needs to be dealt with.  The PCB actually goes into the black box there.  I knew I was going to use acrylic to make a box that I could paint and thus mostly hide.


Like the other side, I needed to drill holes into the sides of the rails to provide access to fish the lines through.  Additionally another hole needed to be drilled where the sensor box was going to go.


Here you can see the 2 horizontal holes and 1 vertical hole.  The very long horizontal hole was drilled with a 12" 5/16" bit.  I took a small 2x4 and put a 5/16" hole into it at the height I wanted using the drill press so it was exactly square.  I then clamped the 2x4 to the end of the rail to provide a guide so that the bit wouldn't drift over such a long distance.


I decided a good place to put the photoresistor was in the empty space of the IR sensor.  So I drilled a couple holes in the plastic and stuck it in.  Then I filled it with some silicon to insulate it.  (Though I'm thinking hot glue next time.)



Next up was the wonderful fun of wire fishing.  The holes I drilled were just 1 size bigger than the bare minimum, so pulling this stuff around corners was a challenge.  Even more so for the network cable as it is solid core with riser rated insulation, which makes it stiff.  I ended up having to shed the outer insulation at both ends to make the turns.  Not a huge deal, it's surrounded by 3/4" of wood, so it's pretty safe.


On the other end I had to bring in both power and the I/O cable.  I ended up using 1 line of power (which was pretty easy to move through by itself) to first pull the other line of power which also had I/O cables taped to it.


After the wires went in I went to building the acrylic box to house the sensors.  I also painted the sensors once with white spray paint.  The boxe's outside was sanding down so that it would take the paint better since I want it to be the same color as the rail.


Next up was to start cleaning this rail up so that it looks like it did before.  Using some Bondo (which I've never used before, but holy crap it stinks), I filled the 3 holes that aren't going to be used going forward and which can be readily and easily seen.




While waiting for the Bondo to cure, it was time to start getting the led strips into the channel which includes cutting one of them to that it will fit



After sanding the Bondo down to match the wood, I put on the first coat of paint (which would be a total of 4 coats, 2 on bottom half, 2 on top half.  All this work so far has marked the heck out of the rails.


Finally putting in the aluminum channel for near the last time.  It fits quite well.  I ended up using some black electrical tape on the back, not to adhere it to the channel, but because the back of the strip has metal contact points that I very much don't want to short.



And Finally this one is now done! (well almost still need to put ends on the wires before they go into the walls, but I am not going to do that until I determine how much slack I want there.




So after my adventures with the short rail I learned a few things to make the 2nd one go *much* faster and mostly easier. Two big changes with this one vs the other one.  The first is how I went about routing out the holes.  I purchased a top-bearing 1/2" router bit with a 1/4" cut depth.  I then got 2 pieces of square steel tubing and used those as the guide for the bearing.  Most this approach worked.  The worst part was that I expected the steel tubing to be straight.  That was not the case though as it tended to bow some.  The cuts were cleaner, but not perfect.

The second change was to route out the entire channel all the way from the first bracket to the last.  The reason is I still needed to get the wire all the way down and I had 2 brackets in the middle to deal with.



Like the other one, I did 2 levels of routing for the wires.  In the picture below, though its hard to tell.  I took the bearing off of the bit and cut under the wood.  This gave me most of a channel to run the wires in.  It wasn't quite enough, but that's ok.  The wood insert I'll be cutting to replace the wood I routed out can handle it.




Next using the same approach as last time I fished the wires through both ends.





I needed to replace the wood that I routed.  To do that I cut out a piece of poplar and then used the band saw to cut notches into it.  I then glued it into place and after letting it set, sanded it down to be flush with the rail.  The band saw cuts weren't the greatest, but they were close enough.  Once the channels are in, no one will be the wiser.  (except everyone who reads this, all 5 of you).


Time precluded me taking pictures of putting the channels in and soldering stuff, but here is the finished product.






At the same time I was doing the rails I had a few more modifications I thought I should make to the controller.  The first was to add a fuse to the 12V rail.  Since I'm sticking wires in the wall, even low voltage ones, I'd rather be safe than sorry.  I got fast blow glass fuses and stuck a 6 Amp one in.  Another thing was that the override button showed up.  This was a 12V LED latching vandal switch.  When pressed it would suspend all the I/O and simply turn the lights on full.  

While testing that though I found something odd.  The LED in the switch was on, but dimly.  This was odd because the LED doesn't share a circuit with the switching mechanism itself and I was only powering the micro controller via USB.  The 12V supply wasn't plugged in.  I realized that when the microcontroller is plugged into USB, the regulated 5V supply actually comes out of the voltage input line.  This was bad because neither the micro-controller nor USB is capable of driving the current that the 12V rail was supposed to support.  To that end I added 2 diodes to the system.  One on Vin on the microcontroller and one right after Gnd on the micro controller.  This way the controller can't accidentally try and power the 12v bus.



And here is the new schematics.


I also found a bug in the calculations for the distance sensor.  I forgot when I switched it to the new averaging method that I was initializing the base total with values at 100 for each.  The problem is that was skewing the average to 30-35" instead of what it really was which was usually 15-20".  Also needed to add the code to handle the switch.

Next up is finally seeing some results.  I need to put the rails back up at least for the weekend since my parents are in town, but I'm hoping my father will be able to help run the wires in the wall up into the HVAC room.  Then just plug everything in and turn it on and hope it doesn't explode.  (pretty sure it won't after all the testing, but...)

Sunday, October 4, 2015

Custom Stairway + Hallway Lighting Project - Part 4

Last week when I started to solder all the components together I realized I was short 1 MOSFET. I ordered 2 more and a cable I had also forgotten for the active IR sensor. It was supposed to show up on Tuesday, but once again in the last 2 weeks the USPS managed to lose my package in transit. (They also lost yet another package, so out of 6 packages, I've lost 3 for at least 2 days, one is still MIA after a week) In any case the MOSFETs showed up and it was time to add them to the shield.  I definitely show my inexperience soldering components to a pcb here with my bleh solder joints, but overall, it worked.



Now back to the box. The last case modification I needed to make was to add the USB port.  I took quite some time to find a cable that would work the way I wanted.  I ended up getting a mini-usb to usb and then a usb to a panel mount usb.  I ran the 18" of cables around the bottom of the box to keep them out of the way.




I then started to work from right to left on wiring the box.  In this case I wanted to get all the power supply wiring done.  I'm using a busbar that is rated for 100A, which is about 96A more than this entire system is likely to take at peak usage.  That said, it does make it pretty to hook stuff up.



So here at this point all the power supply wiring is done.  I learned a better way to crimp the power connectors about halfway through so the plastic didn't get mangled.  So some of them look terribad and the good ones are hidden by the controller.  Ah well.  The power cables for the controller are really larger than they need to be, but I really didn't have any smaller white or red wires to use.  it isn't terrible, just excessive.  The controller maxes out at around 400ma.  The white cable is 16ga and could carry 20x that over that short distance.


Finally it was time to start wiring up all the inputs.  I realized that I only needed 5 input keystones, so you'll note the missing one below.  I'm spray painting a blank black to fill it in so it there isn't a random hole in the box.


I updated the schematics to reflect that I removed one of the ports and also named all the wires for the controller with the colors of the wires.  This way I can use it to do any diagnosis.  I also tested each of the ports with the breadboard.  I found I had a couple things miss-wired on the mux, but overall most of it was right out of the starting gate.

I also tested the box under full load for the stairs for 1 hour and under a load with PWM at 3% for an hour.  I felt no discernible heat changes via the powersupply or MOSFET controlling that line, so hopefully it won't be any problem.



The next step is now to start working on modifying the stair rails and also to build the little boxes to house the sensors.  Of course I've tried not to make things look terrible with the box so far, the stair rails need to take a great deal more care in the modifications as they will be visible to people (whereas the box is going to be in a closet and rarely seen).