Saturday, January 10, 2015

How to make Lactaid actually work.

This post is a bit of a departure from the normally technical content of this log of my projects.  I have been lactose intolerant for a long time. In the beginning I didn’t know what was the matter with me, the symptoms were far worse than just the “bloating and gas” that you’ll see listed on the boxes of the pills for it. I initially thought I was getting IBS or crones or something horrible. But it turned out it was just lactose intolerance! I started taking lactaid before meals with milk and it worked. For a while anyway. As my condition worsened I started needing 2 pills, then 3 or 4 and 5 and then they stopped working at all and I again gave up milk products.

My stomach was still unpredictable and through further research I found I also had to give up caffeine (I know, a computer programmer who drinks decaf? It’s almost unbelievable) and really hold down the amount of sorbitol or mannitol I ate in the form of sugar free mints. I could eat a whole tin of them while working on something and then suffer the consequences.

But in reading up on lactose intolerance I also learned that there was at least one brand that was enteric coated. An enteric coating is one that does not dissolve in the stomach, but holds together until it reaches the intestines which is where most enzymes do their work anyway. The manufacturers claim that lactase survives the stomach acid just fine and is still functional when it hits the intestines, but just for fun I ordered some of these very expensive boutique brand pills.

They worked fantastically.

I think I ate 10 pounds of brie in the first few months after discovering them. But they were expensive  at a dollar a pill and they were from a small natural herbal remedy company that could go out of business or change their product lineup at any moment. And since the supplement market in the US is almost totally unregulated I had no idea what was really in them or if one batch would contain the same quality and quantity as the last one that worked. I don’t like being dependent on a single supplier. It turns out that if you put your own enteric coating on a cheap Lactaid pill it works perfectly too!

Unfortunately this isn’t a completely simple process. The simplest form of enteric coating is nothing more than shellac. Don’t get too upset, shellac is a natural product harvested from the Lac beetle. Yes, I know, yuck, but you’ve eaten it as a coating on every shiny piece of candy you’ve ever eaten, if you’ve ever taken a coated aspirin chances are this is what it was coated with. And so far you’re just fine. It’s safe and harmless. If you buy it from the hardware store though you’ll get it dissolved in methanol or isopropyl alcohol which is not non-toxic. Luckily there are food grade products that I assume are dissolved in grain alcohol instead of something toxic, but even if not the solvent will be entirely evaporated before you eat any of it. So this should not be a concern. What I used was this:


Confectioners glaze is usually shellac. But make sure you’re getting the right kind, the ingredients here look like:

When it arrived it said Lacquer and not shellac. I know that in woodworking the 2 are not the same thing exactly, but perhaps the terms are different for food.  I thought I was ordering shellac. I decided to test it anyway since it’s edible and it worked just fine.

It turns out you cannot just dip a lactaid pill into the glaze, it will disintegrate just like it’s supposed to do as soon as it gets wet in your stomach. So I first encased it in a gelatin capsule.


A picture of the empty capsule and the lactaid pill. I’m not sure what size these capsules are, I think they are 0 sized but I’ll update when the ones I’ve ordered arrive. These were harvested from some old vitamins that we gave up taking because vitamins just really aren’t necessary for most people to take. The capsule will protect the lactaid from getting wet until it dissolves.


The lactaid pill fits snugly inside a properly sized capsule and then put the capsule back together.


The coating process is important. If there are any parts of the pill that are not coated it wont work. If you test to see if the pill is still tacky before it’s dry you could make holes in the coating and the whole thing will dissolve in the stomach then and not work. I hand dipped them just past the seam and then shook off the extra drop at the end. It’s a 2 part process once this half has dried you’ll have to turn it over and dip it just past the seam from the other side.


Once I dipped it and shook off the big drop there was still quite a bit of the glaze on the end, I just touched it to some paper to get the worst of it off. Unless you rub it dry the rest will reflow over the top.

Then I turned it over and stuck end end not dipped into some foam I had made a few holes in to hold it up to try. It dries quickly for a wood finish, but it still takes a while. Once it’s dry pick up the pill, and dip the other side making sure to come just up over the seam again to make sure it overlaps. 

Of course this is all a pain in the neck, the perfect solution would be for Lactaid to just make an enteric coated version of their otherwise helpful pill.  I recommend that if you have found their pills no longer work that you use their contact us page to let them know that you want this. 

The product already out there that is already enteric coated is called “Lactosolv” and is buy a company called “Life Extension” you can find them on Amazon and other online sellers. 

Monday, January 5, 2015

My pick for the best LED bulb to use with home automation dimmers

Phillips and Cree seem to be in tight competition for your LED bulb money. They both have cheap and cheaper versions of their bulbs now in more and more interesting packages but so far very few bulbs available will work in automated dimmer fixtures. The one reliable exception that I’ve found that is available locally at a reasonable cost are these Phillips bulbs.


The model info on the packaging says “AmbientLED A19  model # 9290002268A(Upgraded 06/2013)” with an ordering code of BC11A19/AMB/2700 DIM 120V

The light color is 2700k, but they dont feel that warm to me. The light is a little brighter than the sick yellow you can expect from a label saying 2700k. 

They dim perfectly on every remote controlled home automation dimmer that I’ve tried them on. They work on dimmers that do not have a neutral which forces them to run a little current through the load to power themselves. They also will run as a single bulb on an old style X10 push button switch! This is amazing as there aren’t many other LED bulbs that can run in that configuration. Sometimes you can build a large array of bulbs that wont be on dim all the time on a no-neutral switch but these work as a single bulb.

They are silent, never making even a hint of a buzz and in the last couple of years that I’ve been buying them I haven’t lost a single one.

Dont be fooled by the Phillips label though, they have several other kind and formats of bulbs, like the very interesting flat ones, but those will not work with no-neutral dimmers. They will be on low all the time and cannot be turned off. The bulb pictured above does not have that problem.

Cree makes a bulb that is a little bit less expensive than this bulb and they now come in 60, 75 and 100 watt versions in both warm and cool color temperatures. I dont have a picture of these but they are the ones with the glass envelope coated in what feels like a dip in silicone rubber to protect you if the bulb breaks. These also work great on remote controlled dimmers and will also work as a single bulb on even an old style X10 push button switch. The downside of them is that they are noisy, buzzing very audibly when on a remote dimmer and even worse they flicker. These bulbs flicker even when there isn’t a dimmer anywhere around. I’ve got some of their flood lights that I am going to soon replace as even when on an appliance module with no dimmer around randomly they seem to think they need to flicker horribly. I cannot recommend these bulbs even though they do work on the dimmers because of the noise and flickering. 

The phillips bulbs are available here at Home Depot and online in many places.

Tuesday, September 16, 2014

Serial2tcp sharing a serial port on your computer to a remote device

There are dozens of ways to connect to remote devices from XTension but it occurred to me that there isn’t a simple way to just share one connected to another Mac. This little app will connect a local serial port on any Mac to a TCP port. Listen for a connection to the port and then forward data between the two. It can connect multiple serial ports and TCP ports with only one process. I’ve made no attempt to code for the opposite side of the equation, turning a TCP stream back into a virtual com port because thats not necessary for XTension. Anything XTension can connect to via a local port it can also connect to via a TCP stream.

download:  serial2tcp.zip

(since the code was fairly straightforward I was able to load the source into an older version of the compiler and create a fat binary with both Intel and PPC code for anyone wanting to recycle a really old machine. I’m not entirely sure how far back in OS versions this will run, but it would be worth trying on 10.4 intel or ppc machines.)

download ppc: serial2tcp_ppc.zip

download and unzip. I would recommend placing the serial2tcp folder inside the Applications folder. There is a folder of libraries inside it as well that must remain next to the application regardless where you put it. Then if you’re the kind of person who likes to run things from the command line you can make an alias to your /bin directory.

command line options:

--help   prints out the help
--list    prints out a list of available serial ports on your computer
--share [serial port name] [serial port baud] [tcp port number]

--share is the main entry point for getting it to do anything. Get the serial port name from the --list function, a standard baud rate and a TCP port above 1024 to run it on.

For example to share a CM11a on a remote machine you’d use something like:

/Applications/serial2tcp/serial2tcp --share usberial_FT5434 4800 2000

would connect to an FTDI based usb/serial adaptor with that name, open the port at 4800 baud and share it on port 2000.  If you wish to share more than one port you can use multiple --share parameters. But they must have unique serial port names and TCP port numbers.

The program will allow only 1 connection at a time for any given serial port but will re-listen if a connection goes away. So you should be able to reconnect to it without restarting it or any such thing. It also makes a valiant effort to reconnect to a lost serial port. If someone pulls the USB plug and plugs it back in on the remote machine it will work very hard to reconnect to that port and then reconnect it to the already open TCP stream. If you’re lucky you wont even miss any data. On 10.9 with the latest FTDI drivers I had no trouble with this apart from the garbage data being sent down the serial port making my CM11 freak out until being power cycled. On earlier OS versions though it was not uncommon to get a kernel panic if an open usb/serial adaptor was pulled while in use. So YMMV.

To use it then in XTension just select “remote tcp port” instead of a serial port from the available port popup. Enter the IP address of the computer doing the sharing and the port number you’ve chosen, in the above example 2000. The computer hosting the port should be configured with a static IP address or a reserved DHCP address so that it doesn’t change. If you want to share across the internet you’ll have to be able to create the proper NAT pass throughs to reach it. It’s a server listening for an incoming connection on the port not a client that can make an outgoing connection.

Thats all well and good, but the real value would be in having it launch at computer startup and run no matter who is logged in or if anybody is logged in to the computer. This is possible by setting up a system launchd configuration file for it. The following instructions are for OSX 10.9 and later, but it should work for the last few versions. Earlier than 10.7 and you should verify the proper launchd plist configuration because I believe it has changed since 10.6.

Inside the serial2tcp folder you’ll find a file called “com.sentman.serial2tcp.plist” this is a boilerplate launchd configuration file that you will need to edit for your own use. If you have apple’s dev tools installed then you can use the excellent plist editor, otherwise any text editor can do it but pay attention to the XML structure. Screenshots below are from the plist editor.


The “label” must be unique and should be the same name as the file but without the .plist at the end. You can leave it like it is unless you’re starting multiple instances.

the first program argument must be the link to the program you wish to run, in this case I put it in the Applications folder, but if you put it somewhere else then change that link.

The following parameters are the same as if you were adding them at the command line. In this example I’m sharing usbserial-FTG3LGPX at 57600 baud on port 2000. You’ll want to change those for your own settings. You can add more program arguments if you wish to share more than one port. Just repeat items 1 through 4 with the new info in them.

Once you’ve saved this back you’ll need to place a copy into the system launchd folder which is at /Library/LaunchAgents you can use the command line to get there or the “go to folder” option of the finders “Go” menu and enter that path. It will ask you to enter your password in the finder because this is a system protected folder and you need to run as an administrator to move files in and out of it. Once the file is there you’ll need to edit the owner of the file. It must be owned as root in order to be loaded while nobody is logged in. I could not get this to work from the finder’s file permissions panel and so it must be done from the command line.

Open a terminal window and type:

cd /Library/LaunchAgents

then

sudo chown root ./com.sentman.serial2tcp.plist

again it will ask you for your password to make sure you’re actually allowed to make a file owned as root.

You can test without rebooting by using the launchctl command from the same command line, type:

sudo launchctl load ./com.sentman.serial2tcp.plist

and you should just get the cursor again if no errors occurred. The program will log it’s output to the system log while running in the background so look there for connect/disconnect errors or other messages. If all went well you should now be able to see it running with the activity manager and connect to the port from XTension and share the device.

This article is cross posted at MacHomeAutomation.com

Sunday, September 14, 2014

xBee network hosted remotely off a Wiznet TCP/Serial board.

Wow, haven’t posted any projects since may 8th?! Most of my effort was spent in playing with the kids over the summer and in porting XTension to Cocoa. We’ve been a carbon app so long because we like to support older operating system versions, indeed we still supported PPC machines up until the most recent build. Thats just got to change, we’re never going to be in the app store or run properly in the sandbox if we don’t get around to leaving some of that behind. The PPC and pre-10.7 builds of XTension will continue to receive bug fixes but are basically done. I’ve been running my house on the cocoa version for almost a month now without difficulty and the ease of doing some important things is just wonderful. Even though the conversion was not at all painless it’s coming along nicely and the UI things I can do now alone make it worth while.

The last few days I’ve been fighting with an xBee breakout board and a Wiznet card trying to build a remotely hosted xBee network. Under most circumstances you can just add more xBee’s in between the area you need to cover and the host machine and connect it directly to the XTension machine, but that isn’t always feasible. So if you have any desire to host an xBee network with the xBee coordinator sitting on an ethernet network somewhere other than where you can reach with a USB cable from your XTension computer here’s the connections you’ll need to make.

Mac Home Automation - Hosting an xBee on a Wiznet card

Thursday, May 8, 2014

New XTension release, v7 build 853

My day job is as a developer of the XTension home automation software for the Macintosh. This new build has a really huge set of new features and I’m really excited about it. It adds support for the Vera interfaces. They are a lot more than just an interface, but not too much more expensive than just a separate ZWave interface. These are the most full featured and most reliable ZWave interface that we support and is certainly my favorite. Though the vera we also gain Insteon support. Technically you can do X10 through the vera as well but it’s so slow as to be unusable and is only outgoing, it can’t receive any X10. For many people the Vera interface would be all the automation that they need and some people wont want to connect it to a computer, but XTension is really for people that have outgrown the capabilities of these devices and want something more.

This version also has a greatly improved web interface. The pages are completely dynamic and while you get simple unit lists for control you can also create custom pages that display any or all of your information. In previous versions this has had trouble on iOS devices, this version fixes those issues and runs great on iOS or other mobile platforms. More mobile templates are on the way so that you’re not looking at a large screen designed interface. You can also create as many different interfaces running on different ports as you like so make a separate one for iOS and another for your tablets and another for your browser.











Friday, January 17, 2014

Important things you need to know when replacing an iPhone 5 battery yourself!

If you’re thinking of replacing your own iPhone 5 battery you can definitely do it, but there are a couple of things I didn’t find documented in any of the shiny take apart videos on the web. If someone had just told me not to pry under the battery next to the SIM card cage i’d be a wealthier man who hadn’t just destroyed his wife’s iPhone as she was heading out the door to work...

I have replaced probably a dozen batteries or failed buzzers or other things in my own and my friends and families iPhones up until this. I’ve had exactly 1 problem in all that time where on my daughters iPhone 4 the whole surface mount battery connector came off the board instead of disconnecting. i was able to repair that with the hot air rework station.

To remove this battery the videos warn that the tape they used is very strong and suggest gently prying around the battery with the spudger. That was an understatement for mine, the tape was cement. And removing the battery without deforming it was impossible as you can see. This is what the battery looked like when I finally got it to come loose.


but it didn’t catch fire or anything. I wish it had occurred to me to use a hair dryer to warm the back of the phone to loosen the adhesive. So thats the first thing I would recommend. Warm it up, not directly on the battery but the back side of the phone.

There are some flat cables that run along the side of the motherboard past the sim card cage. This is where the danger is.


The look solid, but if you stick the spudger down there to get under the battery you will damage the motherboard underneath them.  You can see in this picture that there isn’t even any adhesive in this area, possibly for the exact reason that you can’t pry here. But nobody says not to pry here.

After removing those flat cables it becomes obvious what happened, you can even see the 2 pin head chips that I broke lying on the back of the case. Yes, I managed to break off 2 of them prying the battery out.



I stared at them for some time, even going so far as cleaning the area with some flux and the hotair rework tool but that chip there is obviously damaged, the pads broke off in the chip while 4 others let loose. Wonder why they came off so easily? I am not by any means the only person to have this problem there are many reports on the internet. I still think it’s possible to replace these batteries yourself, but take your time, heat up the sticky tape and DO NOT PRY across from the sim card slot!


the sim card slot is right in the middle where there is no tape on the motherboard side.

Now off to ebay the screen and other still useful parts to try to take some of the edge off the pain of having been an impatient idiot tearing into this poor phone.

Sunday, January 5, 2014

Silencing a Buzzy Cree LED bulb.

The $12 Cree branded bulbs that HD sells are great. They are bright, have good color, they dim and turn on and off reliably with old style pushbutton X10 dimmers but when they are on an old dimmer they buzz something fierce. When on a new style dimmer they are much quieter but I bought some especially to put on X10 dimmers.

This, is a bulb who’s silicone coated envelope was broken in the packaging that I didn’t notice till I got home...

so the fact it has no glass on it probably means it’s even louder (and take note, I dont believe this is an isolated power supply and even if it were it’s probably 70+ volts across all those LED’s in series so you could definitely hurt or kill yourself with this, thats why I’m putting it into a fixture very high up where it doesn’t matter that it’s damaged or what it looks like)

and this:

is what I filled the base with to shut the noisy thing up with. And boy is it quiet now. I dont know what that will do to thermal issues in the power supply, but I just mixed that entire tube and poured it down the top of the bulb letting it coat all the electronics. Once setup it’s as silent as I could wish for.

It really shouldn’t be necessary to break the bulb off one to do this, you could drill a small hole in the metal base, there is room in there probably to do so without hitting anything if you were careful. Probably, but dont try it unless you can see what you’re doing and wish to ruin a lightbulb in a spectacular and potentially dangerous way. And then you could fill it with proper non-conductive thermally conductive potting compound to do the same which would probably then increase the life of the bulb... If it dies a horrible death sooner rather than later I’ll be sure to write it up.