Compact Flash Hard Drive

Make your own tiny hard drive with no moving parts and very low power consumption.

One challenge when building your own embedded device is finding enough storage for the operating system and any data you need to keep track of. While 2.5” laptop hard drives probably have the highest ratio of storage space to physical space, they introduce a couple of challenges for an embedded system. A hard drive is a mechanical device, with fairly strict environmental operating conditions (for both temperature and humidity). They generate noise, draw a fair amount of power, and above all, are quite fragile. In other words, you probably wouldn’t want to consider leaving one in a relatively unprotected plastic box on your roof through the winter or summer.

A very popular alternative to traditional hard drives is to use flash RAM instead. Flash memory uses only a tiny fraction of the power that a hard drive uses, and can operate over a much wider range of environmental conditions. It is very tiny, lightweight, and noiseless. It can be rewritten many thousands of times, and can even be dropped on the floor without fear of loss of data. While it isn’t nearly as cost effective in terms of price per bit, the popularity of digital cameras has driven flash memory prices down remarkably. If your application can fit in 32 to 512 MB of space, then flash storage is a viable alternative to 2.5” hard drives.

Many types of flash media can be used as a standard IDE device by using a simple converter, shown in Figure 4-15. One device I particularly like to use is the CFADPT1 from Mesa Electronics. Their memory devices are available online at http://www.mesanet.com/diskcardinfo.html. It can be used on a standard IDE chain or on the SFF IDE found in laptops. As the SFF IDE bus provides power on the data cable (standard IDE doesn’t), you need to connect a spare floppy power connector to the adapter when using it with standard IDE.

CompactFlash to IDE adapter.

Figure 4-15. CompactFlash to IDE adapter.

Once a CompactFlash card is inserted into the IDE adapter and attached to your computer, no further configuration is necessary. CF drives require no special drivers, and appear to be standard IDE devices to the host computer. Partition and format them as you would any other IDE device. Once an OS is installed, you can even boot from them.

Mesa also carries hard-to-find SFF IDE ribbon cable with connectors installed for a reasonable price—just ask. A number of suppliers carry CF-to-IDE adapters, and the going rate is about $20. While SmartMedia and Memory Stick adapters are also available, CF-to-IDE tends to be the cheapest way to go.

At the time of this writing, 512 MB compact flash cards are available for under $100, 256 MB cards are available for around $50, and 128 MB cards are going for an unbelievable $20. These are ideal for running a micro Linux distribution, such as Pebble [Hack #53]. Note that while you won’t need one of these for use with the Soekris [Hack #51] as it boots from CF directly, these adapters will allow any computer with an IDE interface to eliminate its most unreliable component: the hard drive.

Get Wireless Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.