Summary

In 1997, I was trying to build a wearable computer, called the
PandaScope, using some embedded PC hardware from a variety of sources. The
result was too big and bulky to be truly wearable, and so the project was
shelved and I kept the parts (which cost over US$2000 at the time) in a box,
gathering dust.

In February, 2000, I heard about a device called the Lp3 that would allow
any PC with a parallel port to play MP3's. So I took the old parts of the
PandaScope out of the box, applied appropriate amounts of sweat and duct
tape, and KARR was born.

So what does it do? At the moment, I mostly use it to play Mp3's. Mp3 is
a digital music compression scheme that can reduce the size of a music file
by a factor of ten without noticable reduction in quality (although
audiophiles will argue the point). With only a two gigabyte hard drive, KARR
can store over twenty hours of encoded music. I've programmed in a number of
simple features such as 'start', 'stop', 'skip', and 'shuffle'; KARR has all
the benefits of an in-car CD changer for a fraction of the cost.

KARR is also a lot more flexible and interesting than a consumer-grade CD
changer that would cost $3000 at a stereo shop. In theory, KARR can do
anything a desktop 486/100 PC can do.

Hardware Design

CPU

The core of KARR was originally intended for use as a wearable computing
system - eg, a PC that you can carry around with you, that's 'always on' and
'always available'. This differs from laptops and PDAs in that you generally
don't have to dig it out/open it up/turn it on - it's 'always there'.

KARR is based on a CardPC, which is a system developed by SMOS,
Cell Computing, Oki, and others.
The CardPC is a credit-card sized motherboard with a 300+ pin 'EASI'
connector. EASI carries all the signals normally found on a full-sized PC/AT
motherboard, including serial ports, IDE hard drive interface, VGA,
keyboard, and so on. Several wearable computing designs use the CardPC
motherboard, including the
HackMan,
a wearable computer developed by Rehmi Post at MIT.

Parvus Complete Scalable CPU carrier board and a CardPC.
The image on the right is from the Parvus web site.
For more information about Parvus, visit http://www.parvus.com/

Generally, CardPC motherboards are inserted into a carrier board to turn
the physically-small EASI connector into something a little more familiar,
such as the .1-inch headers commonly used inside desktop PCs. KARR uses a
Parvus Scalable CPU card,
which is a PC/104-based carrier for CardPCs.

Multimedia

Lp3 unit.

KARR uses an off-the-shelf Lp3 to decode MP3 files. The Lp3 player simply
plugs into the parallel port cable from the CPU card, and has 1/8-inch
female jacks for headphones and line out. The Lp3 supports stereo Mp3
playback at over 200 kilobits per second and CD sample rates (44.1 khz).

A male-to-male 1/8-inch stereo cable is used to connect the line-out jack
on the Lp3 to the CD In jack on the vehicle's stereo. I could have also used
a CD-to-Casette adapter here if the car stereo lacked the CD In jack.

Control

KARR supports ordinary PS/2 mouse, keyboard, and VGA ports, as well as an
LCD interfaces for driving laptop-style LCD panel displays. However, none of
these are suitable for use while driving.

A VGA LCD interface is a workable but expensive solution, and requires
modification to the CardPC's BIOS. A cheaper and simpler option is a
Matrix Orbital display.
These are serially-interfaced, self-contained LCD display
modules suitable for use with a PC's serial port (aka a COM port).

Matrix Orbital displays are available in a variety of sizes, from ten to
forty columns, and from two to eight rows. All Matrix Orbital displays are
backlit and can run from a single 5-volt input. Displays may also include a
keypad encoder or an AT-style keyboard interface. Some displays support
simple line and bitmap graphical display.

KARR uses the GLK24064, which is a 240x64-pixel graphical display that
also supports up to 30 columns by 8 rows of text. Like all Matrix Orbital
displays, it is backlit and runs from a single five-volt power supply. This
model also includes a five-by-five keypad encoder.

KARR uses a four-by-four keypad from Digikey for input. The keypad module
plugs directly into the keypad encoder on the LK24064, which transmits
keystrokes over the same serial interface that drives the display. The
display module plugs into a standard 9-pin serial connector from the CPU
card.

Power

The power supply for KARR is a
V-104 Vehicle Power Supply
from Tri-M Engineering.
This is a PC/104-compliant card that turns inputs from 8 to 30 volts into
PC/104 supply voltages and provides power through the bus, eliminating the
need for additional connectors to the computer.

The V-104 is available with a variety of options, including A/C input,
connections to a batter backup, battery recharging from input power, and -5
and -12 outputs. This V-104 includes +12 volt output, so that it can drive a
desktop hard drive. The total power rating of the V-104 is 25 watts, which
is more than enough to drive the CPU (at 10 watts), hard drive (at 7 watts),
and LCD display (at less than one watt).

The V/104 uses the car's cigarette lighter port as a 12-volt power
supply. The Lp3 requires a 9-volt power supply. Since a PC internally only
has a 5-volt line (too little) and a 12-volt line (too much), the Lp3 takes
its power from a seperate voltage converter. In this case, an ordinary Radio
Shack power adapter is used. A splitter is used to allow the main computer
and Lp3 to share the same cigarette lighter port.

A Special Note on Power

I'm no expert on power supplies. However, I've gotten a few ideas about
embedded power supply design from experimentation and various sources:

Power supplies are generally rated in watts, but that number could refer
to either 'average' load or 'surge' load. For maximum safety, assume that
they are talking about the 'surge' load and try to get one with a rating 20%
to 30% higher than the sum of the maximum power rating of everything else in
the computer.

Although the current draw of embedded PCs is usually small, make sure
that the cigarette lighter can handle the load you're putting on it. A PC
similar to KARR will draw two to three amps. The cigarette lighter in my car
is fused for ten amps; your mileage may vary.

The power bus in your car is quite 'dirty', and only provides 12 volts
in an approximate sense. Do Not plug sensitive electronics directly
into a cigarette lighter. Use an intermediate power adapter to filter the
power into something predictable. The V-104 is sepcifically designed for
this kind of abuse, although even the cheap DC-to-DC converter from Radio
Shack could be enough.

It is possible to run down a car battery with KARR, although it will
take a while. I turn it off if I'm going to be away for more than a half
hour or so.

Storage

KARR uses a standard two-gigabyte desktop hard drive for storage. The
drive plugs into the IDE interface on the CPU card and is driven by the +5
and +12 volt outputs on the V-104 power supply. Any IDE hard drive can be
used, within the limitations of available power (about 10 watts).

Expansion

The CPU card provides all the usual PC expansion ports, including IDE,
floppy, CGA, VGA, a parellel port, a pair of serial ports, and PS/2 mouse
and keyboard ports.

KARR is also equipped with an Intelec PC Card adapter. This is a PC/104
device that will accept up to two Type II PC cards. Currently this interface
is only used for an ethernet connection during bench-testing, and for
changing the Mp3 files on the hard drive.

Software Design

KARR runs Linux, a UNIX-like operating
system whose components are available undef GNU and other public license. In
particular, KARR runs a subset of the Slackware version 7 distribution of
Linux. This distribution was selected because it is easy to trim Slackware
down to an embedded configuration.

Slackware was installed by attaching KARR's hard drive to a desktop PC
and running the normal install procedure. The hard drive was then removed
and installed in KARR. In the particular configuration used here, the
operating system takes up less than 300 megs and includes a full development
environment for working on KARR when a host PC is not available.

It is worth noting that it is possible to trim Linux down even further.
Some embedded distributions fit in 64, 32, 16, or 4 megs, and are suitable
for embedding on flash memory devices.

Lp3 Kernel Driver

The Lp3 is designed to play back Mp3 files using a hardware CODEC. The
Lp3 comes with a kernel module for the Linux operating system and provides a
standard file-like interface (/dev/lp3-0). This means that playing back an
Lp3 is a simple matter of streaming the Mp3 file to
/dev/lp3-0.

It is necessary to monitor the state of the Lp3 using ioctl() command
LP3_IOCGLEN. This command returns the amount of data remaining in the kernel
module's buffer. Closing the file prematurely will cause this buffer to be
discarded, and the last 30-60 seconds of the track will not be played.
Therefore, our application must wait after copying the last part of the file
to the driver for this buffer to be emptied. It is further advisable to wait
an additional ten seconds after the buffer is emptied for the Lp3 hardware
to finish playing through its internal (hardware) buffer, for similar
reasons.

LCD Interface

The Matrix Orbital LCD panel interfaces to the PC through a standard
RS-232 (COM) port. Reading and writing this display is a simple matter of
reading and writing to /dev/ttyS0. However, the GLK24064 display module does
not understand carriage returns or linefeeds. Also, the keypad only sends
ASCII characters A through Y, and does not send carriage returns. Therefore,
it's not practical to make a termcap entry and treat it as another terminal.
It is necessary to do some screen management in the application (eg,
re-implement some of the functionality in Curses.)

Application Program

The application software that drives KARR is written in Perl, a scripting language suited to rapid
prototypes of embedded applications. The Perl driver program opens several
files for the LCD and the Lp3 and drives them using a select() loop.

Physical Design and Packaging

The PC/104 cards are mounted in an Enclosure Technologies
Incorporated (ETI) Half-Cube. This is a special metal enclosure designed
for up to four PC/104 cards with a generous inch or so on three sides to
allow for cables and connectors. It also has knock-outs for PC/AT-type
serial, parallel, and keyboard ports.

CardPC inserted into Parvus carrier board, and attached to ETI case as the
bottom card in the PC/104 stack.

The Card PC inserts into a clip on the underside of the Parvus Scalable
CPU. The heat sink and DRAM port on the Card PC make it about a quarter inch
thicker than the PC/104 standard, so this card MUST be mounted on the bottom
of the stack.

Similarly, the V-104 power supply is covered by a big piece of sheet
metal. While it's not impossible to stack cards on top of the V-104, it
would interfere with heat sink operation, so I put the power supply on top
of the stack. The heat sink makes contact with the top of the enclosure,
providing better heat dissipation. There are two flanges on the outer edges
of the heat sink that must be bent back about 45 degrees to get them to fit
in the half-cube.

The assembled PC/104 stack of three cards, with the power supply on top, the
CPU on the bottom, and the PC Card adapter in the middle. Note the blue
100-mil connectors for AT-style interface cables on top of the CPU card.
Ribbon cables are run from these connectors through either side of the stack
to interface to other hardware.

The PC Card adapter is located in the middle of the stack. The three
cards stack neatly on the PC/104 connectors, and the whole assembly fits
neatly in the ETI Half-Cube.

The complete wiring harness for KARR.

The CPU card provides PC/AT standard .1-inch headers for all the usual
peripherals. Connectors can be found at any computer store. Some have to be
modified to remove strain reliefs and so on that would interfere with
stacking the cards. It's possible to stack more PC/104 cards on top of these
when the cables are all lying flat and exit the stack from the left or right
sides.

The VGA, keyboard, and serial cables run out the left side of the stack.
Serial connectors are mounted in the knockouts on the front panel. The
keyboard and VGA cables are routed outside the case through the DB-25
knockout.

A 12-volt extension cord plugs into the input of the V-104 power supply.
The cable enters the case through the round knockout on the front panel. The
ETI case came with a rubber gasket for this knockout. This is used to
prevent the cable from rubbing against the sharp edges of the enclosure.

Karr uses a standard PC internal hard drive connector on the outputs of
the V-104 to provide a convenient means of powering off-board peripherals. A
Y-splitter is used to run power seperately to the hard drive and the LCD.
One end exits the case on the left, the other exits through the DB-25
knockout in the front panel of the case.

ALL the cables passing throught the DB-25 knockout are wrapped with
electrical tape to prevent them from wearing on the edges of the
apeture.

The hard drive is placed inside a VHS clamshell case. A small notch is
cut in one end of the case to run cables into the enclosure.

Extra-strength velcro and cable ties are used to attach various parts of
KARR to the vehicle dash.

Assembly

Making Cables

While the CPU and other electronics are the most expensive parts of KARR,
the cabling is the most time-consuming. As much as possible, common AT-style
cables and connectors are used to reduce the number of unusual cabling
requirements.

Putting It Together

Insert Card PC into Parvus CPU Card.

Attach nylon spacers to bottom of ETI case.

Insert Parvus CPU card into bottom of ETI case, so it rests with the
stack-through connector between the nylon spacers.

Insert and tighten two screws through the CPU card and into the nylon
spacers.

Run cables through the DB-25 knockout for the VGA cable, keyboard, and
mouse. Attach ribbon cables for COM1, COM2, VGA, keyboard/mouse, and route
these cables out the left side of the stack, taking care to lay them as flat
as possible.

Attach ribbon cables for IDE hard drive, parallel port, and floppy disk,
and route these cables out the right side of the stack, taking care to lay
them as flat as possible.

&nbsp
Stack the PC Card dock on top of the CPU card. Insert the controller at
an angle, line up the pins, and then push firmly to get them to insert.

Stack the power supply on top of the PCMCIA controller, following the
same procedure as for the PC Card dock.

Bend down or remove the right rear flange on the ETI case, to give the IDE cable, hard drive
power connector, and parallel port cable a place to exit the case. Lay the
cables flat so that they exit the case over this flange. Wrap the flange in electrical tape to avoid rubbing any cables.

Put the ETI-supplied gasket for the round knockout on the front of
the case. Route the bare ends of your cigarette lighter cable through this
apeture and attach them to the power input of the power supply. CHECK THE
POLARITY CAREFULLY with a multimeter before you attach the power input to
the V-104.

Attach the bare ends of the hard drive power plug to the power outputs
of the power supply - run the red wire to +5 volts and the yellow wire to
+12 volts. Run the black wire to ground.

Screw the serial connectors into the front-panel knockouts.

Pop the lid of the ETI case on. Take care not to damage any of the
cables that might be in the way of the lid - push them inside gently and
then finish attaching the lid. Insert and tighten ONLY THE LEFT SCREW on the
lid; the other side is where the IDE cables and parallel port cables exit.
Take care not to damage the IDE and parallel cables when attaching the lid.

Attach the Lp3 to the parallel cable.

Attach the hard drive to the IDE cable and the hard drive power
connector on the right side of the case.

Cut a small apeture in the top edge of the videocassette case to pass
the IDE and power cable through. Insert the hard drive into the videocasette
case and close it.

Attach a DB-9 serial cable to the male DB-9 port on the front of the CPU
unit. Attach the other end to the LCD display.

Attach the keypad to the center eight pins on the keypad header on the
back of the LCD display, such that the keypad is face up when folded in
front of the LCD.

Attach a 10-inch or longer hard drive power extension cable to the power
connector exiting the front of the CPU unit, and attach the other end to the
LCD power cable.

Plug the LCD power cable into the LCD power connector. CHECK THE
POLARITY CAREFULLY WITH A MULTIMETER. This connector looks like a floppy
drive power connector, but has a different and destructively incompatible
pinout.

Arrange everything on your workbench so that it's all neat and tidy.
Load your software, then install it in your car. Label the keypad to taste.

Control panel and keypad mounted on the dash of a 1986 Dodge Omni. Note use
of velcro to retain cables in a neater bundle.

System unit, hard drive, and Lp3 installed in a cavity in the console of a
1986 Dodge Omni. Note the arrangement of cabling.

In my car, there's a convenient seven-inch square tray at the base of the
console that fits the hard drive and CPU unit perfectly. I run the serial
cable, LCD cable, and stereo cable up the left side of the dash and secure
them with a strip tie. The power cables go to the cigarette lighter on the
right side. The LCD sits on the dash, with velcro holding the keypad and
cable bundle in place, so that it won't slide around.

Testing

KARR includes standard PS/2 keyboard and VGA cables so that you can
attach it to ordinary dekstop PC hardware. I recommend getting a seperate
cheap VGA monitor and PS/2 keyboard for testing.

I use a regulated 3-amp, 12-volt DC power supply to drive KARR on the
workbench. You can get something like this at any good electronics store. I
used the female end of a 12-volt power extension cable to attach the power
supply to KARR.

Operating system installation, configuration, and boot procedures are
left as an exercise to the reader.

Alternative Hardware and Software

The CardPC CPU was the most expensive component of KARR, and the one most
likely to be replaced in alternative implementations. Any other 386 or
higher PC is sufficient. There are dozens of other PC/104-based single-board
computers that could replace the CardPC.

Substitution of another CPU card might free up enough room on the bottom
of the CPU stack to allow use of a 2.5" notebook computer hard drive inside
the case. In this case, it's best to get a CPU card that has a 2mm hard
drive header instead of the 0.1 inch headers used for desktops.

Timeline, Inc.
is a surplus company that has $90 486/25 embedded PC's intended for use as
Point-of-Sale systems. These units include all the usual PC hardware, a bay
for a notebook hard drive, and a built-in UPS.

A friend of mine is experimenting with a Biscuit PC
from Advantech. These are small,
inexpensive, low-power PCs. Some include onboard Sound Blaster-compatible
hardware and CPUs up to a Pentium 233, so they could play the Mp3's back
through software, eliminating the need for the Lp3. While not as cheap as
the Timeline 486, these are still likely to be cheaper than any other
similar PC/104 solution.

Special Thanks

The following people have provided support for the KARR project:

Eowyn W. Cenek

Richard Hwang

Stephan Szabo

Bryan McNett

Andy Kogelnik

Thanks also to Ingrid Lancaster at EMJ Embedded, May Liu at Tri-M
Engineering, and Bryan Karas at Future Standard for assistance in obtaining
the specialty components present in KARR.

Any suggestions or comments are welcome. Please direct them to phil@phil.org