Friday, July 22, 2016

Custom Stairway + Hallway Lighting Project - Part 7 - Done. For Now.

The last 6 weeks have been rough on my time and health and stuff has taken far longer to get done, however, I've finally finished the project (or at least as finished as it can be for now).

A fair amount of fine tuning of the programming has occurred.  I found that the dimming was taking far longer than it should, so long that you could see each step down of the PWM signal.  I finally tracked this down to the debug logging I had in place.  It turns out that writing to the serial port is extremely expensive.  It could take upwards of 3-4ms to write out a line to the serial port.  Multiplying that out, some of the code was taking 40 or 50 ms per loop. (compared to my expectation of it taking a total of < 5ms to do all the checking and calculations and taking actions).  Once I removed the debug code, the fading out was much better.

I also added code to make the lights dimmer based on the ambient light of the sensors at the time that the lights were tripped.  The darker it is in the room the dimmer the lights are.  I'm still not totally settled on the lowest level of light and where the trigger levels are, but it's much closer now than it was before.

The next physical step in my work was to cut the channels in the drywall and run the power.  This necessitated a bunch of crawling around in my attic.  I'm not a fan of attics normally and I'm less so this one.  All of the HVAC runs around the attic and it makes moving from point A to point B annoying.  I used my oscillating saw to do the drywall cuts and it went pretty well.



I put some holes in the back of the aluminum channels so that I could screw them into the studs.  I did this because, like all wooden homes, there are slight variances in the wall.  It isn't perfectly straight and this would bend the channel to match the wall.  I also had to add some bracing at both ends where there were no studs.  I took a couple of small pieces of plywood and slide them in through the hole from the channel and screw them into the drywall.  It was a fun feat to do so without hurting myself or the wall.  This was done down the hall, below is the picture of just 1 half of it.




Once I got the channels in, I installed the lighting and tested it out to make sure that was all wired up right.  Then I puttied all the holes and sanded them.




And finally it was painted.


Next up was the sensors.  These were of a slightly different construction than the ones for the stairs.  Largely because you could see them and because they used PIR (Passive Infrared) sensors instead of Active Infrared sensors.  After search around I settled on using Christmas ornament shells that you could get from the local craft store (my wife's idea).

I used a step drill bit to drill out the hole for the sensor.  The picture doesn't show it, but I also cut that tab off then painted it.



For reasons I can't begin to explain, I forgot to take a picture of the finished inside of the sensor once the pcb and photo resistor was installed, but I did take a picture of the outside.



It turned out pretty well I think.



No comments:

Post a Comment