Carputers – some ideas to get you started

We are firm believers in the idea that computing starts to get really interesting – interesting enough to suck in people who have never programmed before – when you begin interfacing software with real things made out of atoms. That’s why there are GPIO pins on the Pi (another reason you should never tread on one with bare feet). Here are some resources to get you started with some real-world hacking: namely, hacking your car.

The usual disclaimers apply here. Don’t be stupid. Don’t drive along typing, watching videos, playing Transport Tycoon Deluxe or anything else that’s likely to get you killed. You’d make us feel bad, and you’d embarrass the people who know you. Don’t mount any part of your kit on a sharp pointy thing that might impact your body if you crash. Use common sense.

With a Pi, you can build a customised, specialised pieces of equipment; and you’ll want your carputer to do things that a laptop sitting on the passenger seat wouldn’t be able to do. Martin O’Hanlon (who maintains a blog with some of the best Minecraft: Pi Edition hacks we’ve seen – go and check it out) has been busy with car diagnostics, which is as good a place as any to start.

It turns out that there’s a standard for reading data from all makes of modern car, called OBD-II (on-board diagnostics II). Your car can communicate all kinds of data that you may not even have known it was collecting, like the volume of particulates being absorbed by the filter, the temperature of the air coming into the car, or results from the oxygen sensor; and the things you might expect, like oil pressure or speed and distance travelled. You can then process that data to output figures on useful things like fuel economy.

(Martin’s using the screen of that Samsung laptop as a display for his Pi for the time being.)

Consumers can buy a USB to OBD2 interface cable – Martin’s was about £10 on eBay.

Reading and displaying this data is the first step in what Martin hopes will be a larger project. Those of you making carputers will find the ability to do this useful too – it’s well worth being able to work out for yourself why the mysterious red light on your dashboard has come on, without having to spend money at the garage just to find out that your oil levels were low. Martin has forked some existing software from GitHub so that he could find out what sensors were supported by his Lotus, and poll the car every 0.5 seconds, writing the sensor data to the screen.

To run Martin’s code on your own Pi, open a terminal and type:

sudo apt-get install python-serial
sudo apt-get install git-core
cd ~
git clone https://github.com/martinohanlon/pyobd
cd pyobd
python obd_capture.py

Once you’ve got the data from the car out of the way, of course, there’s a lot more you can do with a Pi to make being in the car a bit more fun. First off, there’s music: you can turn your Pi into a Spotify server (you’ll need a premium Spotify account) or a Pandora jukebox.

And, of course, you’ll want GPS and a camera. Using a Raspberry Pi camera board and a separate GPS module hooked up to the Pi, Chicago Electronic Distributors (who specialise in Pi stuff, if you’re in the market for some kit) built a reversing camera and in-car GPS. They’ve also been using another Pi with a camera board as a dashcam.

We’ve been racking our brains about what else you might want in a carputer. Emma suggests you might like to add a thermometer to your Pi too, to log the internal temperature of your car “in case of dogs”. Rob wants disco lights. (You could use a LED matrix for this – I’d be tempted to mount such a matrix in the back window and scroll obscenities at people behind me with their headlights on full beam.) And I would also like a robot valet with a teeny-weeny vacuum cleaner, and something to count the change in the ashtray, but that might be a step too far. JamesH races cars – he’s been talking about infrared sensors for the tyre temperature and accelerometers to measure G-force when taking corners, which might be a bit more practical.

Finally, you’ll want to install the thing. Now, you can do what Chicago Electronic Distributors did and just mount a screen on velcro or attach it to the windscreen with a sticky cup, and hide the Pi itself in the glovebox or the boot: but where’s the fun in that? We found a lovely album of pictures from LuckyJezster, one of our forum members, who is refurbishing a 1980s Ford F120. With a Pi. Here’s his post about the process – click on the image of the Pi he’s embedded in the central console and covered with plexiglass to see the photo album. Blue LEDs! Lovely clicky switches! A Pi logo hand-engraved with a knife!

Are you working on your own carputer? Does your Pi have wheels? Have we missed anything glaring that any carputer worth its salt should have? Let us know in the comments.

91 Comments