All posts by Jeff

Electrical engineer, tinkerer, maker.

Bluetooth Handset Hack

Bluetooth Handset Hack

Kylie recently gave me an old, broken Motorola HS820 bluetooth headset.  The headset suffered from a defective microphone that resulted in extremely low volume on outgoing audio, even though everything else worked fine.

Upon receiving it, I proceeded to rip the headset apart, interested to see what was inside.  I found a fairly simple PCB with a discrete bluetooth module in the center.  The PCB is not labeled, but given that this is an older headset (3-4 years old) most of the connections are large enough to attack with a pencil iron and solder wires to.

This headset was begging for a project.

Motorola HS-820 PCB - Back

On my last trip to Weird Stuff, I came across the beauty shown below.  The instant I saw it (and three other boxes full of others like it) I knew exactly what I was going to do with the broken headset: make it into a Bluetooth Handset instead.

Shown below is a vintage International Telephone & Telegraph telephone handset.  ITT manufactured phones in the 60s and 70s;  later they spun off that part of the business to Alcatel and then got into some trouble with the government in 2007.

Vintage ITT Telephone Handset

The handset has some heft to it and feels great to use.  It is amazing how accustomed we have become to using extremely ergonomically poor cellphones.  Just compare the shape and size of a modern cellphone to a handset like this and you can understand why it is so refreshing to pick up and use one of these.

They don’t make them like this anymore.  Unscrewing the faceplates reveals a speaker and a microphone which falls out onto the floor if you’re not careful.  I remember phones like this when I was very young but hadn’t seen one in years.

Vintage ITT Telephone Handset

Sticking the guts of the HS820 into the handset was not that difficult or time consuming.  The speaker works as-is.  It turns out the impedance of the speaker that came with the bluetooth headset is around 30 ohms, while the vintage handset speaker is 42 ohms, close enough.  The audio quality is excellent!

The original microphone on the HS820 was an electret, which is not the same as the carbon style on the handset.  Despite this, I was able to get the microphone on the handset to work by adding a 1k series resistor and wiring it to the same terminals on the headset as the original.  Without the resistor, my voice was too loud and distorted.  The value took some experimentation and I may continue to play with it, or eventually give up and install a modern electret style mic instead (but the original is just too cool).

I added a pushbutton to replace the multifunction button on the headset.  Holding down this button turns the handset on and off.  Pushing it answers calls and probably does other stuff that I haven’t played with.  The headset has volume buttons too, but the volume can be controlled via software so I didn’t wire them up to anything.

Pushbutton

I also added a charging jack where the cord originally was.  The washer is needed to fill the relatively large opening for the cord.

Charging jack

A ridiculously bright blue LED is wired in place of the status LED on the headset.  I found the LED holder in my junk box.

Bluetooth Handset Hack

This shows the connections for the pushbutton (yellow and green wires in the center) and the LED (red and black in the bottom center).  I removed the original pusbutton with my hot air rework station and soldered the new wires in place, then put a dab of hot glue on top to keep them in place.  The big blue thing in the middle is the bluetooth module.  I imagine that modern headsets do not have a discrete PCB for this.  The HS820 PCB tucks inside the center of the handset when installed and stays in place without any special mounting.

Bluetooth Handset Hack

The other side of the HS820 PCB shows the 3.7V lithium battery and the connections for the microphone (lower left), speaker (lower right) and charger (upper right).  The battery is glued to the PCB.

Bluetooth Handset Hack

I modified the Motorola charger that came with the headset by cutting off the original 3 pin plug and replacing it with a 4.7mm power connector to match the jack on the phone.  The third pin of the original connector wasn’t being used anyway.

Bluetooth Handset Charger

To charge the handset, you just plug in the charger.  The LED lights up to show that the handset is charging and goes out when it’s done.  It flashes during normal use, blinding spectators.

Charging

I’m planning to use this for Skype on my desktop computer, but I may just have to carry it around for a few days to see what other people think of it…

Update: As mentioned in the comments, these are for sale at ThinkGeek.com, search for “retro handset”.

Update 2 (11/20/09): Welcome, Make: readers!  Questions about this project?  Head over to the forums for help!

Building a Wifi Radio – Part 5, Let’s Make Some Noise!

This is the fifth part of an ongoing series at mightyOhm about building a low cost, open source streaming internet radio.  If you haven’t already, check out the previous parts below for some background about the project.

Building a Wifi Radio – Part 1, Introduction

Building a Wifi Radio – Part 2, Choosing an Embedded Platform

Building a Wifi Radio – Part 3, Hacking the Asus WL-520GU

Building a Wifi Radio – Part 4, Installing OpenWrt

Note:

The instructions that follow assume that you have an Asus WL-520GU wireless router with the following modifications: an externally accessible serial port, OpenWrt installed and working, and a configured network connection on the router.  If not, check out the previous parts of the series to learn more.

Using opkg to customize OpenWrt:

OpenWrt includes a utility called opkg that allows the end user to easily add and remove optional software packages.  These packages include functionality that is not a part of the OpenWrt base image, such as hardware drivers (including USB), optional software, and utilities.  Most packages are not installed by default (after all, the router only contains 4MB of flash storage).  The OpenWrt Community Wiki includes a very helpful page about Packages that contains a lot of useful information about configuring and using opkg.

Before we can use opkg we need to configure it.  The file /etc/opkg.conf contains a few options, including the URL of the server opkg uses to find and download packages.  We need to change this server from the default by modifying the config file:

root@OpenWrt:~# vi /etc/opkg.conf

Modify the first line to look like this:

src/gz snapshots http://mightyohm.com/files/kamikaze-2.4/packages/mipsel 
dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists

You can also download the complete set of packages and set up a server of your own for opkg to access.  I have had great success using the apache server included with OS X, but I won’t cover the setup here.

The following command tells opkg to fetch a list of available packages from the server:

root@OpenWrt:~# opkg update

You should see the following response:

Downloading http://mightyohm.com/files/kamikaze-2.4/packages/mipsel/Packages.gz
Connecting to mightyohm.com (72.32.209.132:80)
Packages.gz          100% |*******************************|  8326  --:--:-- ETA
Inflating http://mightyohm.com/files/kamikaze-2.4/packages/mipsel/Packages.gz
Updated list of available packages in /var/opkg-lists/snapshots
Signiture check for snapshots skipped because GPG support was not enabled in this build

Now we can start installing packages.  To access our USB-audio converter, we need to install USB 1.1 (OHCI) support and some sound drivers:

root@OpenWrt:~# opkg install kmod-usb-audio kmod-usb-ohci

This should automatically install kmod-usb-core and kmod-sound-core, but if not you can also install them manually with the opkg install command.

At this point you should insert the USB-audio converter if you haven’t already.  Then reboot the router:

root@OpenWrt:~# reboot

As the router is booting again, watch for new status messages like these:

...
usb-ohci.c: USB OHCI at membase 0xb8003000, IRQ 6
usb-ohci.c: usb-00:03.0, PCI device 14e4:471a
usb.c: new USB bus registered, assigned bus number 1
usb.c: registered new driver audio
audio.c: v1.0.0:USB Audio Class driver
usbaudio: device 2 audiocontrol interface 0 has 1 input and 1 output AudioStreaming interfaces
usbaudio: device 2 interface 2 altsetting 1 channels 1 framesize 2 configured
usbaudio: valid input sample rate 48000
usbaudio: valid input sample rate 44100
usbaudio: device 2 interface 2 altsetting 1: format 0x00000010 sratelo 44100 sratehi 48000 attributes 0x01
...
usbaudio: registered dsp 14,3
usbaudio: constructing mixer for Terminal 6 type 0x0301
...

If you see this, the USB-audio converter is most likely working and the correct drivers have been loaded.  At this point the green LED inside the USB-audio converter should be lit, another sign that everything is working correctly.

Installing mpd:

To actually play some tunes we need to install some additional software.  We can use opkg to do this, as follows:

root@OpenWrt:~# opkg update

root@OpenWrt:~# opkg install mpd mpc

This command installs mpd, the music player daemon.  mpd is an open source music server that can be accessed locally or across a network by using a variety of clients, which are available for many different platforms.  This includes the command line client mpc which is also now installed on the router.

mpd requires some setup before we can use it:

root@OpenWrt:~# cd ~
root@OpenWrt:~# mkdir .mpd
root@OpenWrt:~# mkdir music
root@OpenWrt:~# mkdir .mpd/playlists
root@OpenWrt:~# vi /etc/mpd.conf

Scroll down and look for the audio_output section of the mpd configuration file, and change the reference to /dev/dsp to make it look like this:

# An example of an OSS output:
#
audio_output {
        type                    "oss"
        name                    "My OSS Device"
        device                  "/dev/sound/dsp"
        format                  "44100:16:2"
}

There are many other options you can play with; mpd is very powerful.  There is a list of features here and a lot more information on the mpd wiki.

Exit vi, saving the changes to mpd.conf.  Now launch mpd with the following command:

root@OpenWrt:~# mpd

The player should start silently, without errors.  Run mpc and verify that it can talk to the server:

root@OpenWrt:~# mpc
volume:100%   repeat: off   random: off

If you see this, good news, the server is running and we have the ability to control it with mpc!

Now would be a good time to connect speakers or headphones to the USB-audio adapter’s headphone output.  Warning – the initial volume can be VERY LOUD. Don’t wear headphones during testing!  PC speakers with a volume control are best.  Start at a low volume.  (My ears are still ringing!)

We can add a streaming radio server to the playlist by executing

root@OpenWrt:~# mpc add http://relay3.slayradio.org:8000/
adding: http://relay3.slayradio.org:8000/

And finally, the moment of truth:

root@OpenWrt:~# mpc play
http://relay3.slayradio.org:8000/
[playing] #1/1   0:00/0:00 (100%)
volume:100%   repeat: off   random: off
root@OpenWrt:~#

If all goes well, within a few seconds you should hear Slay Radio playing on your headphones or speakers.  The Air light on the router should flicker as traffic crosses the WiFi interface, and the green light on the USB-audio converter should flash repeatedly to indicate that audio is being sent to the device.

If you’ve made it this far, I recommend celebrating with your favorite beverage and enjoying some tunes!  Congratulations!

You can add other servers to the playlist by executing the mpc add command again, and then play them with the mpc play n command, where n is the position of the server in the playlist.  mpc playlist will display the current playlist. mpc help will give you a list of available commands.

One very powerful feature of mpd is that it operates as a server on port 6600 of the router, so it can be controlled from any other device on your local network.  If you download an mpd client such as Theramin, you can control the router remotely from your desktop computer.  There is an excellent client for the iPhone too.

That’s it for part five.  I hope you have enjoyed the series thus far.  In part six, we’ll start writing some scripts to control mpd and talk about options for a user interface.  If you are building a Wifi Radio of your own, I’d love to hear about it – leave a comment below!

Update: Part six is now available.

Noise sensitivity of USB-serial converters?

I am experiencing a frustrating problem that I have seen using more than one brand of USB-serial converter.

I use a USB-serial converter as part of a Megasquirt system on my car.  When exposed to ignition system noise on the car, the USB-serial converter will lock up and stop transferring data until I disconnect and reconnect the USB connection.

Has anyone else seen this?

Just today I mocked up my serial setup on the bench and used a Van de Graaff generator to create some broadband noise to try and simulate the effect of the car’s ignition system.  Sure enough, eventually the USB-serial converter I was testing locked up.  Same exact symptoms – crash.  Without the noise source, the connection works indefinitely.