Mac Home Automation http://www.machomeautomation.com Macintosh Home Automation using XTension admin@machomeautomation.com admin@machomeautomation.com Copyright 2008 Mac Home Automation with XTension GeekLog Thu, 24 Jan 2008 04:23:51 -0800 en-gb MaxSonar sensor and XTension http://www.machomeautomation.com/article.php?story=MaxSonar http://www.machomeautomation.com/article.php?story=MaxSonar Mon, 21 Jan 2008 13:16:00 -0800 http://www.machomeautomation.com/article.php?story=MaxSonar#comments Hardware Reviews <p><a href="http://www.machomeautomation.com/links/portal.php?what=link&item=http://www.maxbotix.com/">MaxBotix</a> makes a series of very nice little sonar range finders that have found their way into my heart and from there into XTension 6. </p><div class="float-left"><img src="/extimg/ms/ms_hero.jpg"></div><p>They are tiny, inexpensive and come in a variety of beam widths. They require very little power at 2.5 to 5v so are easily powered even over longer distances just with another pair on a length of cat5. I can imagine a myriad of uses for home automation but my first project will be mounting one under each of our garage door openers to measure the length from it to the floor or to the top of the car. I can now tell if a car is actually present in the garage which is a much better indication of who is home and who just went out than trying to track garage door openings and closings. Since they are able to check the height of what is under them they can tell the difference between a car parked in the garage and say, my table saw left in the middle of a space.</p> <p>They cost around &#36;25 USD from one of my favorite provenders of such delightful stuff <a href="http://www.machomeautomation.com/links/portal.php?what=link&item=20080121133152245">SparkFun</a> a direct link to the proximity sensor category where you will find them for sale is <a href="http://www.machomeautomation.com/links/portal.php?what=link&item=20080121133620773">HERE</a> You may also find them elsewhere at robotics outfitters.</p><p>They have both a serial and PWM output for distance, but since the serial output is compatible with the RS232 interface on our USB/Serial interfaces we'll be using that. You have to keep an eye out for some small devices meant mostly for connecting to embedded chips or PIC type processors as they are often TTL level serial data which is not compatible with the regular usb dongles and requires either a special dongle or a level adaptor device, but it could still be done.</p><p>These are not motion sensors. Though they do respond very quickly XTension may apply (according to your settings) a lot of hysteresis to stop chattering and so they may not be good for things like telling you when you've pulled into the garage far enough. Just the second to read the data and turn on a light to tell you to stop members of my family would be half way through the back wall of the garage . They are for measuring the distance to something and they work up to only 6 inches from the device out to 255 inches but I've only really tested out to around 100 inches. If there are multiple different return paths, meaning more than one object of different heights in the beam, then they may bounce around between the multiple values so some thought to placement is necessary.</p><div><p>They come shipped in an antistatic bag and you will have to solder on the leads and find a way to mount them. setting them up though is about as simple as any diy project, if you own a soldering iron you can almost certainly get this working.</p></div><div><p>They are so tiny it's easy to find something to mount them in. I used one of these surface mount ethernet/phone jacks and it fits perfectly through the top with a little drilling and since I also own a crimp tool it was great to make simple cables for connecting it. But you can just use <a href="http://www.machomeautomation.com/links/portal.php?what=link&item=buttsplice">butt splices</a> and hard wire them in.</p></div><center><img src="/extimg/ms/ms_aspackaged.jpg"><img src="/extimg/ms/ms_side.jpg"><img src="/extimg/ms/ms_phonejack.jpg"></center>Next page to solder the connections...[page_break]<div><center><img src="/extimg/ms/ms_connections.jpg"></center><p>The board comes with a series of through holes that are very easy to solder to. Be careful if you're not used to that sort of thing as there are lots of tiny surface mount components on the boards and if you overheat them you might cause them to come undone. Even so I think you could easily do this with a &#36;10 radio shack soldering iron, nothing special required. Here's what mine looked like. The picture shows 2 connections to the ground pin as it is needed both for the power supply minus side and the data ground/return from the serial port. It's not actually necessary to connect both separately as long as they are connected somewhere. I only used both connected here when testing at my desk, once it was installed I had only 1 black wire from the sensor and connected the other end to both at the other end. In my picture the red line goes to the "Vcc" on the board which is the positive supply voltage. For a power supply I am using an old Sony 4.5v power supply for a walkman or something that I pulled out of the bottom of a box of such things. If you do that make sure to use a meter to find which side is the plus as if you hook it up backwards it will let the magic smoke out of the device. And lastly in my picture the blue wire is going to the serial output pin.</p></div><div class="picture-block"><div class="float-left"><img src="/extimg/ms/ms_wheretodrill.jpg"></div><p>Now you need to get it mounted in the case, or whatever you have chosen to mount it in. I dont have these exact measurements anymore but I centered it side to side and down from the top far enough to clear the board inside.</p></div><div class="picture-block"><div class="float-right"><img src="/extimg/ms/ms_afterdrilling.jpg"></div><p>a 5/8th inch forstner bit came pretty close to the size of the sensor.</p></div><div class="picture-block"><div class="float-left"><img src="/extimg/ms/ms_reaming.jpg"></div><p>But still needed to be cleaned up a bit with a reamer.</p></div><div class="picture-block"><div class="float-right"><img src="/extimg/ms/ms_testfit.jpg"></div><p>test fit until you get it to fit flush in the case</p></div><div class="picture-block"><div class="float-left"><img src="/extimg/ms/ms_glued.jpg"></div><p>finally a little hot glue to hold it in place as well as do some strain relief on he wires. Solder connections like that could break off just from the few times we open and close this until it's done.</p></div><div class="picture-block"><div class="float-right"><img src="/extimg/ms/ms_connected.jpg"></div><p> I picked 3 pins on the plug basically at random. For the final instal I ran the negative power and data ground together rather than in separate lines and that worked fine. I would make sure that in the cat5 or other cable that you run it in that you let the data ground be a pair with the data and run the 5+ line separately, but depending on the length it probably doesn't matter. I have run these probably 250 feet without any problem with the USB/Serial adaptor picking up the data stream.</p></div><div class="picture-block"><div class="float-left"><img src="/extimg/ms/ms_twoofthem.jpg"></div><p>Then close up the box and snap it shut. I actually made two of these for each of the garage bays.</p></div><div class="picture-block"><div class="float-right"><img src="/extimg/ms/ms_finished1.jpg"></div><p>lastly I crimped some connectors and foam taped them to the underside of the garage door opener.</p></div>Next page, on to the computer side of the connection...[page_break]<div class="picture-block"><div class="float-left"><img src="/extimg/ms/usb-serials.jpg"></div><p>At the computer side the negative/ground black wire must be connected to both the negative side of the power supply as well as pin 5 of the DB9 connector which is the data ground. The data output from the device needs to be connected to pin 2 of the DB9 connector which is the received data pin. Depending on your setup and the interface it may be necessary to short the ground also to the shield of the plug. Some experimentation might be necessary.</p><p>So the "Tx" labeled pin on the maxsonar gets connected to the "Rx" or Received Data pin on the adaptor which should be pin 2 on a DB9 RS232 plug. My setup is not very neat and tidy I'm afraid, someday those will all get strain relief and hoods, but for now you can see clearly that it's easy to connect, only 2 connections necessary to the computer. Here you can see both a 4 port adaptor from <a href="http://www.machomeautomation.com/links/portal.php?what=link&item=keyspan-home">Keyspan</a> and another from <a href="http://www.machomeautomation.com/links/portal.php?what=link&item=usbgear-serial">USBGear</a>.</p></div><div class="picture-block"><div class="float-right"><img src="/extimg/ms/ms_screenshot1.png"></div><p>Once you have the physical connection to the computer you need to setup the device in XTension. Visit the XTension Preferences window and select the "New Device" button to popup a window like this. Only 1 MaxSonar can be connected to an individual serial port so if you have more than one of them you will require more than one serial adaptor, but they are inexpensive now and you can connect a large number of them without difficulty so I don't think this is a serious limitation.</p><p>After selecting the serial port to which you attached it and giving the interface a name you'll also want to set the Hysteresis Buffer Size and Significant Change values. The Hysteresis value is like the gas gage in your car. You know the gas is bouncing around in there as you drive around, but the needle doesn't bounce up and down but moves only slowly. In my case in the garage I dont really need changes in value when I walk under it, only when something changes and stays changed so a value of 75 in my case means that it will take 2 or 3 seconds to notice a change. Setting this to lower values will make it respond faster but be more susceptible to bouncing around if there are odd errant readings. Under the hood this maintains a rolling buffer of the last 75 values and the value that is in the buffer the most is the one that is reported. As soon as a new value outnumbers any other values the new number is reported. The device itself sends readings constantly very quickly but they can bounce around quite a bit until a new reading settles in. The significant change is how much do you want it to change before it reports a value. If a value is right on the edge between say 10 and 11 inches it may bounce back and forth between the 2 constantly and you probably dont need that kind of accuracy anyway, so if you set the significant change to 2 or 3 it will only change the value of the unit in XTension when the change from the previous value is equal to or more than whatever you enter. It's good to filter out as much noise from this signal as possible. I have it set to 10 inches in the example as that is plenty to find out when a car pulls into or out of the garage, but enough that it doesn't fill my log with chatter when I'm just working in the garage on something.</p></div><div class="picture-block"><div class="float-left"><img src="/extimg/ms/ms_screenshot3.png"></div><p>Finally you need to create a unit in XTension to receive the measurements from the sonar. Create a new unit and set it's address to "A1" and it's interface to the name of the interface you created in the previous step. Also make sure that the "Powerline" radio button is selected and that the "Dimmable" checkbox is turned on to allow it to accept numbers as opposed to just on/off. You may also want to check the "ignore clicks in list" checkbox so that you dont accidently reset it to 0 by double clicking on it in the list. After saving the unit go back to the preferences and enable the new interface. You should see a message from the MaxSonar saying that it has connected and a few moments later depending on the Hysteresis value you have set it will report it's first measurement and set the value of the new unit you created.</p></div> http://www.machomeautomation.com/trackback.php?id=MaxSonar Child Proof X10 Capable Outlet Cover http://www.machomeautomation.com/article.php?story=childproof1 http://www.machomeautomation.com/article.php?story=childproof1 Tue, 24 Apr 2007 04:32:45 -0700 http://www.machomeautomation.com/article.php?story=childproof1#comments Hardware Reviews <p>As my son graduated from happily gurgling to himself wherever you set him down to actively seeking out trouble, I found myself without a good way to lock up all the X10 modules that were so perfectly laid out all over the house at his level. My house is now a fascinating collection of in-use covers and these things:</p><center><img width="220" height="325" src="http://www.machomeautomation.com/images/articles/childproof1_1.jpg" alt=""></center> <p>While there were several kinds of "in use" covers available just about everywhere here, only the local Lowes carried this particular model. It's fairly large and comes in a big blue box that looks like this:</p><center><img width="245" height="293" src="http://www.machomeautomation.com/images/articles/childproof1_2.jpg" alt=""></center><p>They are fairly expensive too at between &#36;6 and &#36;7 a piece. But they are actually very sturdy and I feel secure that he will not be able to get them open. They consist of a piece that replaces the outlet cover face plate which proves a slot on each side. Into that slide the 2 clamshell pieces which lock together at whatever height is necessary to hold all your gadgets.</p><center><img width="220" height="277" src="http://www.machomeautomation.com/images/articles/childproof1_3.jpg" alt=""></center><p>To get them open or closed you grab those plastic tabs with 2 fingers and pull which allows the pieces to slide apart and off the back piece. </p><p>So for only a few extra dollars I get to keep my X10 modules and my son gets to live safely with the knowledge that interesting things are being kept from him...</p> http://www.machomeautomation.com/trackback.php?id=childproof1 Doing More With Fewer Buttons: Trapping the Double Tap. http://www.machomeautomation.com/article.php?story=doubletap http://www.machomeautomation.com/article.php?story=doubletap Wed, 18 Apr 2007 18:39:44 -0700 http://www.machomeautomation.com/article.php?story=doubletap#comments AppleScript <b>Basic XTension Scripting: #1</b><p>There will come a time when you run out of buttons. On the main wall of my living room I already have 2 "stick-a-switches" running various scripts and controlling the scenes for my living room. There just aren't enough buttons on them to do all that I want. I could stick up a third one... but at some point we cross the line between useful and just silly.</p><p>For some of the buttons I have chosen to add some functionality if I press the button twice. It's very simple to do and works very well. This article outlines the idea</p><center><img width="400" height="180" src="http://www.machomeautomation.com/images/articles/doubletap_1.jpg" alt=""></center> <b>Case Study: My Living Room</b><p>There are lots of lights in my living room. When we're in there in the evening they are pretty much all on, but when we are just passing through, only a couple of the smaller CF bulbs remain on. Finally when it's time the kids were in bed it makes sense for me to be able to turn off all the lights (but those CF fill in bulbs) in a single place. Previous to this I had to hit the night preset button in the living room, hit the off button for the family room and the tv area in there, and turn off the kitchen lights. This was hardly a hardship as the various remotes for all these areas are within easy walking distance of each other, but none the less I set out to remedy this needless exercise with more automation!</p><p>The All Off and Night buttons in my living room both now sport a double tap feature. Hit the All Off button once and it's all the living room lights that are turned off. Hit the button a second time within a few seconds and the living room lights, the family room, tv room and kitchen lights are turned off as well.</p><p>To make this work you must have your remote on a separate address from your X10 modules. The original X10 way of controlling modules involves just putting the remote on the same address as the module and using a plugin transceiver to take the command from the wireless side and move it onto the powerline so the module can hear it. This makes sense if you don't have a computer, but once you take that step you can do so much more by separating the remotes from the X10 modules and controlling the modules instead from the ON/OFF scripts in an XTension unit devoted to the remote. There is a very long winded discussion on the philosophy of setting up units and remotes coming in the future, but for now I think it's enough to say that you get more capability by having separate XTension units for the remotes and the modules and putting the logic that controls the modules in the remotes ON/OFF scripts.</p><b>The "Time Delta" Verb:</b><p>In any script at any time you can find out how long it has been since any unit was last controlled. For a unit corresponding to a wireless (or wired) remote, thats the time since the last time someone pushed the button.</p><p>The XTension AppleScript Dictionary entry for the verb looks like this:</p><p><center><img width="499" height="57" src="http://www.machomeautomation.com/images/articles/doubletap_2.png" alt=""></center></p><p>You pass it the name of any unit (or in any version after 5.4 the name of a global script) and it will return the number of seconds that have passed since the unit was last controlled or changed state, or when the global script last ran. You can try it out from the command line in XTension by doing something like:</p><code><pre>write log time delta "the name of any unit"</pre></code><p>And you'll see the seconds written to the log window. </p><p>By looking at the Time Delta value in the appropriate script for that remote unit, we can figure out if the button is being pushed now for the first time in a while, or for the second time within a few seconds and take some different actions based on that information. </p><code><pre>if (time delta ThisUnit) is greater than 5 then --this is the first time in at least 5 seconds --that the button is being pushed. --run the single tap code turn off "My Living Room Lights"else --this code will run if the button was just pushed --a few seconds ago and is now being pushed --again, so do the double tap action here turn off "My Kitchen Lights" turn off "My Family Room Lights" turn off "My Office Lights" dim "My Hallway lights" to 50 --and however many more makes senseend if</pre></code><p>Put something like that in the ON or OFF script corresponding to whichever button you are using on your remote and you're setup for double tapping.</p><b>Decreasing Spousal Confusion:</b><p>The one thing that code doesn't do is look for repeats when holding down the button too long. My family tend to hold the buttons down until they see something happening and this is often long enough to make the script run twice. If you find that your spouse and family are always getting the double tap then you can also add a check to make sure it's not an immediate repeat. It might be enough to make sure that it's longer than 2 seconds, but less than 7 seconds by changing the code that checks the time to something like:</p><code><pre>if (time delta ThisUnit) is greater than 7 then --first time...else if (time delta ThisUnit) is greater than 2 then -- second tap code...end if</pre></code><p>In order to get the double tap with this code you will have to press the button, count 2 and press it again, but it's much more likely to operate properly for someone who holds the buttons down too long. If 2 seconds between button pushes tries your patience, try 1 and depending on the speed of your computer and the heavy handedness of your housemates that might be enough. Be prepared to experiment!</p><b>Double Push Required:</b><p>The other possibility that this opens up is requiring a double tap to do something important. On the remote that sits on my bedside table is a button that runs my going to bed script. This is a long script that sets up all the lights for bedtime, nightlights, turns off all the lights in the house, sets up the perimeter alarms and adjusts the thermostats for the nighttime. This is not a script I want to be run accidently during the day. I actually have some time checking in it that will prevent it from running except at or around the normal time I go to bed, but it is still possible for my 2 year old to get ahold of this remote at around the correct time and cause confusion in the house. The other buttons on it are not a problem, if he wants to flash the overhead light or the lamps in the room thats OK, I even encourage it ;) But running this script makes lights go off all over the house so that had to be locked out. The simplest solution is to not do anything when the button is pushed unless it's pushed twice. The code for this is very similar to what we've already done:</p><code><pre>if (time delta ThisUnit) is greater than 2 and (time delta ThisUnit) is less than 5 then execute script "Setup for bedtime"end if</pre></code><p>Thats all there is to it. The first time you hit the button the time delta is much greater than 5 so nothing happens, but if you press it again, between 2 seconds and 5 seconds later then the script will run. While I'm sure my son is capable of managing this, so far it's worked great to keep the button working for me, while keeping accidental goofing around with my remote from causing people to yell from the next room about the lights going out...</p> http://www.machomeautomation.com/trackback.php?id=doubletap Compact Florescent Bulbs and X10 (part 2) http://www.machomeautomation.com/article.php?story=CFL2 http://www.machomeautomation.com/article.php?story=CFL2 Wed, 04 Apr 2007 08:38:41 -0700 http://www.machomeautomation.com/article.php?story=CFL2#comments Hardware Reviews <p>This article is a continuation of the original <a href="/article.php?story=CFL1">Compact Florescent Bulbs and X10</a> article.</p><p>Using CFL bulbs with X10 and other home automation hardware can be prone to problems and expensive. Since they often dont want to work with the cheaper switches and modules. Without some modification some wont work at all. I've been using compact florescent bulbs with my system for several years and, just about every light in the house that is used for any length of time (meaning not closets and such) that I don't want to dim has been replaced with a CF bulb. All of them are controllable, reliably, with XTension. </p><center><img width="432" height="216" src="http://www.machomeautomation.com/images/articles/CFL2_1.jpg" alt=""></center> <b>Use Expensive Switches</b><p>The easiest way to control CF bulbs would be to purchase more expensive switches. Smarthome and leviton and all the bigger players make relay switches that can work with non-dimmable CF bulbs. I did have significant problems with earlier smarthome switches and CF bulbs. These were the older versions that still had an SCR as the switching method. Newer ones, and the less expensive "icon" branded switches have relays in them. So far I've had no trouble with these and the CF bulbs they seem to work fine. Just about any relay switch that also has a neutral connection should work just fine for CF bulbs.</p><b>Non-dimmable CF's on dimmers</b><p>This is potentially dangerous and so requires some forethought and testing on your part before you decide to do it. All non-dimmable CF bulbs that I have ever seen have printed quite clearly on them something to the effect of "NOT FOR USE WITH DIMMERS" but in many cases you actually can put them on a dim capable module as long as you take care never to actually send a dim to that unit. (In XTension make sure dimmable is not checked in the unit setup dialog and that there are no other ways for a dim to get onto the power line like via remotes and transceivers) Even when just switching on and off these dimmable modules do not act like a simple switch or relay. The power is still getting cut up by the SCR that does the switching and dimming. So turning a lamp module on is NOT the same as turning an appliance module on as far as the quality of power that comes out the other end. Some CF ballasts cannot cope with this chopped up power and will overheat, catch fire, and burn out much quicker if used that way. Others don't seem to mind at all. You must test any lamps that you intend to try and control this way. I have found several kinds that simply cannot be used on a dimmer at all. They buzz, they get very hot very quickly, or the flicker and wont stay lit. It is usually obvious very quickly if something is wrong, but there are new ballast designs coming out all the time and I have not tried to test them all or to keep on top of what works and what doesn't. I will return your attention to what I said in part 1 of this article and repeat "you get what you pay for" cheap bulbs have cheap, less forgiving ballasts. More expensive bulbs tend to handle it better, but it's no guarantee. If it makes you nervous to think of the extra heat generated in the ballast because of the malformed power, then dont even consider doing this.</p><b>Lamp Modules</b><p>There seem to be many brands of CF bulbs that are compatible with Lamp Modules for control. I use many Phillips Marathon CF bulbs on lamp modules. It's a good option where the CA-THUNK of an appliance module would be a problem. I have 3 such lamps in my bedroom where I can turn them off without waking my wife. Again you must test any bulb on the lamp module before walking away to make sure that you satisfy yourself that it is operating correctly and not going to cause a fire hazard. I can't give you a list of things to look for more so than I already have above. With the lights I've got this appears so far to be enough, but lamps change, ballast designs change, lamp modules might even change but this article will likely stay the same. What was OK for me a year ago might not be enough to ensure your safety now. So don't do it if there is any question.<p><p> CF bulbs on either a lamp module or an appliance module will flicker a bit. The modules send little pulses of current through the load to see if you've turned it on manually. They call this "local sense" so that you can have local control of the lamp in addition to the computer. With a regular bulb this isn't enough to warm the filament much, but with a CF bulb it can be enough to make them flash every second or so. Every bulb seems to be different in how much they flicker or if they flicker at all. The Phillips bulbs in my bedroom do it just ever so slightly, if the room is totally dark and my eyes are adjusted and I stare at the light from bed then I can see that it is doing it. Otherwise it's not distracting. In the bathroom I've got another smaller bulb in a lamp and it flickers quite bright enough to see after dark, and when you first turn it off while the bulb is hot it flickers probably at half brightness of the bulb for a while as it cools down. This makes sense really, the hot tube has less resistance in it, and the mercury in it is still vaporized to increase the brightness and so will be brighter with the tiny current pulse going through it. As it cools the flashing goes almost away. Initially I worried for the life of the lamp doing this all the time, but these bulbs have all been in service for years without any noticeable reduction in output or any other signs of burning out, so I'm no longer concerned about it.</p><p>I have never run into a bulb that would not work with the local sense on a lamp module, meaning that even with the funky ballast and all it would still allow you to turn the lamp off and back on from the lamp itself to get the module to turn on. The same is not true of appliance modules though.</p><p>I must re-iterate that you must take pains to be sure that no dim commands can be sent to the lamp module. While a ballast may cope with the chopped waveform of power at the "ON" setting, it may not be able to when dimmed. Make sure that if you're controlling these through XTension that you do not have dimmable or simulated turned on. Only send them on and offs. In addition make sure that no other devices, remote controls, plug in controllers or what have you can send a dim on that address. It's not enough to just not have it setup to do it, if that address is available on a plug in controller then someday your cat or your kid, or the neighbors kid will hit the correct combination of buttons and burn your house down. So be sure they are on a house code or an address range that nobody can transmit to but XTension. This is not necessary, of course, if you're using a dimmable bulb...</p><b>Appliance Modules</b><p>If the lamp doesn't like being on a lamp module, then it may need to be put on an appliance module. So far I have never found a bulb that didn't like an appliance module as far as it's ballast is concerned. The biggest problem with them is that the auto sense can make it impossible to turn them off. They just turn themselves back on after a moment. This is funny for a while... It is possible to easily modify the modules to disable the local sense and keep them from doing this. This is actually the only module hack that I recommend doing. I've experimented with many different things documented out on the internet, (like the local dimming hack for the wall switch) and most others don't turn out to be a good idea. If you want to control CF bulbs with an appliance module you will eventually run into a bulb that needs this done. It involves taking the module apart and snipping the lead to a single diode. I've done it to dozens of them here, it's easy to do and it's easy to find the correct part. Interestingly it doesn't necessarily disable the local sense. I can still manually control almost all of these lamps even after performing this mod, but they just dont turn themselves back on after doing it. The best documentation I've found on the web is at <a href="http://www.geocities.com/ido_bartana/Modifying_Appliance_module.htm#Defeating%20local%20current%20sensing">Ido Bartana's X10 Website</a> though I'll try to take some pictures of my own doing it here if anybody is interested.</p><b>Wall Switches</b><p>It turns out that you can control some kinds of CF bulbs with regular X10 wall switches. The secret is that you need at least one regular light bulb on the same switch. This works great for large arrays of lights but not so well for single lamps. A wall switch has to run a small current through the load all the time to power itself as they do not have a neutral wire. This is fine with a regular bulb, but doesn't work at all with an electronic ballast. My kitchen is an array of 8 recessed lights. For the last 2 years or so it's been on a 4 way regular X10 multi-way wall switch with 7 phillips 30 watt CF bulbs and a single regular 75 watt bulb. It has also been completely reliable and none of the lamps seem to mind being there. I did loose the 75 watt bulb once and before I could replace the the array was flashing on and off like crazy and could not be controlled by the computer at all, but as soon as the regular bulb was replaced it is again working fine. I have another long chain of 6 recessed lamps in the family room that are controlled via a regular wall switch. 5 of them are 85 watt equivalent flood lamps and the last one is a regular 65 watt PAR bulb. Remember that you must test any bulbs in this configuration, the same warnings hold for these SCR based switches as do the lamp modules. But a lamp module always has a neutral connection through the plug so doesn't need to actually power itself by sending a current through the lamp like a wall switch does. The same warnings about not accidently sending dimms to the module also apply, unless you have dimmable CF bulbs.</p><p>Unfortunately, even using dimmable bulbs does not seem to remove the requirement of having a regular bulb in the loop somewhere. IT does mean that you can dim the lamps, but they are still an electronic ballast and so do not pass the current through for the module to power itself and read signals. I have even tried the wall switch modification outlined on the Ido Bartana site above to add a neutral to a regular wall switch but have not found that it made much difference at all. The more expensive wall switches that have a neutral already are more likely to be able to control these lamps without difficulty.</p><p>So with a little effort and extra work it is possible to replace most lights that you'd want to be CF bulbs anyway and have them continue to work with XTension</p> http://www.machomeautomation.com/trackback.php?id=CFL2 Compact Florescent Bulbs and X10 (part 1) http://www.machomeautomation.com/article.php?story=CFL1 http://www.machomeautomation.com/article.php?story=CFL1 Tue, 27 Mar 2007 04:44:16 -0800 http://www.machomeautomation.com/article.php?story=CFL1#comments Hardware Reviews With continuing news items about the banning of filament light bulbs and the continuing improvement in quality of compact florescent light bulbs there is quite a bit of interest in using these with Xtension. I use a LOT of CF bulbs in my system and thought I would outline some of what I've learned in a few articles here. First I'll just tell you what I know about CF bulbs in general and then get down to the specifics of using them with X10.<br><center><img width="432" height="216" src="http://www.machomeautomation.com/images/articles/CFL1_1.jpg" alt=""></center> <b>You Get What You Pay For:</b><p>There is nothing more useless and annoying than a cheap CF bulb. Don't buy cheap CF bulbs from cheap brands. The color of the light will bother you, the audible noise from the ballast will bother you, the flickering will bother you, the interference the cheap ballast creates eating your X10 signals will bother you and the fact that it will burn out before you've recouped your investment in it will also bother you. Cheap bulbs save you nothing.</p><p>My personal favorite brands of bulbs are from Sylvania/Osram, Phillips and GE. I have also had excellent luck with the reflector floods of the Commercial Electric brand that Home Depot sold. They have been replaced by new branding but as far as I can tell the lights are the same. Please note that I have not had the same good luck with the other Home Depot bulbs, just the reflector ones.</p><p>In my hometown Lowes carries a good selection of the Sylvania lights, the Wallmart has started carrying Phillips bulbs replacing the old brand they used to carry which if my experience is any indication probably every other one got returned a week later.. And just about everybody carries GE bulbs.</p><b>Color Temperature Confusion:</b><p>"Warm White", "Bright White", "Full Spectrum", "Daylight" etc. the terms are a bit confusing and dont mean the same thing from brand to brand. Most good brands will print the actual color temperature somewhere on the bulb ballast itself if not on the packaging and that will help you figure out what you want. Everyones experience of color temperature will be a little different and it's very much up to personal preference. Before spending big bucks on buying a case of something to replace every bulb in your house, buy a couple of the different temperatures and try them out to see what you like best. I'll tell you what I've learned below.</p><p>Warm White is generally in the 2700k or 2800k temperature range. It's also sometimes called Soft White. This is the color that CF bulbs have that is closest to a regular light bulb. In other words fairly yellow. The cheaper brands though can even look green at this color temperature. The Warm GE bulbs and most of the phillips bulbs run in this color are pretty good. This color is better for dimmer lights or lights that need to blend in with regular bulbs. For example, individual lamps or fixtures that dont need to be terribly bright. The lamps in my living room are all this color temperature because they need to blend in with the regular incandescent bulbs in the ceiling fan which are on a dimmer and can't be easily replaced. I would stay away from any bulbs that have a lower temperature than 2700k. I've seen some labeled as low as 2400k but that would be just yellow green and probably horrible.</p><p>Bright White is in the 3000k or 3100k range. This is my favorite color for large amounts of light. While warm light works well with a single bulb or a smaller wattage, higher color temps need more light to look good. A single 3000k bulb in a room will look grey or dim, like an overcast day rather than a useful light. At least that is my experience. But if you have a lot of them it's far superior to a large array of 2700k bulbs. My kitchen has 8 recessed cans and I've replaced them with 3000k Sylvania 30 watt CF bulbs (100+ watt equivalent bought at lowes and some of my current favorite bulbs going in everywhere the older cheaper bulbs fail) these are fairly expensive bulbs but the kitchen is wonderful with them in there.</p><p>Full Spectrum, Daylight etc... I use 4100k tubes in my workshop and garage, but in the house proper I have no use for anything higher than 3100k. The 6000k lights look bright blue to me and I just can't find a use for them anywhere. This is personal preference of course, high temperature bulbs seem much more popular with my friends from Japan and parts of Europe than with Americans. I dont know if this is a real cultural difference or if it's just a flawed sample... But before you purchase a lot of these bulbs get one or 2 to test out and see if you like it. I can't see any use for the more expensive "full spectrum" bulbs at all. There is a significant price premium for them and they simply dont make that much of a difference as far as I can tell. You can also safely ignore the "CRI" index which is an indication of how accurately they reproduce colors, but I can't see that it really applies so well to CF bulbs as it does to incandescent bulbs and in my limited experience the color temperature is a more important indicator of what the bulb will look like.<p><b>Less Heat!:</b> <p>For me the single greatest benefit of CF bulbs beyond the brighter better light is the lack of heat. In this Southern clime where I find myself these days the AC has to work very hard in the summer. In my kitchen with that array of 8 cans all with the 75 watt halogen bulbs that were there when we moved in, the AC could not cool the downstairs with them on. Since 90% of the energy used by a traditional bulb comes out as heat that was 540 watts of heat being pumped into the room all the time the lights were on. The CF bulbs generate comparably little heat and more light. Now I can actually turn the lights on in the kitchen without baking.</p><p>The heat issue also translates into a significant better safety margin as well. My daughter has a torchiere style lamp in her bedroom with a flexible extra lamp attached for reading in bed. She also has curtains right there as well as a gauzy thing with disney princesses on it hanging over her bed. With traditional bulbs in this kind of lamp there is a significant fire risk from curtains or other things getting too close to the lamps! With a CF bulb there is no fire danger and I can safely let her pull the reading lamp down against the gauzy stuff as thats only a 15 watt CF bulb in the reading lamp, and I need have nothing to fear from the brighter bulb up top and it's being pushed against her curtains. They simply dont generate enough heat to worry about.</p><b>Brighter Light in Older Lamps</b><p>Another great thing about CF bulbs is that you can put a much brighter one into a lamp that can only hold a smaller incandescent bulb. In the big floor lamp in my family room which has a 100 watt maximum rating I've got a Y adaptor and 2 150 watt equivalent CF bulbs. There is no way to safely put 300 watts of incandescent lights into that lamp, but it now lights the whole play area using only 70 watts of real power. It also has a really big shade which lets me fit the 2 bulbs under there at an angle, you couldn't fit them with a smaller lamp. If the CF bulb wont fit under the lamp harp you can actually buy bigger harps at the hardware store, but you may find that it doesn't look right with the shade you've got in there if you have to do that. GE has started making smaller footprint 60 watt bulbs now that should fit into almost everything and Phillips has 60 and 40 watt bulbs that are quite tiny.<p><b>Modes of Failure</b><p>Even the most expensive bulbs I've bought and my favorite Sylvania 30+ watt 3000k bulbs suffer from some infant mortality. Save your receipts as a faulty bulb will almost certainly show up in the first week or so and you can return them. of the 13 Sylvania 30+ watt bulbs I have in service, 2 of them failed in the first week and were returned. Once you get past that point though, I've not lost any more in the last 3 years. So like any electric appliance, if it's going to fail early it will probably fail in the first few days or weeks.<p><p>In the better bulbs I've never had a problem with base up/down or what kind of fixture I've put it in. Most bulbs warn about putting in completely closed fixtures, but I've not had a problem with this either as I like to torture test them. In the cheaper bulbs I started out with, the base up/down makes a huge difference in their lifespan. Every single one of the 60 watt or 75 watt equivalent cheap bulb I owned that was used in a base up or sideways way has failed. The power supply parts in them just aren't designed to operate under the higher temperatures.<p><p>The way those lights failed however is distressing. While they continued to light up and work apparently fine from the outside, they began to produce huge amounts of powerline noise, silencing just about every x10 signal in the whole house. Sometimes only while they were warming up, sometimes only when they were warmed up, but they appeared to be running normally so it was hard to track down. Yet another reason to avoid the cheap bulbs. I have never had this experience with any of the brands I've mentioned above.</p><b>Dimmable and Exotic Bulbs</b><p>Dimmable CF bulbs have come a long way in usability and a long way down in price from where they started. The Home Depot here actually carries some dimmable 65 and 75 watt equivalent Phillips branded flood lights that I've experimented with, and they work pretty good. You can't put them on a regular X10 wall switch though as they will refuse to be controlled by it reliably. </p><p>There is a new type of bulb also coming available now called a "cold cathode florescent." They generally only come in very dim wattages so far, are more expensive and have a very small and tightly wound lamp tube. But they also have a dimmable ballast and have a much wider range of dimming than a regular CF dimmable bulb which generally go out below about 50% or so. I have 2 like the pictured one in my front porch and several of the candelabra style ones that Home Depot carries in other outdoor lights. They use even less power for a similar amount of light as a CF bulb so are excellent for dimmer ourdoor lights that get left on a lot. The dimmable candelabra bulbs from Home Depot though are only 15 watt equivalent. What is the point of dimming a 15 watt bulb? The other bulbs max out right now at a 60 watt equivalent, but it's actually more like a 40 watt equivalent. I've got them next to a real 40 watt bulb here and they are even a little dimmer than that. So while they advertise being dimmable, the actual usability of it is rather limited since they are already so dim to start with. They are also not available in the better color temperatures yet, only 2700k.</p><b>Next Time</b> I'll write about the specifics of controlling all these lamps with X10, how to make them reliable with appliance modules, what kinds dont mind being on a lamp module or wall switch (as long as you dont dim them) and so forth. http://www.machomeautomation.com/trackback.php?id=CFL1 X10 computer interfaces http://www.machomeautomation.com/article.php?story=interfaces http://www.machomeautomation.com/article.php?story=interfaces Wed, 14 Feb 2007 13:21:00 -0800 http://www.machomeautomation.com/article.php?story=interfaces#comments Hardware Reviews Here's a quick rundown on the pros and cons of the currently available X10 interfaces that are supported by XTension.If you want to control X10 devices from XTension you'll need at least one of these. <ul> <li><b>CM11</b> The original powerline controller the CM11 from X10 is still around and still available. It requires a serial/usb adaptor but is otherwise an excellent and simple interface. X10.com also often has these on sale along with some strange wireless remote for &#36;10 making getting one a no brainer. I have been using one of these as my primary powerline X10 interface for 7 years with no difficulty at all and you can't beat the price. On the cons side some people believe it doesn't put as much power behind it's signals and so might be more susceptible to powerline noise. I have not found that to be a problem here. Contrary to what is sometimes written about it I do not find that it's any slower at sending powerline commands than any of the other units out there. The limiting factor in sending X10 commands is the powerline part, not the serial port part.</li><p> <li><b>CM15</b> This is the replacement for the CM11 from X10. The powerline part is the same as the CM11 but has a USB connection instead of a serial port. It also has built in both a wireless receiver for motion sensors and remote controls as well as a built in wireless transmitter for controlling ninja camera mounts or other things. On the con side it will always echo the A housecode of addresses through to the powerline, this cannot be turned off, and it also cannot send a powerline command while it's receiving a wireless command. What that means is that the software has to wait until you stop pushing the button on the remote before it can send the ON command to the lamp that you're trying to turn on. The device is a good starter because it does everything at once, but I suspect that as your system grows you'll become fed up with those limitations. The range of the receiver and transmitter is not very good and cannot be extended without performing some surgery on the unit to add external antenna connections. This is not difficult to do, but requires some basic soldering skills and a trip to Radio Shack.</li></p><p> <li><b>Powerlinc 1132</b> This is SmartHome's X10 powerline interface. It connects via USB. I have one of these thats been in service for 3 years or so without any difficulties. </li></p></ul><p>All of these interfaces advertise the ability to download some or all of your home control logic to the interface so that you don't have to leave your computer running all the time. XTension does not support this. The reasons are many, but simply if all you want to do is whats supported by the interface then you would be better off with an X10 programmable alarm clock. Since only a small subset of the abilities of a program like XTension can be downloaded into the devices mapping your setup in the computer to the interface is impossible to do with reliability.</p><p>You have to make the decision to get a Mac up and running in the closet or under the desk and let it take care of these things. Once you have made this commitment you'll find that you have lots of uses for it that can be part of home automation. Logging phone calls, sharing disks, sharing printers, acting as your internet gateway and a hundred other things.</p> http://www.machomeautomation.com/trackback.php?id=interfaces Too Tight! http://www.machomeautomation.com/article.php?story=tootight http://www.machomeautomation.com/article.php?story=tootight Sat, 27 Jan 2007 11:00:14 -0800 http://www.machomeautomation.com/article.php?story=tootight#comments Trouble Shooting I had an X10 wall switch go deaf on me last week for a very interesting reason. I added a 4th X10 wall switch to the box in my front hall. There were 3 there already handling my front yard floodlight, front porch lights and the front hall chandelier that have been working fine for years. After adding a 4th for the new sconce in the hallway the chandelier light stopped responding in the evening, but worked fine in the morning and afternoon. It would turn on with my sunset script, but would not turn off again or dim to it's nightlight setting when I told my XTension machine that I was going to bed. Ones first assumption when a light will not work at a specific time is to look for some other device, power supply, battery charger, CF bulb, computer power supply, or something that was on in the evening but that wasn't on in the morning and afternoon when the light was working fine. And I did this after the family was in bed one evening I went around and unplugged or turned off everything I could find to no effect at all. The solution turns out to be different than any other X10 issue I've ever had. Turns out I had over-tightened the plate over the switches. This cause the metal plate on top of the X10 wall switch to warp just enough as it heated up to disengage the code wheels. SO when the switch was cool it worked fine. In the morning and afternoon I could control it just fine, it was only after the hall light had been on for several hours in the evening that it would no longer respond. I loosened the screws holding the switch in half a turn and it's been working just fine ever since. So don't over-tighten your wall switches! http://www.machomeautomation.com/trackback.php?id=tootight Catching Low Battery Messages http://www.machomeautomation.com/article.php?story=lowbattery http://www.machomeautomation.com/article.php?story=lowbattery Thu, 25 Jan 2007 05:31:00 -0800 http://www.machomeautomation.com/article.php?story=lowbattery#comments AppleScript <p>With a compatible receiver XTension can use any of the X10 wireless security devices. These include the security motion sensors (MS10) and the door/window sensors (DS10.) One of the features of these devices is that they check in every so often to let you know their status and send you the state of their battery. With the regular X10 motion sensors the only way to know that the battery is dead is to wait till they stop working. (actually, the most common mode of battery failure for those for me is that during the night the batteries cool off and their voltage goes so low that the hawkeye resets it's address to A1 and in the morning when the batteries warm up enough to start working again you get no actions on your movements but a lot of A1 ON's received in the log so you know that one has gone dead during the night.)</p><p>XTension receives this battery status message and will set a unit property called "low batt" when it receives it as well as logging a message to the log for you. But scanning the log for these messages isn't the best way to find out which units are reporting a problem. This tutorial will walk you through creating a list that will show you any units reporting low battery messages.</p> <p><center><img width="448" height="117" src="http://www.machomeautomation.com/images/articles/lowbattery_1.jpg" alt=""></center></p><p>While it would be possible to walk through all your units and see if any have this set, XTension provides an event that you can use to catch it as it's being set. When any unit property is set you can catch that by creating this handler in the ON script for the unit:</p><pre><code> on PropertyChanged( PropertyName, PropertyValue) ... ... end PropertyChanged</code></pre><p>Whenever any property in the unit is set it will call this method if you have created it in the ON script. If you only have one or 2 security units it would be easy to just add the code to the individual units. But if you plan to add more then you'll want a way to not have to repeat the same code in dozens of ON scripts. Luckily all unit events like this will also show up in the ON script for any Group that you add the unit to. The group handler also gives you the name of the unit for which the property is being set as well as the name and value of the property.</p><pre><code> on GroupMemberPropertyChanged( UnitName, PropertyName, PropertyValue) ... ... end GroupMemberPropertyChanged</code></pre><p>So the plan for this is to add all our security units to a group, and watch for any low battery properties to be set.</p><strong>STEP 1: Create a list to show the offending units</strong><p>Create a new list called "Low Battery Alert" or whatever makes sense to you.</p><strong>STEP 2: Create a group with all your security units in it.</strong><p>Create a new group and drag and drop all your security units into it. Now click the "Edit ON Script button" for this group and we'll add our handler code to it.</p><strong>STEP 3: Cut and Paste the Following Script.</strong><code><pre>on GroupMemberPropertyChanged( UnitName, PropertyName, PropertyValue) --this will get called for any property, so make sure it’s the low batt message if PropertyName is "low batt" then --make sure we’re setting the value and not clearing it, so check to be sure --property value is true before performing the action if PropertyValue is true then --add our unit to the list we created add unit UnitName to list "LOW BATTERY ALERT" --make sure the list is visible front window "LOW BATTERY ALERT" -- if you were going to add other alerts, like emails -- this would be the place to do it. end if end ifend GroupMemberPropertyChanged</pre></code><p>Now you have a list that will be populated automatically when any units that report a low battery. It will also open up and bring itself to the front of all the other windows to get your attention.</p><p>The "low batt" message is not cleared automatically, so after you change the batteries you'll need to go to "edit unit properties" for that unit, delete the "low batt" property and then delete it from the alert list.</p><p><i>PLEASE NOTE: this tutorial requires XTension version 5.4 or newer as the verbs to add units to a list were not added until during the beta cycle of that version. </i></p> http://www.machomeautomation.com/trackback.php?id=lowbattery Applescripting a System Restart http://www.machomeautomation.com/article.php?story=ApplescriptRestart http://www.machomeautomation.com/article.php?story=ApplescriptRestart Wed, 24 Jan 2007 13:27:00 -0800 http://www.machomeautomation.com/article.php?story=ApplescriptRestart#comments AppleScript <p>Even given the wonderfulness of a modern operating system like OSX, it is sometimes necessary to script a restart. I've had USB device issues, networking issues or external device issues that would only resolve themselves by restarting the computer. This is very easy to do on a Mac, the script need only say:</p><p><code>tell app "Finder" to restart</code></p><p>But if you just put that into a global script in XTension you'll run into problems that could stop the restart process and leave your computer with half the apps quit and a modal dialog telling you about an error. Here's why, XTension would be telling the Finder to restart and waiting for it's response. Then the Finder will tell all the apps to quit, including XTension before restarting. But XTension wont quit because it has an outstanding apple event to the finder. And you see that it would get stuck at that point. So the answer involves using the "Ignoring Application Responses" block as well as putting the applescript into a separate application. So open up the script editor and enter this script:</p> <p><code><pre>try ignoring application responses tell app "XTension" to quit end ignoringend tryignoring application responses tell app "Finder" to restartend ignoring</pre></code></p><p>The first part tells XTension to quit. That lets it get a head start on saving the database and closing all the device connections and such. You can also specifically tell any other app that you want to get out of the way before the restart to quit here. The last part tells the finder to restart the machine, but since it's inside an <i>ignoring application responses</i> block it will not wait for the restart, but the little applet will just quit.</p><p>When you save this remember to save it as an application so that when you launch it you wont just end up looking at it in the editor:</p><center><img width="436" height="286" src="http://www.machomeautomation.com/images/articles/ApplescriptRestart_1.png" alt=""></center><p>And lastly to have the restart be runnable from within XTension you'll need to create a global script that does something like:</p><p><code><pre> tell app "Finder" to open "path:to:where:you:saved:the:Script"</pre></code></p><p>Deciding when to run this script in response to errors or other input is the topic for another entry on another day.</p> http://www.machomeautomation.com/trackback.php?id=ApplescriptRestart A Waterproof X10 Remote for the Bath? http://www.machomeautomation.com/article.php?story=waterproof http://www.machomeautomation.com/article.php?story=waterproof Sun, 14 Jan 2007 16:11:33 -0800 http://www.machomeautomation.com/article.php?story=waterproof#comments Module Hacks <p>Shortly after automating the lights in the master bathroom here it became obvious that I would need to add some control from the tub itself. As not every member of the family is as aware of the HA system to be bothered to hit the clearly labeled "I'm about to take a bath, so turn on the bath lights and dont turn them off on my while I"m in here" button on the regular wall remote in the room ...</p><p>I will write at length about the complexities of my master bathroom programming and the depths I had to sink to in order to maintain spousal approval for that part of the project another time.</p><p>I considered just putting a stick-a-switch on the wall, but since my kids often bathe in this tub as well there is no place that is reachable from the tub that wont get soaked. So I settled on this as a solution:</p> <p><center><img width="250" height="272" src="http://www.machomeautomation.com/images/articles/waterproof_1.JPG" alt=""></center></p><p>OK, so it's not exactly a waterproof remote, but rather a regular stick-a-switch wrapped in a "food saver" vacuum sealer bag. You can't actually use the vacuum as that would just press all the buttons, but you can use the heat sealing strip to seal the bag. I sealed it twice around each edge just to be sure it wouldn't leak and so far it can sit quite happily in a puddle of suds on the edge of the tub, and I've even caught it floating around being used as a boat a few times and so far, no problems.</p><p>The major weakness of these remotes is the battery holder. To keep the battery from slipping out in the bag or from working loose I just put a piece of scotch tape around the bottom of the case over the battery slide to keep it tightly in there.</p><p>These switches are often on sale at X10 for such a good price that if I ruin one or 2 over the course of our living here I wont worry too much.</p> http://www.machomeautomation.com/trackback.php?id=waterproof