Category Archives: Apple

Switching between HDMI and analog audio on a Mac

Here’s a proven fix if you need both analog and HDMI audio outputs and require a way of switching between them.  In my case, I had an application where a rack mounted Mac Mini serves as both a media server and an audio source for a whole house paging system.

I first tried using the headphone output as an analog audio output.  The problem is that if anything is plugged into the headphone jack, it is not possible to select HDMI for sound output via the Sound preference panel or via any other means.  Various people have posted methods for outputting audio to both HDMI and headphone out simultaneously, but my application requires only one output to be active at any given time.

The hardware piece of the solution is a relatively cheap Turtle Beach USB DAC.  I’d imagine other USB audio converters would work equally well.

After plugging in the DAC, I confirmed that I could switch audio sources from the Sound preference panel.

The next step was to to automate the audio switching.  I found various Applescript techniques on the web for doing this by scripting the sound preference panel UI, but that approach seemed kludgy and probably slower than using a compiled command line tool.  If such a tool is included in OS X Mavericks, I couldn’t find it.  Fortunately, a generous developer created an output switching utility called audiodevice, which is available here.

Audiodevice works perfectly but has one minor quirk.  Some output devices have trailing spaces after their names, which need to be included in audiodevice commands.

Here is an example of a shell script that uses audiodevice to switch audio output from HDMI to USB DAC, plays a sound effect, outputs a string that was passed to it from the command line as text to speech, and then switches back to HDMI:

/usr/local/bin/Audiodevice/audiodevice output "USB Sound Device        "
/usr/bin/afplay "/Library/Audio/Apple Loops/Apple/iLife Sound Effects/Machines/Communication Engaged.caf"
say $1
/usr/local/bin/Audiodevice/audiodevice output "HDMI Matrix  "

Notice the spaces after USB Sound Device and HDMI Matrix.  If you are not using the Turtle Beach DAC, the USB DAC may have a different name.  Use the audiodevice output list command to get a list of the audio output devices installed on your Mac.

Vehicle detection using iAutomate RFID

One item on my to-do list for a long time was to enable our home automation system to detect the comings and goings of our vehicles.  Each has an EZ-Pass badge, so I figured slam-dunk, just find an appropriate active RFID reader and we’re done.  But I was unable to find a cost-effective solution.  (But wouldn’t that be an awesome Kickstarter project . . .)

I also explored homebrew solutions using Bluetooth modules and Wi-Fi but laziness triumphed when I heard about a plug and play long range RFID kit for Indigo.  (There are also versions available for Homeseer and Crestron.)  The kit comes with a reader module and two RFID tags.

Overall, I give this product a B+.  It works well but you have to get past a few annoyances.  #1, the price.  I think iAutomate is making a mistake with the pricing.  $549 for the “starter kit” puts this product out of reach for a lot of people.  I’m taking a very rough guess that the whole kit costs well under $100 to produce.  iAutomate should really consider a $399 price point (or <shudder> $199?)

Next annoyance:  WTF with the pinout?  The readers have RJ-45 (ethernet style) jacks to carry 12-volt power and RS-232 serial signal.  But, as the manual cautions, if you plug this thing into Ethernet, something will surely fry.  iAutomate provides a lovely color engineering diagram showing how to terminate an eight conductor RJ-45 plug into the custom, 4-conductor pinout that the reader uses.  Ignoring that will make many, many crispy devices on your LAN. Gosh, if you’re gonna insist on using a proprietary pinout, at least use a proprietary connector.  Or an RJ-11 that won’t get confused with Ethernet?  Or better yet, just put an adaptor in the box to convert to standard Ethernet pinout.

And yet another nit.  The reader case doesn’t have any sort of mounting flange.   I just used a couple of cable ties with screw holes to fasten the reader to a wall.

iAutomate says you need to use a USB-to-serial converter that uses the FTDI chipset.  And they mean it.

Initially I tried connecting both the RFID reader and a Lutron RadioRA 2 main repeater to a Keyspan 4-port adapter (which does not use the FTDI driver). This combination was catastrophic!  The computer crashed every time the RFID reader saw a tag.  So I tried leaving the Lutron repeater on the 4-port adaptor and putting the RFID reader on a single port Keyspan unit that I had in my parts box.  This had the frustrating result of working perfectly except when a tag would first come within range of the reader, causing the Indigo plugin to reset communications.

Finally, I plunked down 12 bucks for a generic FTDI converter and voila, the reader worked reliably!  I still don’t understand why the Keyspan adaptor, which is my go-to device whenever I need to do USB to serial conversion, didn’t work.  iAutomate’s Indigo plugin is written in Python, using the same libraries that I used for the RadioRA 2 plugin, so it would be reasonable to assume that both devices would be hardware compatible with the Keyspan.

The manual also cautions that placement of the RFID reader and orientation of the tags may require some trial and error.  This couldn’t be more true.  I had to try about a half dozen locations for the reader before finding one where all the tags could be reliably read.

Conclusion:  an effective, but expensive and tricky to install device.

Update (May 21, 2014):  I am revising my overall assessment of this product to an A- for the following reasons:

  1. The latest version (2.1) of the iOS RFID Track app adds signal strength display and an improved UI, among other things.  It’s a real pleasure to use and is available from the iTunes Store.
  2. I recently needed technical support for the Indigo plugin and was very satisfied with the experience.
  3. Peter Monahan, the President of iAutomate, explained the reasoning behind several of the product’s pricing, manufacturing and design decisions to me.  For example, their decision to use RJ-45 connectors now makes sense to me.  Here are Peter’s remarks:

I thought I would take a moment to address some of the concerns that you had and then mentioned in your remarks. I hope to provide you with a better understanding.

Price:
The hardware devices cost us far more to manufacture than you cited.  Far more.  Many users are not aware that all of the RFID devices have FCC, IC and CE approvals; this adds tremendous cost to the hardware. We don’t have a choice in the USA, the devices must be FCC listed. We also sell in Canada and Europe.

We fight the temptation to have the devices manufactured in Asia.  There are non-financial costs associated with “making it cheap in China” and we are not willing to compromise.

As you are already aware, we provide free technical support for the product M-F 8am-5pm and are often available outside of those hours and on weekends.

The plugins (yes there are two) cost thousands of dollars to develop and are the most professional, full-featured, reliable,  detailed and documented plugin available for Indigo, bar none, yet they are bundled for free with the hardware.  The hardware was extensively tested by a team of Beta Testers prior to release (not on a single workbench). The cost of this development and continuing updates is priced into the hardware.

Similarly, RFID Track for iOS cost thousands of dollars to develop and is available for Free via iTunes for unlimited devices.The cost of this development and continuing updates is also priced into the hardware.

There is a lower cost “LE” version of the kit available for those who do not expect to expand their network beyond a single reader that sells for $399.00, but the higher cost kit sells better at $549.00.

FTDI Chipset:
FTDI provides the most current driver support and updates for OS X. During development, it was discovered that the Prolific brand chipset was often “bootlegged” and despite the amount of Prolific devices on the market, Prolific would not support many of them because they were not authentic Prolific chipsets.  We were not willing to put our reputation on the line if performance suffered because of a bad or “knockoff” adaptor.  I made the executive decision to standardize on FTDI.

The problem with “non-FTDI” adaptors is amplified, because our data stream is real time data ALL THE TIME. Even when no tags are detected, the reader sends an “empty packet” every 40ms to make certain the buffer is empty and the tag data is real-time. This empty packet also acts as a heartbeat. Other chipsets could not handle the data stream; we deemed them to be cheap, weak and inefficient. Sometimes, they were cheap knockoff copies of other chipsets.

The RJ45 Connector:
Depending upon how you terminate the reader, it has the ability to communicate via RS232 or RS485 via the RJ45 connector, so six terminations are possible out of 8 (see the drawing that was provided with kit). The RJ45 connector is the least expensive connector for providing 6, but up to 8 connections.  If we used a proprietary connector, the price would increase and Customers would be very unhappy that we “force” them to use our proprietary connectors.

The single biggest reason that standard Ethernet cables cannot be used is because such a configuration would connect RS232 AND RS485 at the same time and the reader would not detect the correct protocol for reliable communication.

The warning labels are because We’ve had Customers skip over reading the wiring diagrams as well as the manual and connect the reader directly to an Ethernet port or switch out of ignorance.  Other manufacturers place warning labels on clothes irons, cautioning the user not to iron their clothes *while on their body*.  I guess this is our version of that warning label, but if you ignore our warning, I assure you that you will not burn your flesh.

Thank you again for your business, we appreciate you.

Respectfully,

Peter Monahan
President

Williams-Sonoma Smart Thermometer FAIL

WS Smart Thermometer

We recently got a Big Green Egg ceramic charcoal cooker at the RatRanch.  I have nothing but praise for the BGE.  It lights fast, cooks evenly and consumes a surprisingly small amount of charcoal.  In preparation for cooking a big pork shoulder, I picked up the new Williams-Sonoma “Smart Thermometer” so I could monitor the temperature of the meat, which needs to cook at 225° for several hours.

I happened to be at a Williams-Sonoma store on the day they got their first stock of Smart Thermometers.  Perhaps I should have been suspicious when the sales clerk offered to print a receipt for me instead of emailing it like they usually do?

The best feature of the Smart Thermometer is its packaging, which is thoughtfully designed.  It deboxes a lot like an Apple product.  The thermometer itself is crafted from stainless steel and feels heavy and solid.  However, the included charger and cord are flimsy and feel like they wouldn’t last for long.  Fortunately, it accepts a standard mini-USB cable.

So I charged up the thermometer and hit the power button.  Nothing.  Nada.  Dead on arrival.

So back to Williams-Sonoma I went.  When I said that I got a defective unit, I was pointed to the retail display and told to grab another one If I wanted.  No paperwork.  Were they exchanging a lot of these?

I headed back home and charged up thermometer #2.  This one turned on and I went through a clumsy setup routine to pair it with my iPhone so I could use the remote monitoring app.  I turned off the thermometer, which appeared to be ready for my big pork cookery the next day, and left it charging overnight.

In the morning I fired up the Egg and put my pork shoulder in.  Hooked up the thermometer and turned it on.  But the iPhone app no longer recognized the thermometer.  Since the pork was already  cooking and I didn’t want to open the Egg, I continued cooking it without the app, periodically running outside in the cold to check the temperature display.

Battery Fail

Yes, that’s an extension cord.  Adding insult to injury, the battery died five hours into the cook!

I found that the only way to make the remote monitoring app work was to repeat the cumbersome setup process every time the thermometer was turned on.  I tried calling tech support, where a courteous but untrained rep couldn’t solve the problem either.  According to several reviews posted to the Williams-Sonoma website, others have had similar results.

Error Message

So back to the store went thermometer #2, for a refund this time.  A week later my friend attended an in-store cooking class, where they demonstrated the Smart Thermometer.  It didn’t work.

BTW, I ended up ordering a Maverick remote read wireless thermometer from Amazon for $60, which I’m satisfied with.  It doesn’t look as elegant as the WS thermometer and it doesn’t connect to my iDevices, but it’s cheap and it works.  Plus, this thermometer comes with two probes, so you can remotely monitor both the food and grill temperatures.

Problem solved.

Did you hear about the Rabbi who didn’t charge for circumcisions?

He only took tips!

I don’t charge friends for repairing their electronics, which I’m always glad to do and genuinely enjoy.  But I’ll happily accept a bottle of wine as a token of appreciation.  Sometimes people are really happy to get their stuff fixed.

Look at the pile of swag that my overly generous friend laid on me for putting a new LCD screen in her MacBook Pro!!!

Booty!

That’s two bottles of (very good) wine, a trivet from Williamsburg, a rotary cheese grater and a bag of tasty nuts.  Youza!

A month of many Macs

iMac glass panel

The 500 GB hard disk in my friend’s circa 2008 24″ iMac started making ominous clicking noises last week.  Anticipating its near future death, we took a full backup and ordered a bigger 1 TB drive from Amazon.

Apple never ceases to amaze me with the variety of ways they find to hide fasteners (and make upgrades and repairs to their equipment nightmarishly difficult).  In the case of this iMac, one needs to remove a glass panel held on with magnets to gain access to the internals.  The panel can be removed with a couple of these fancy suction cup tools but I prefer to do it ghetto style with a couple of sink plungers.

After pulling off the glass panel, removing around three dozen screws of at least eight varieties, and unplugging several needlessly fragile connectors, the display panel can be removed and the iMac’s guts are exposed.

iMac Guts

The actual hard disk swap is a walk in the park.  Reassembly brings one extra reward.  The combined effect of the glossy LCD display behind the glossy glass cover is a fingerprint magnifier that exceeds the capabilities of the world’s finest CSI labs.  It took six [expletive deleted] install/test/remove/clean cycles to get a smudge free display.  Thanks Apple.