Hack 53. Build an in-Car Macintosh
Check out how one programmer used OS X and a PowerMac G4 to meet his in-car computing needs. Several years ago I got a job in Holland, and I needed a comfortable car for almost-monthly trips to the Czech Republic. I purchased a 1993 Tatra T6134Mi sedan with a rear-mounted 200-HP V8 engine. Ironically, although the car I purchased had been made for the Frankfurt auto show and was originally equipped with fully digital controls, a handful of computers, and features such as voice synthesis, the factory had replaced all this equipment and rewired it with more traditional controls after the show. The moment I bought it, I decided that a computer had to be put back in. I started to design my Tatra computer in the summer, and by Christmas I had a working installation. The main features that I wanted my in-car computer to provide were a navigation system and the ability to play my MP3 collectionanyone who needs to make 1,000-km trips every month or has ever been lost in Copenhagen can understand the need for a lot of music and a good map. Of course, I could simply have purchased dedicated navigation hardware (and a head unit that plays MP3s), but I was not very excited about the prospect of spending several thousand euros on a dedicated hardware solution and then having to wait for the manufacturer to release the maps that I needed of the Czech Republic. The use of a standard computer gave me much more freedom in terms of the configuration of the system and of potential software and hardware upgrades. During the design and construction of my mobile Mac, I also decided to add some functionality that I hadn't anticipated, including communication with the engine controller and an on-board microcontroller for basic telemetric data. 4.14.1. Choosing a Computer and ScreenMy first idea was to use an LCD iMac, and build it into the original dashboard of my Tatra. The base unit was supposed to be placed within the dashboard, and the display with its holder outside. This idea had two basic flaws: the iMac's 15" screen is really too big for most dashboards, and its LCD screen is not designed for use in full daylight (not to mention direct sunlight). OK, so no iMac. The second alternative was to install a separate LCD display, built into the original dashboard and connected to a computer (either a PowerMac or a PowerBook) that could be placed under the front seat or behind the dashboard. I also wanted to drive another screen that would allow rear-seat passengers to watch movies or play games. Since a Power-Book cannot easily handle two external screens, I purchased an old 450MHz PowerMac G4 and an industrial 6.5" LCD screen (Figure 4-26) that has contrast and temperature range controls, both of which are necessary for in-car use. The native resolution of this LCD screen is 640 x 480 pixels, but its controller can interpolate various other resolutions. I chose 800 x 600 pixels, the minimal resolution required by the navigation software intended to use (Route 66).
Figure 4-26. The LCD screen in my dashboard4.14.2. Installing and Mounting the PC and ScreenI soon realized that the original dashboard of my Tatra didn't have an ideal place for a fixed mount of the 6.5" LCD screen, and that a retractable screen would also cause quite a few problems. I therefore decided to rebuild the whole dashboard from scratch. This also allowed me to replace the original gauges, which were not really high-tech (almost unreadable at night, for example). Figure 4-27 is a behind-the-dash look at the rear of the LCD. Figure 4-27. The back of the LCD screenThe placement of the computer also had to be reconsidered. There was not enough space below the front seats for a PowerMac, so I had to abandon this idea and start thinking about how to install the computer in the trunk (which, in a Tatra, is located in the front of the car). I wanted to use the least possible trunk space for the computer, so in the end I decided to install it in a rectangular case attached to the rear wall of the trunk (see Figure 4-28). Two important engineering issues to be dealt with were heat and water condensation. The main heat source in older PowerMacs is certainly the hard disk, and the parts that are most vulnerable to condensing humidity are the motherboard and the PCI cards. Based on this knowledge, I decided to separate these two parts of the system. Figure 4-28. My PowerMac, on a plexiglass plateI installed the motherboard in a fiberglass case and the hard disks on a console next to this case. At first I wanted to completely seal the motherboard case, but later I found that this was not really a good idea, particularly due to temperature changes affecting the air volume inside the case. To fix this problem, I installed two Gore-Tex valves on the case (Figure 4-29). These valves are used in the automotive industry to allow air circulation in the headlight units while keeping any water on the outside. I did not take any special measures for CPU cooling, although the CPU is mounted in a closed space with minimal air circulationthe 450-MHz G4 processor is known for its low cooling requirements, so I decided to wait and see how it went before over-engineering a solution to a problem that might not exist. This hunch proved to be correct, as even in 35° C days last summer with the computer running for 15 hours, I never had problems with CPU temperature, and the hard disks did not suffer any damage (even on the roads in the Czech Republic and Slovakia, which are not always up to civilized standards!). Figure 4-29. A complete PowerMac G4 in the Tatra4.14.3. Powering the PCAlthough my final solution turned out to be simple and reliable, the power supply was probably the biggest problem I encountered during the whole installation. My very first idea was to use an uninterruptible power supply (UPS) without an internal battery, connected to the car's battery. This idea cost me two UPS units, both of whose transistors burned out. Even a 300W UPS was not able to handle the current surge that occurred when the computer started up. My second idea was to use an inverter [Hack #11] and the original 220V power supply. This almost workedI say "almost" because, while it did power the computer, there was a 50-Hz noise on the audio output of the computer that I could not eliminate. Fortunately, my third idea, a 12V ATX power supply, did work perfectly. I used a commercial Turbo-Cool power supply (see Figure 4-30) that works with input voltages of between 9V and 16V [Hack #42]. The maximum rated power is only 100W, which is much less than the 250W of the original 220V power supply. However, the original power supply was designed for a workstation full of disks and PCI cards, which is certainly not my case. The only problem I have experienced so far is that the 5V output of the power supply is not capable of providing enough current for all of my USB devices, and this problem was very easy to address by using a USB hub powered by a special 5V power source [Hack #51]. The very wide range of the input voltages ensures that the power source is able to power the computer even when I'm cranking the engine [Hack #45]. Figure 4-30. The original 220V and new 12V ATX power suppliesThe power supply is controlled by the power-on signal from the motherboard, which has an idle current of about 100 mA. Accidental draining of the battery is not much of an issue, since this current is comparable to the idle current of other devices in the car (such as the alarm and the engine controller).
4.14.4. Peripherals and ControlsThere are several basic ways to control the computer, and most of them can be implemented using standard USB peripherals. Many people use touchscreens in similar installations. Although I also considered this option at the beginning, I rejected it pretty quickly. In my opinion, having to look at the screen while driving results in a loss of concentration that can be dangerous. Instead, I decided to use controls with fixed positions that can be used without looking at the screen. The key control element in my installation is Griffin Technology's PowerMate rotating controller (http://www.griffintechnology.com/products/powermate), which is used not only for controlling the software [Hack #61], but also for starting up the computer. I also installed a row of buttons beneath the screen in the dashboard, for auxiliary functions. This is all shown in Figure 4-31. When I'm not driving, I can control all the functions of the computer using an infrared keyboard with a built in trackpoint that emulates a mouse. Rear-seat passengers can control the movie player and some other functions with another infrared deviceKeyspan's Digital Media Remote (http://www.keyspan.com/products/usb/remote). For convenience, I installed two USB connectors in the center console to allow ad-hoc connection of other USB devices when required (typically, a keyboard and a mouse). 4.14.5. Audio ConnectionThe sound output of the PowerMac is connected to a Sony head unit [Hack #14] that is in turn connected to two amplifiers and a total of eight speakers and a subwoofer. There is also another sound output, via a USB adapter, that provides rear-seat passengers with headphone jacks so that they can choose to listen to a different audio source than what's being played through the main speakers. Figure 4-31. The PowerMate and the buttons below the LCD screen4.14.6. NetworkingMy Tatra has its own Ethernet network, with a small eight-port switch under the rear seats and a total of four outlets in the armrest and the center console (Figure 4-32). Passengers with laptop computers can connect to the network to access data on the car's hard disk or share the PowerMac's Internet connection. The PowerMac is also equipped with an AirPort card that can be used to connect to WiFi networks wherever they are available. This feature is used for smaller updates, software and data downloads from my home network, and Internet connection at places with public WiFi hotspots (such as certain fuel stations). In places without WiFi coverage, the computer uses a mobile phone GPRS-over-Bluetooth interface for its Internet connection [Hack #62]. Of course, the speed is significantly lower, but it's sufficient for finding out about traffic situations, getting weather data updates, or checking email. This feature once saved me and my company quite a lot of trouble (and money), when I was able to solve a potentially very serious problem from a parking place on a highway in the middle of Germany. Figure 4-32. A software upload via the Ethernet plug in the rear armrest4.14.7. Frontend SoftwareMy Tatra PowerMac uses both standard and custom applications. I tried to use standard applications whenever possible; the custom applications mostly only provide a simplified user interface to some of the standard applications and some car-specific functions, such as the display of speed and fuel consumption. The main application, called Tatra.app (http://sourceforge.net/projects/dash-mac), was written by Ondra ada. It runs in full-screen mode and hides the standard OS X menu bar, as well as the Dock. Its screen is divided into several parts. At the top of the screen, there is a space for what we call a "compass module." The middle and biggest part contains eight slots, each of which can be used by different plug-in modules to display information and user interface elements. The user can select which modules are installed in the eight slots of the main window, but even a module that is not currently displayed or has no user interface in any slot can display urgent messages or status information, using either icons or pop-up windows. The main application also provides the modules with the ability to speak messages, through Apple's text-to-speech technology. Spoken feedback allows the user to work with the computer without even looking at the screen. A module can optionally have a special "setup" part, which is available through the main application in its setup mode. Unlike the main window and activated modules, the user can control it only by standard keyboard and mouse input, not via the PowerMate. (Obviously, this mode is not supposed to be used while driving.) Here's a list of the modules I currently use:
To support all these vehicle measurement modules, I connected a separate circuit board with its own microcontroller to the car's engine and installed five digital thermometers and a distance counter on the transmission. (For the interested, the microcontroller was designed and built by Tomá Struziak, and the schematics can be found at http://aek4470.finalnet.cz/html/palpoc.htm.) 4.14.8. GPS/NavigationNavigation in my Tatra is handled by Route 66 (currently Route 66 Europe 2004 Professional, to be exact). Although this application was certainly written as route planning rather than navigation software, it does the job well. It has a good database of Europe, offers support for NMEA GPS devices (I use Garmin's GPS II+ receiver), and, last but not least, can receive real-time traffic information using Internet Traffic Message Channel (TMC) servers for the U.K., Belgium, Luxemburg, the Netherlands, Germany, and Italy. On the other hand, Route 66 is not easy to control with simplified controllers. It does not use hotkeys that are easy to emulate through simple programming, and the displayed maps are not as good as those in factory navigation systems. The worst problem is that Route 66 only displays the maps "north up," while most navigation systems work with "track up" display, which is more logical and gives the driver a much better overview of the current situation ahead. With a "north up" map display, the driver must constantly pay attention to the direction, indicated by a little arrow, and make the necessary mental calculations (i.e., when driving south, right turns are left on the screen, and vice versa). 4.14.9. Movies and MusicIn Tatra.app, modules can be "activated," or made responsive to the user's commands. Figure 4-30 shows an MP3 player module. In the normal state, the module displays information about the track currently being played. In the "active" state, the module displays a dialog box that allows the user to pause the playback and select the track and playlist to be played. All these functions are controllable using the PowerMate rotating controller, so the driver can cycle through the playlists without having to look away from the road. Figure 4-33. An MP3 player Tatra.app moduleI had originally planned to install a DVD drive in the center console, but after seeing the high quality of DivX/MPEG movies I decided to implement a video jukebox application [Hack #70] instead of having DVDs strewn all around the car. I wanted my computer to deliver multi-zone content (i.e., different audio and video in the front and back seats), so I developed another application that could play back a different movie on the second video card and reroute the corresponding audio to separate speakers or headphones. Like the main application, my movie player also runs in full-screen mode and uses a simple user interface, controllable by either the PowerMate controller or the Key-span infrared remote control. It can display the main window on any connected screen, so it can be used on the primary screen in the dashboard as well as on the secondary rear screen (Figure 4-34). It provides only basic playback functions (choose a movie, play it, and pause it), but it gets the job done. Figure 4-34. My movie-player program4.14.10. ConclusionSince the original installation, I have continued to add features to my in-car Macintosh. One change I made was to install a GPS/GSM module, primarily to replace the standard alarm. The one-wire bus is used for user "authentication" with a chip card (to disarm the alarm) and communication with several temperature sensors. The car heater can indeed be controlled by SMS texting, and using SMS I can also get information about the car's position, lock and unlock it, or stop the engine. 4.14.11. See Also
Jirka Jirout |