Tag Archives: project

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.

Building a Wifi Radio – Part 4, Installing OpenWrt

This is the fourth part of an ongoing series about building a low cost, open source streaming internet radio.  If you haven’t already, check out parts one, two, and three for some background about the project.

At this point you should have an Asus WL-520GU wireless router with a serial port header installed and some way of communicating with the serial port from your PC.  If not, go back to part three.

What is OpenWrt?

According to openwrt.org:

OpenWrt is described as a Linux distribution for embedded devices.

OpenWrt replaces the stock firmware on the WL-520GU with an open source Linux distribution that aims to be extremely powerful and flexible.  This is important for us because in turning a wireless router into a Wifi radio, we using the device in a way that the manufacturer never intended for it to be used.  In addition to including a stripped down version of the Linux operating system, drivers for wireless networking and all the basic functionality of a residential network gateway, a package manager called opkg allows you to install a wide variety of add-on modules to extend the functionality even further.

Setup:

To install OpenWrt on the WL-520GU you will need a few things:

  • Your Asus WL-520GU wireless router, modified to allow access to the internal serial port
  • A 3.3V USB-serial cable like the FTDI-232-3V3
  • A short ethernet cable (a crossover cable is not required)
  • A desktop or laptop computer with an open USB and ethernet port
  • A terminal program such as ZTerm or Hyperterminal
  • A TFTP client, (surprisingly) included with most operating systems.  I’ll be using the one included with OS X.
  • A WiFi network with a reasonably simple encryption scheme (ie. none, WEP, WPA)

If you want to compile your own OpenWrt image and optional packages, you’ll also need

  • A machine running Debian or similar Linux operating system, or if you are really ambitious, a Mac running OS X.  I won’t cover compiling OpenWrt using OS X here, but there are several issues that prevent it from being straightfoward, the first of which is that OS X does not use a case-sensitive filesystem by default.

Note: If for any reason you need to go back to the stock firmware, you can download it from Asus here (enter WL-520GU into the search field on the left).

Getting OpenWrt:

There are two ways to do this:

The hard way:

Visit the OpenWrt Wiki and read the instructions on Installation.  Follow these instructions to build Kamikaze (Kamikaze is the current OpenWrt distribution).  Download the source with subversion (svn), and compile it yourself.  This method requires a moderate level of skill with Linux, but if you can compile your own kernel you should be able to compile OpenWrt.  You will need to link to the feeds for madplay, mpc, and mpd (as well as any other 3rd party packages you want) before executing make menuconfig, by using the scripts/feeds command.  Here is the sequence of commands I used, yours may differ slightly:

svn co https://svn.openwrt.org/openwrt/trunk/ ~/kamikaze
cd ~/kamikaze
./scripts/feeds update -a
./scripts/feeds install madplay mpc mpd
make prereq

If make fails, you may need to install some optional Linux tools, such as gawk, bison, or gcc.  On Debian I used the apt-get command to do this

apt-get install gawk bison gcc

Once you have all necessary prerequisites installed, you can configure the build with

make menuconfig

You’ll need to set the following options:

  • Target System (Broadcom BCM947xx/953xx [2.4])
  • Target Profile (Generic, Broadcom WiFi (default))
  • Select all packages by default
  • Image configuration —>
    • Base system (Added 12/18/08 to support part six)
      • busybox (press enter to open hidden menu)
        • Configuration
          • Coreutils
            • stty
    • Kernel modules
      • Sound support
        • kmod-sound-core
      • USB support
        • kmod-usb-core
        • kmod-usb-ohci
        • kmod-usb-audio
    • Sound
      • mpd
      • mpc
      • madplay

Once you’re done, exit, saving the configuration.  Then execute

make world

This will take quite a while.  If the build fails, you will be prompted to run make again

make world V=99

and fix any problems that occur, based on the error messages.  The OpenWrt forums are a good place to get help, but do a quick search before you post to avoid asking a question that has already been answered.

If the build completes successfully, you should be left with a bunch of files in the kamikaze/bin directory, including openwrt-brcm-2.4-squashfs.trx, the main image file, and a bunch of packages in the bin/packages/mipsel directory.

The easy way:

I’ve already done the hard work for you.

Download my precompiled openwrt-brcm-2.4-squashfs.trx image.

Addon packages (you’ll need a few of these when we configure the router later) are located here.

Installing OpenWrt:

Connect your FTDI cable to the serial port on the router that you added in part three.  Launch your favorite terminal program and connect to the router at 115200 baud, 8N1.

Connect the LAN1 port of the router to your computer using a short ethernet cable.  The router is hardcoded to be 192.168.1.1 on boot, and we need to configure our computer to talk to that address.  I set my Macbook to use a static IP of 192.168.1.185.  You may need to set a gateway to 192.168.1.1.  If your home network is also on the 192.168.1.x subnet, you will need to disconnect/disable it.  On my Macbook, this meant disabling the internal wireless and losing internet access while the router was connected.  (Eventually I got tired of this and moved my home network to 192.168.24.x, but that is outside the scope of this tutorial.)

Press and hold the Restore button on the back of the router and plug in the power cable.  The Restore button is shown just to the right of the red EZSetup button here:

WL-520GU Restore Button Closeup

Continue holding the Restore button until the power LED starts flashing once a second.  Release the restore button.  In your terminal window, you should see some boot messages and then

Reading :: TFTP Server.
Failed.: Timeout occured
Reading :: TFTP Server.
Failed.: Timeout occured

and so on (the messages will repeat forever).

Now it’s time to transfer our .trx file to the router.  These instructions are for OS X.  Instructions for other operating systems are here.

cd ~/kamikaze/bin
tftp
trace
timeout 1
mode binary
connect 192.168.1.1
put openwrt-brcm-2.4-squashfs.trx

On the serial console you should see (exact numbers may vary):

Reading :: TFTP Server.
TFTP_BLKLEN!!
break!! last block!!
Done. 1918724 bytes read
Download of 0x1d4704 bytes completed
Write kernel and filesystem binary to FLASH (0xbfc20000)
Programming...
copysize=1918724, amtcopy=1918724

If you don’t see this, chances are your computer is not talking to the router.  Most likely this is a configuration problem with your ethernet port or you don’t have the cable connected to a LAN port of the router.

If it worked, wait a couple minutes (don’t touch anything, unplugging the router at this point could brick the router!)  Eventually you should see the message

done. 1918724 bytes written

After this message appears (it typically takes 3-5 minutes for the whole process) unplug the router, wait a few seconds, and then plug it back in again.  In your serial terminal window, you should see the Linux boot messages again, but the process will pause briefly while the jffs file system is created.  Once the router has finished booting, you’ll see a couple messages like this

mini_fo: using base directory: /
mini_fo: using storage directory: /jffs

Press enter and you should now see the OpenWrt banner and a shell prompt

BusyBox v1.11.2 (2008-10-02 20:59:06 PDT) built-in shell (ash)
Enter 'help' for a list of built-in commands.
  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 KAMIKAZE (bleeding edge, r12831) -------------------
  * 10 oz Vodka       Shake well with ice and strain
  * 10 oz Triple sec  mixture into 10 shot glasses.
  * 10 oz lime juice  Salute!
 ---------------------------------------------------
root@OpenWrt:/#

Congratulations!  You have successfully installed OpenWrt!

A complete log of the first boot is available here.

Configuring OpenWRT:

There is a lot of information on the OpenWRT Wiki with regard to Configuring Kamikaze, but I will walk through the fairly basic configuration I am using here.  To follow along, you will need to be comfortable using vi (if not, check out this quick reference card.)

You should be able to use your serial terminal to execute the following commands.  I had issues using the arrow keys to navigate in vi and had to use the basic movement keys instead (h=left, l=right, k=up, j=down).

Before we can get the router on a WiFi network we need to modify a couple files.

root@OpenWrt:~# vi /etc/config/wireless

You should edit this file to look like this (changes are in bold)

config wifi-device  wl0
	option type     broadcom
	option channel  2  # the channel your wireless network is on

	# REMOVE THIS LINE TO ENABLE WIFI:
	# option disabled 1 (comment out or remove this line entirely)

config wifi-iface
	option device   wl0
	option network	lan
	option mode     sta  # configures the router to connect to your network
	option ssid     MyNetwork # the SSID of your network
	option encryption wep  # the encryption mode of your network
	option key	XXXXXXXXXX  # add this line with your WEP key in place of X...X

Now we need to modify the networking configuration to use DHCP (this should apply for most people):

root@OpenWrt:~# vi /etc/config/network

Scroll down and look for the LAN configuration section, and edit it to look like this (note the dhcp option in bold, also comment out the last two lines as shown):

#### LAN configuration
config interface lan
      option type     bridge
      option ifname   "eth0.0"
      option proto    dhcp
      #option ipaddr   192.168.1.1
      #option netmask  255.255.255.0

Lastly, verify that resolv.conf is set correctly.

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

You should see the following line (this assumes the router will get a valid DNS server address via DHCP, if not, you can set it manually here):

nameserver 127.0.0.1

Then execute the following command:

root@OpenWrt:/# /etc/init.d/network restart

After a moment, if everything is working, the AIR light on the router should turn on and you should be able to ping some servers by name.

root@OpenWrt:/# ping www.google.com
PING www.google.com (74.125.19.104): 56 data bytes
64 bytes from 74.125.19.104: seq=0 ttl=240 time=20.113 ms

If you made it this far, congratulations!  You now have a working embedded Linux device on your WiFi network!

That concludes part four of this series.  In part five, I’ll cover installing addon packages using opkg.  If we’re lucky, we’ll get the router to play some tunes!

Update: Part five is now available.

Update 2: There is a new Wifi Radio Discussion Forum, hop over there to ask questions about the project or see what other people are working on!  (4/12/09)

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

This is the second part of an ongoing series about building a low cost, open source streaming internet radio.  if you haven’t already, check out part one for some background about the project.

Onward…

In part one, I discussed the merits of streaming internet radio and the motivations for my Wifi Radio project.  Now it’s time to start looking at what hardware can make this project a reality.  Before we get started, let’s review the requirements list from last time.

Requirements:

  • Wireless connectivity through existing Wifi network
  • Audio output (preferably 44kHz, 16 bit stereo)
  • An integrated amplifier and speaker(s)
  • Shoutcast/MP3 streaming audio decode
  • Several builtin station presets
  • A display to indicate the station and currently playing song
  • Simple user interface, using standard radio controls (volume, tune, etc)
  • 110VAC operation

There are two additional requirements that I implied in the first post but forgot to include explicitly:

  • Cheap, priced below a commercial streaming radio – target < $100.
  • Small size so it can be portable (no desktop PC’s allowed!)

Selecting the hardware:

How do these requirements translate into hardware?  Let’s take a stab at what features we’d like in an embedded platform.

  • A wireless interface
  • Audio output
  • Sufficient system resources (CPU, memory, etc.) to decode MP3s
  • Some extra IO for a control panel and display
  • Low cost
  • Small size
  • Ease of development

The size and cost aspects pushed me towards an embedded system instead of a small form factor PC like any of Shuttle’s XPC offerings or a nano-ITX board.  To me, “Ease of development” equals Linux, so I wanted something well supported by Linux and an active open source development community.

There are quite a few embedded Linux platforms out there, with a wide variety of prices and features.  I looked at a few of them, including:

  • The Tin Can Tools Hammer – very impressive ARM9-based board with USB, lots of RAM and flash, lots of IO, and best of all the footprint of a 40-pin DIP package (breadboard compatible!).  No wireless and relatively steep pricetag ($160).


  • TI‘s Beagle Board – Incredible featureset including DVI output and a 600MHz ARM Cortex core.  No wireless and price is stunning for what you get, but overkill for this project ($150).  (Must keep in mind for future projects!)


    ASUS WL-520gU Wireless Router

  • Consumer wireless routers like the Asus WL-500gP v2 and WL-520GU – builtin wireless (yay!), USB, 240MHz Broadcom 5354 core, decent RAM and flash, cheap. Newegg has the WL-520GU for an incredible $26 after rebate (normally $50). The higher end WL-500g has more memory and flash and an integrated USB 2.0 hub (2 external ports).  Newegg has the WL-500g Premium V2 for $50 after rebate (normally $80). Both versions are a steal for what you get.

Tiny, under $50 and with built-in wireless, the Asus WL-520GU is the clear winner for this project.  The downside?  Since this router was never intended to do anything other than, well, route, we’re going to have to crack it open, modify it, and void the warranty.  In addition, there is no tech support and we’re going to have to spend some extra time hacking around to get it to do what we want.

Here it is in all it’s glory:

Asus WL-520GU Wireless Router Asus WL-520GU Wireless Router

Here’s a sneak peak of the inside:

Asus WL-520GU Wireless Router Asus WL-520GU Wireless Router

This router is supported by OpenWRT, an open source Linux distribution for small embedded devices.  Ignore the work-in-progress designation, it works, trust me!

Although the router lacks builtin audio, that is easily solved with an $8 SYBA SD-CM-UAUD USB Stereo Audio Adapter. There have been reports that the WL-520GU only supports USB 1.1 reliably, but USB audio doesn’t require USB 2.0 so it’s not an issue for us.  For full USB 2.0 support, look at the WL-500gP v2 instead.

So far we have $58 into the project ($38 if you are lucky enough to get the rebate) and we have an embedded Linux computer, a wireless interface, and an audio output.  Not bad!

That’s it for part two!  In part three I’ll install a serial port on the router and get ready to reflash the stock firmware with OpenWrt.  At that point we’ll be able to start listening to some tunes!

Update: I posted detailed specs for the WL-520GU and a couple more photos here.

Update 2: I posted some images of the $8 USB-Audio Adapter I am using as well.

Update 3: Part three is now available.

Update 4: There is a new Wifi Radio Discussion Forum, hop over there to ask questions about the project or see what other people are working on!  (4/12/09)

Building a Wifi Radio – Part 1, Introduction

This article is the first of a series that will document the development of a low cost, open source wireless streaming internet radio receiver.  All construction details, including schematics, source code, and even the design process itself will be documented on this blog.

Comments and (constructive) criticism are welcome. Click here to post a comment.

Table of Contents:

  1. Building a Wifi Radio – Part 1, Introduction (you are here)
  2. Building a Wifi Radio – Part 2, Choosing an Embedded Platform
  3. Building a Wifi Radio – Part 3, Hacking the Asus WL-520GU
  4. Building a Wifi Radio – Part 4, Installing OpenWrt
  5. Building a Wifi Radio – Part 5, Let’s Make Some Noise!
  6. Building a Wifi Radio – Part 6, A Conversation with Mpd
  7. Building a Wifi Radio – Part 7, Building an LCD Display
  8. Building a Wifi Radio – Part 8, Adding a Tuning Control
  9. Building a Wifi Radio – Part 9, A Few Odds and Ends
  10. Building a Wifi Radio – Part 10, Building the Box

Some background:

According to Wikipedia, in 1993 the first internet radio program began distribution.  At that time, radio programs were manually downloaded to be played later on the user’s home computer; the user experience was far from that of listening to a traditional broadcast radio receiver.  It was not until several years later that streaming radio became common, giving birth to internet radio stations that could be listened to much like traditional radio, but with several advantages.  Most notably, internet radio stations were (and still are for the most part) largely devoid of on-air advertising, and stations anywhere on the globe could be received by anyone with access to the internet.  Over time, improvements in audio compression (such as MP3) and larger end user bandwidth improved the fidelity and reliability of internet radio.  The birth of common standards like Shoutcast made it possible to listen to many stations with a single player program, like Winamp.

Today, most music playback software supports streaming radio in some way.  iTunes features thousands of streaming radio stations and even supports Shoutcast streams so that users can easily add additional stations of their own.

The beautiful thing about streaming radio is the huge diversity in programming that is available.  Many college radio stations have a streaming server, like KDVSDigitally Imported hosts many electronic and dance music streams that give the listener the choice to listen to specific genres like ambient or gabber hardcore (whoa).  Broadcast radio usually lumps all electronic dance music into one category, much to the dismay of their listeners (who probably tuned out during the commercial break, anyway).  Gems like Slay Radio specialize in music you would never hear on broadcast FM, like Commodore 64 remixes.

In the past couple years, products have started to appear that mimic the form and function of a traditional radio, but play internet radio instead.  Good examples of these are the Roku SoundbridgeRadio and the ASUS Internet Air.  Remote speaker devices, such as the Apple Airport Express, require a PC to receive and relay streaming radio but achieve a similar end result (but don’t really look much like a radio).

The Wifi Radio project:

I have been wanting to build a streaming radio for some time.  I frequently work in my garage, where I occasionally use my Macbook to play music through a small amplifier and bookshelf speakers.  The problem is that my laptop is not always set up in the garage, and greasy fingers are not a good thing to have around a white laptop, period.  I could simply buy an internet radio, but I couldn’t stomach the $150-$300 price tag on most players for such a luxury.

So I decided to build one instead.

I started the design process by drafting an outline of desired features, and then breaking them down into wants and needs, while trying to keep the project scope under control.

Requirements:

  • Wireless connectivity through existing Wifi network
  • Audio output (preferably 44kHz, 16 bit stereo)
  • An integrated amplifier and speaker(s)
  • Shoutcast/MP3 streaming audio decode
  • Several builtin station presets
  • A display to indicate the station and currently playing song
  • Simple user interface, using standard radio controls (volume, tune, etc)
  • 110VAC operation

Optional features:

  • Line output (to connect to a receiver/amplifier)
  • Web server for configuration/management
  • Ability to play files off a USB stick or iTunes server

Definitely won’t be a feature:

  • Any kind of over-the-air radio tuner
  • Commercials
  • Pledge season
  • Morning DJ’s
  • “Blah, blah, blah.”

Now that we’ve defined the project…  it’s time for a commercial break.  That’s it for part 1 of this series.  Stay tuned for part 2, where I’ll talk about choosing an embedded platform for the design and why Linux is so awesome!

Update: Part two is now available, click here to see it!

Update 2: There is a new Wifi Radio Discussion Forum, hop over there to ask questions about the project or see what other people are working on!  (4/12/09)

Update 3 (6/1/09): I finally added a table of contents to the top of this post to help everyone (including me) navigate the series!

PID Controlled Solder Paste Fridge

PID Controller closeup

I recently decided I needed to upgrade my garage electronics bench to include capability to work on surface mount components.  I ordered a hot air reflow station and some no-clean solder paste from SRA.

Solder paste is a little tricky to handle, because most solder paste needs to be refrigerated at 32-50°F to maintain it’s shelf life.  Stored at room temp, it tends to get tacky and dry out within a few weeks.  Solder paste is also toxic (it contains lead among other things) so it’s not something you want to put in the fridge with your meatloaf.

I had an old beer cooler sitting in the garage that Kylie picked up on the street a while back.  It uses a Peltier thermoelectric cooler to cool the inside and can achieve sub-freezing temperatures.

PID Controlled Solder Paste Fridge

Since I didn’t want to leave the cooler on constantly, and below freezing is actually too cold for solder paste, I decided to add a PID controller to the cooler to create a solder paste fridge for the garage.  To do this, I needed the following items:

  • Love Controls 16A PID Controller found at a surplus store.  This one happens to run on 12V and also has a 15V output which made things simple, but other configurations are possible and almost any PID controller should work provided it supports “direct” mode (for cooling instead of heating) and has a relay or switched voltage output.
  • K-type thermocouple to measure the inside temperature of the cooler
  • power MOSFET capable of switching 12V @ at least 5A, lower on-resistance is better.
  • 1k bleed resistor to ensure the MOSFET turns off when it’s supposed to
  • a small heatsink for the MOSFET (may be unnecessary, mine doesn’t even get warm)

Since the PID controller happens to run on 12V I was able to use the existing 12V power supply for the cooler to power everything.  I configured it so that if the desired temperature is below the current temperature, the PID controller turns on the MOSFET which supplies power to the Peltier cooler and it’s associated fans.

The only hangup I had was that at first I didn’t place the 1k resistor across the output of the controller, and the cooler would stay on constantly.  It turns out that because MOSFETs have almost no gate current, once the PID controller turned off it’s 15V output, the gate of the FET would continue to float high.  The bleed resistor to ground ensures that this can’t happen, and the FET turns off properly.

Here’s a picture of the finished solder paste fridge complete with PID controller (click for a larger version).

Finished PID Controlled Solder Paste Fridge

You can check out a bunch more photos of the cooler on flickr.  It should be possible to perform this modification on a more conventional mini-refrigerator as well for better control over the temperature, provided it uses a Peltier cooler, or maybe you could even build the whole thing from scratch using a Peltier cooler off ebay.