June 2013 Archives

Home audio

Most of the time I listen to music in my home office which has a nice set of Harman/Kardon computer speakers and subwoofer. I also listen in my kitchen, where I have a Logitech S715i Portable 30-Pin iPod/iPhone Speaker Dock, one of these:

logitech_speakers.jpgI listen to Sirius/XM satellite radio (in my home office), Spotify Premium, or occasionally songs in my iTunes library.

The biggest issue I run into is that my home office and kitchen are close enough that I frequently walk back and forth while doing things, and also can hear the other location in the background, so the audio being in sync is an issue. Fortunately, this was surprisingly easy to solve.

One part is the Airfoil software from Rogue Amoeba software. It runs on a desktop or laptop Mac or Windows PC.

airfoil1.jpg
I have the satellite radio connected to the audio line input on my Mac. Airfoil can also capture the audio from Spotify, iTunes, Pandora, etc. as well.

On the output side I have a couple options. I have an Apple Airport Express in the kitchen that provides Wi-Fi coverage and also conveniently provides an audio output. I just connected the Airport and the Logitech speakers with a 3.5mm stereo audio cable and that was it! Done!

The Logitech speakers have built-in rechargeable batteries and an Apple 30-pin connector. If I want to listen to music somewhere else, say outside, I can just pop in my iPhone 4 and run Airfoil Speakers Touch from Rogue Amoeba on my iPhone, and stream to that over Wi-Fi. Neat!

I also have Apple TVs in a few locations, and I can stream audio to those.

The nice thing about the Apple Airport Express, Apple TV and Airfoil Speakers is that they're smart enough to stay in sync with each other. I mean really in sync - you can stand in the middle between three different output devices and they match perfectly whether on Ethernet or Wi-Fi. They are delayed a second or two from the source, however.

What about at my desk? Airfoil handles that, too. If you select Computer, it will output audio synchronized to all of the other outputs. And, if the source is an application (like Spotify), it can intercept the output and only play the delayed, synchronized output through your computer speakers. At least it can on the Mac. That is very cool!

While I can run Spotify on my phone, running it on my desktop is usually a little easier because I'm mostly at my desk. If I want to change songs, play lists, radio stations, etc. when I'm not at my desk I use Remoteless for Spotify to control Spotify and Airfoil on my desktop Mac from my iPhone 5 and it's great! There's also a version for Android.

remoteless.jpg

And if you use Airfoil to stream Spotify to an Apple TV, the track info and cover art appears on the TV. That was rather unexpected.

Now that I figured out how easy it is I want to put inexpensive but reasonably good sounding computer speaker/subwoofer systems plugged into Airport Expresses all over the place!


Reading e-books

I had an occasion to need to read several e-books from Apress, purveyors of fine technical books. This brought up a question: what format do I download, as they support several, and how do I get it on my devices?

My solution turned out to be remarkably easy because my household is Apple and Amazon. I have iPhones, Macs, an iPad and a Kindle. I had the Kindle reader app on my iOS devices and Macs already, so that would be the obvious choice since I have it and I'm used to using it to read books from the Amazon store.

The Amazon book format (awz) is basically the same as an MOBI file, at least MOBI files that don't have any digital rights management (DRM), which, thankfully, Apress books do not.

And Amazon has a nifty Send to Kindle app for Mac and Windows. You basically drag and drop a file, in my case a .mobi file, on it and it gets uploaded to the Amazon cloud. It took less than a minute to get the books onto my iPad and I didn't  have to plug it in to sync! There's also a way to email a file to Amazon, but I find Send to Kindle much easier to use.

And it syncs the last read position across devices just like books from Amazon!


I should point out this is now what I originally tried. After doing a brief Google search on the topic I first tried the eBookMobi app for the iPad. The neat thing about this app is that it reads a ridiculously large number of formats and is compatible with DropBox, so you can put your books into DropBox to get them to your iPad.

My beef with eBookMobi is mostly the result of my using Kindle for iPad so much. I basically can't flip pages with eBookMobi. I hold my iPad in my left hand and use my left thumb to flip pages with the Kindle app. The eBookMobi app requires too much distance to flip so I have to use a finger instead of my thumb, at least given the length of my thumb. And making up/down drags change the screen brightness is infuriating. Half the time I went to flip the page I'd end up changing the brightness. It works, and lots of people like it, so it can't be all bad, but I didn't like it. And it's $ 1.99; the Kindle app is free, and in my opinion, much easier to use.


Also, it's probably not a bad idea to also download the pdf file, just in case. Also, the Kindle reader on the Mac does not support copy and paste, so the pdf is handy, especially for software development books where it's convenient to be able to copy and paste a block of sample code.

Scanner

I love news, whether a constant stream of world-wide news from Twitter down to the county fire/EMS scanner, I like knowing what's going on. To listen to a scanner requires either a radio or a one of a variety of online scanner services, which vary in quality and availability. The problem I have with online scanners is that they are based on the Internet radio model, which while obvious and simple to implement, is terribly inefficient. Unlike listening to the radio, the scanner is primarily silence, at least in the rural area I live in. So I implemented my own!

Due to topographical issues I can't pick up the Otsego County, New York, fire/EMS scanner with a portable scanner. So the first thing was to get a big antenna and put it on my roof. Check.

scanner1.jpg
And a scanner. It's actually not so much scanning, but permanently set to my local dispatch frequency of 46.440 MHz.

scanner2.jpg
That gets fed into one of my computers that's always running. A server running in Apache Tomcat (Java) listens to the audio input, locates the silence, and splits the incoming audio transmission into individual transmissions. It's separate app on the theory that I could deploy this on inexpensive single board computers to remote locations since that part doesn't take much CPU or bandwidth.

The fun happens on the second Tomcat webapp. Since dispatch calls are preceded by tones, it divides the sample into smaller buckets and runs a fast Fourier transform (FFT) on each bucket. From this I can detect the frequency and length of the tones. And from that, short tone pairs, long tones, and some other things that they use where I used to live. From a list I found online and some experimentation I know which department the call is for.

The first thing I did was write a simple HTML5/CSS/Javascript page to display and play the sounds. There's of course a server-side Apache Tomcat component as well. One of the important things is that there's a servlet that waits for new transmissions, holding the connection open for a period of time (currently, 55 seconds) and immediately returns the transmission if there is one, otherwise waits for timeout. This keeps the network traffic way down compared to constantly streaming audio. Typically, under 100 bytes per minute during silence.
scanner5.jpgThat was a good start, but the next step was making a native iPhone app. That made it work a little more smoothly than having to open up Safari.


scanner3.jpg
The real improvement was after I made it configurable.

scanner4.jpg
With a few clicks I can configure which squads I get push notifications for. It dramatically cut down on the number of notifications I got, because I was really only interested in what happened in the few towns closest to me, anyway.

And that's it! It's currently not open to the public mainly because I'd have to deploy it on a larger public server and pay for bandwidth, and it's not entirely clear if there's a lot of demand or benefit to doing so. And get the app approved by Apple. But it was a cool project, and I use it all the time.

Keyless Entry

I'm a big fan of this style of keyless entry for my house. This is the second house I've installed a system in, and I added several enhancements this time.

prox1.jpg
The idea is that you carry one of these cards in with you. It's a HID proximity card, and if you have a security badge for work that you wave at a reader, this, or something like it, is what's probably inside. I keep one in my wallet.

prox4.jpg
I have two doors with sensors, one into my semi-attached garage and one on my front door. You walk through an open breezeway to get between my garage and house, so I needed readers on both sides. The beauty is that I don't have to take the card out of my pocket to use it, I just need to get it within an inch or so of the reader, which is great when your hands are full!

Both doors have electronic lock strikes installed, so you don't have to unlock the door, or even turn the knob. And, conveniently, both doors open in, toward the secure side, so if your hands are full, you just have to lean against the door and it pops open. Very convenient!

prox2.jpg
On the house side, I decided to only require one-factor authorization. I have an alarm system, and it's set to disarm with a valid card. I can easily switch to two-factor authorization, so you'd need the card and a PIN code for the alarm system, but I didn't really need that much security and having the alarm system automatically disarm when I come home is handy.

prox5.jpg
The HID proximity reader is a standard off-the-shelf part that only requires 12 VDC and communicates using the Wiegand two-wire serial protocol. There are a number of ways I could have handled this, but I used a Rabbit RCM-5700 embedded controller.

prox3.jpgThere's a relay for the lock strike and an input from the magnetic sensor to detect when the door is open. That's done so that once the door is opened, the lock strike can be locked again so the door will stay closed when you close it. There's a 74HC241 octal buffer to protect the Rabbit and provide additional driving capacity for the relay.

One of the reasons I used the Rabbit is that the Wiegand protocol doesn't have a particularly high bit rate, but it does have annoyingly narrow data pulses. The Rabbit has easy access to interrupt lines so I could catch the pulses, as they are far too narrow to reliably detect by polling.

The Rabbit can run completely standalone, handling card authentication and unlocking locally and I have it running off a UPS and it will run for a very long time since it doesn't use much power.

The beauty of the system, however, is that it communicates with another, much larger Apache Tomcat (Java) server that handles additional authentication, notification, interface to the alarm system and a bunch of other tasks. But that's a topic of another post.

Here's a case that has an interface to the alarm system, a Serial-to-Ethernet converter and a Rabbit.

prox6.jpg

About this Archive

This page is an archive of entries from June 2013 listed from newest to oldest.

April 2013 is the previous archive.

July 2013 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Categories

Pages