Raspberry Pi carpc [MAKER’S REPORT]


In-car PCs with multimedia and navigation
capabilities are so cool, but you know how it is, they are often
found in luxury, high-end vehicles only. But if you know what you are doing,
nothing stops you from making your very own car PC, even if your car does not
support this type of fancy accessories out of the box. In this episode I will
show you how I turned a Raspberry Pi and a bunch of other components into a
custom PC for my car. My name is Kradion and this is Maker’s Report. Let’s face it,
there is nothing more annoying than a long road trip without any music. You see,
I love my car, but that piece of junk has very poor multimedia capabilities. I can
basically listen to people talk on the FM radio, and load one audio CD. Just one!
So, that’s not very much. This means no mp3, no auxiliary inputs,
no data CDs, no USB, no nothing. None of that. So that’s why I decided to
take up the challenge and design my own car PC based on a Raspberry Pi. So, first
question is: what should this car PC do? And I have identified a few features
that I really want to implement in this project. First and foremost, I want this
car PC to be able to play music and video. Second, I want the car PC to
provide GPS navigation with voice directions. Now, I know, I know, I can slap
a standalone GPS unit on my windshield, but where’s the fun in that? So, we are
going to do that as well. Third, I want the car PC to be able to power
itself on and off automatically when the engine starts and stops. Next, I would
like to implement automatic screen brightness control. I basically would like
that automatically, when I’m driving in full sunlight, the screen gets brighter,
so I can read it, and if I enter a tunnel, or
it’s night, I want the screen to get dimmer and dimmer so it doesn’t burn my
retinas. I like my retinas. Next, I want the car PC
to be able to receive audio via Bluetooth.
Basically, I want to turn my entire car into a huge Bluetooth speaker. Last but
not least, very important, I would like to implement some sort of steering wheel
controls. You see, I like safety and I would like to be able to control the car
PC without breaking eye contact with the road. Okay, so, now that you know what we
want, let’s have a look at the system we’re going to build. Let me start by saying
that this project is quite complex, and I will be leaving out a lot of detail for
the sake of runtime of this video. I will publish a little more on my blog
(link in the description) so, if you want to have a chat, or a discussion, or know a
little bit more, see you there, or in the comment section, if you feel so
inclined. So, surprise surprise, everything starts with a Raspberry Pi. For this
project I decided to use a Raspberry Pi 2 model B. Why not the 3? Well, none of
the functions that I’m going to build actually requires the extra power of the
Raspberry Pi 3, so I decided to give the old guy a chance. The Raspberry Pi is
connected to the official seven inch touchscreen display. This device is a bit
on the expensive side, but totally worth it. It is recognized automatically under Raspbian, and both the screen and the
touchscreen are of very very high quality, so, totally recommended,
especially for bigger or more complex projects like this one. So, let’s have a
look at the audio system. As I was mentioning, we need to find a way to
bridge the gap between the Raspberry Pi, generating the music, and my car radio,
which only accepts FM signal. I have found a very nice component, an FM
transmitter on Adafruit, that can help me bridge this gap. I can basically
connect the audio jack of the Raspberry Pi to the input audio jack of the FM
transmitter, and have my music broadcast inside my car on
the FM channel of my choice, but that would be a mistake. Why? Because the
Raspberry Pi generates its music using Pulse Width Modulation, or PWM for short.
PWM is a very cheap way to generate audio, but it suffers from artefacts, and
a humming noise that cannot be removed. I really didn’t want to have these
problems, so I decided to use digital audio. The Raspberry Pi is capable of
generating digital audio using what is called I2S, which is a digital
audio port available on the GPIOs. I bought an I2S DAC, which is
basically a Raspberry Pi sound card, we can say, that takes the digital signal
and turns it into a high quality analog representation, and that is what is
connected to the FM transmitter. The GPS subsystem is quite straightforward. I
just bought a GPS receiver from Adafruit and an active antenna. The power
subsystem is a little bit more convoluted. I have found an intelligent
switch on Mausberry Circuits. This switch connects to the 12 Volt power of
the battery and to the ignition line of the engine. When I switch on the engine,
the ignition line goes active and the power switch activates the power to the
Raspberry Pi, so the system goes online. That’s nice.
Then, when I’m done with my driving, the ignition lines disappears and the switch
communicates this event to the Raspberry Pi using one of the GPIOs.
In the Pi, there is a script that monitors this GPIO, and responds by issuing a
clean shutdown, so this should give me the functionality I need.
Next up, a few extras for convenience. First of all, I want to implement two
light sensors very close to the screen. I basically want to implement a feedback
loop in software where I measure the light intensity hitting the screen and
regulate the brightness of the screen accordingly. Next component is a
Real-Time Clock, or RTC for short. Next, I have a small USB flash memory where I
will install program data, such as the maps for the GPS software. Then, I will
certainly need a Bluetooth dongle, if I want to turn my car into a Bluetooth
speaker, and last but not least, I marked here a keyboard, because I want to be
able to control the car PC with a small keyboard installed as close as possible
to my steering wheel. And last but not least, I’ve decided to install two panel
mounted Ethernet and USB ports. Because why not. Okay, so, the initial problem was
to put music in my car, and this is what I came up with. This is what happens when
I’m left unsupervised for a while. So, now it’s the time to put some hardware
together. And putting the computer together is probably the funniest part of
this project. To start we need to hook the Raspberry Pi to the seven inch
touchscreen display. Conveniently enough, this display comes
with an adequate ribbon cable for data and with metal standoffs that are
aligned to the mounting holes on the Pi. This will make for a very sturdy board
sandwich. Next up, the audio DAC board goes on top
of the Pi, firmly hooked to the GPIO header. For this build,
I had already soldered the Real-Time Clock board to the appropriate pins and
hooked the wires that will be connected to all other peripherals. And here’s the
basic stack in all of its beauty. Then, I want to show you this little prototype
board I made, where I soldered the FM transmitter and the GPS module. I routed
the power supplies and the I2C lines to the top and bottom bus of
the prototype board, and soldered a few screw terminals for jumper wires. This
allows me to centralize the distribution of supply voltages and control signals
to all the satellite peripherals. From here on, it’s a matter of connecting all
other components: the two light sensors, the internal USB stick, the Bluetooth
dongle, the GPS antenna, you get the point. I also designed a custom USB keyboard to
control the media centre. It’s a simple design based on a Adafruit Trinket. the
Trinket is an Arduino compatible development board that can be programmed
to emulate a USB keyboard, and send valid key codes to the Pi in response to
button presses. My personal touch was the inclusion of a PSP thumb joystick for
cursor navigation. So, time to perform a smoke test… and it seems to work. So, my
GPS navigator of choice was Navit. Its user interface is indeed a bit clunky,
but I didn’t really have much choice under Linux. Navit uses maps I’ve
downloaded from OpenStreetMap. Very detailed, highly recommended. My personal
touch was the customizatincel Doneon of the user interface to suit my liking.
The choice for the media software fell very naturally on Kodi,
former XBMC. My only task there was the customization of the user interface to
suit it to the colour scheme of my car, and to add all the functions that I
needed, such as launching the GPS navigation, and hopping to a different FM
channel. Okay, time to test the system. I apologize for the reflections on the
screen, but I haven’t peeled the plastic off the screen yet, to keep it pristine
until the final installation. The first functionality I want to explore is the
video and music playback. I will navigate through the menus using the external
keyboard to test the steering wheel controls as well. I have loaded a song
and a video on the external USB key, and now we’ll be playing them. The FM
transmitter tuned itself to 89.8 FM. Here, I have tuned the
radio receiver of my smart phone to the same frequency, and connected it to the
speakerphone in order to be able to hear the signal. So, without any further ado,
let’s make some noise. I should be able to freely navigate up and down the
hierarchy. Fantastic. So, it seems to work. I can pause the
music, resume it, and stop it altogether. Okay, very good. I was not expecting a
success, hehe. Let’s see if we can do the same with the videos. I can still
navigate up and down, select the source, and if you are a real fan you should
know this one. In the same way, I can pause the video, resume
it, and stop it. Okay, fantastic. So, the point here is that the
video, music, and steering wheel control seems to work as intended, so we can tick
them off the list. The second function to test is GPS navigation with voice
directions. Now, I’m not going anywhere, but I can launch Navit and set a
destination, to see if the navigation started correctly. So, let’s push the button. Very good. Now I can set a recent
destination, calculate the route… Fantastic. Okay, so, the user interface
that I’ve customized gives me additional information, such as the next turn, the
distance to my destination, the estimated time of arrival, and some other GPS stats
for the geeks. I think we can tick the GPS off the list. In order to test the
automatic power on and off of the carpc, I need to install this smart
switch in my car. There is no easy way to emulate this function here in my studio,
so, this test will have to wait. Moving on to the automatic brightness control. This
is a very important feature of my carpc. I don’t want to be continuously
annoyed by a screen that is always too bright to be comfortable, or too dark to
be readable. These two light sensors and a small feedback loop in software
should do the trick. To test this function, I have my sun emulator, and I’m about to
shine the living hell out of these sensors. This should cause the screen to
slowly go brighter and brighter. I don’t know if this is visible in the video, but it is definitely getting brighter. Good.
So, now I remove the sun and I cover the sensors. The carpc should now think it’s
night, or I’m in a tunnel, and should lower the brightness to very low levels. Again, I don’t know how visible it is, but
there we go, it’s done. Excellent. Another feature has been proven. Last not least: Bluetooth audio. You know
the drill. The perfect album for the trip is there in your phone, and there is no
easy way to move it to a USB key. This is where Bluetooth comes to the rescue.
Also, establishing a Bluetooth link between my smartphone and my carpc
allows me to use my car as a speakerphone during phone calls, or Skype,
or Whatsapp, or whatever cool kids use these days. I have paired my smartphone to my carpc,
and I’m about to play some more Pacman’s Revenge so, here we go! Fantastic. It seems that all features
are go. It’s time to take a look at my car, and decide where to install this
little marvel. Okay welcome to my car. So, the question is: where to install my carpc? As you can see my car is a pretty standard car, so there is no place that
is really suitable for this type of installation. In the end I knew I had to
invent something. So, the first idea I got was to reuse the cup holder. I do not
need a cup holder so maybe I could reuse the cavity, install the electronics here
on the bottom, and a screen right sitting on top. This would be very convenient,
because very often my arm is resting right here, so it would be convenient for
typing. Problem is, in order to use the device, I would have to look down, which
is dangerous. I don’t want to do that. The second idea I got was to install the
device right there, in front of the clock. I could reuse this cavity for the
electronics, and install an even bigger screen right in front. This would
be safe, because while driving the device would be sitting right in front of me.
Problem is that it would be quite far to reach. What I decided to do is to reuse
the ashtray cavity. I am not a smoker, so I do not need the ashtray. So I decided to
design a plastic holder that would sit firmly on the bottom of the ashtray,
where I could install all the electronics. I will also have a screen
holder that would come at an angle from the bottom of the radio all the way down.
In the end I will also have a left plastic wall, and the right
plastic wall, to close this entire area that would be really dedicated to the
electronics of my carpc. But the most important feature of of this arrangement
is this cavity that I have here on the back, because in here I can route a power
wire directly from the battery compartment to the car PC, so, the entire
installation would be pretty invisible. Last thing, I would like to have some
controls of the car PC close to my steering wheel. In the end, I do not want
to look at the PC every time I want to change something, so I was thinking of
installing a few buttons, maybe here on the on back of the steering wheel, to
control the basic functions of the carpc, and I could route the control wires
for this keyboard all the way down, reusing the same cavity as the power, so
the entire installation I think would be pretty invisible. So, we have a plan: let’s do
this. So, time to have a look at the case. I designed the whole thing in Sketchup
under windows, starting from a single rectangle and extruding all the volumes
one by one. In order to get the measurements right, I decided to build a few paper models of each part, and refine them until they fitted my car
perfectly, and if I learned something here, is that paper craft is not my art, by a
long shot. Anyway, I exported the final design to
the Collada format, and sent it to Shapeways for printing. In the end, I was
quite pleased with the result, and I had just a few details to fix here and there
with a Dremel tool, because, believe me not, it does not matter how accurate your paper
model is. It isn’t. All parts are held together by screws.
However, given that I do not really trust the ability of a cheap
M2.5 screw to carve a decent thread in nylon, I decided to slot some brass
nuts on the interior side of every screw hole. I used epoxy glue, some patience,
and I would say a lot of regret every time the glue ended up flooding the
threads, and it happens. The side panels are quite boring, sporting several
uninspired slots for ventilation, and holes for the panel mounted USB and
Ethernet ports. The front panel was by far the most satisfactory part of this
design, with its angles and curves. I really loved it. I’m not a product
designer, but I am unreasonably proud of this piece of plastic. I also built two
little glass windows with a plastic bezel to expose the light sensors to,
well, light. The funniest part of it, was the face of the DIY store technician when I asked
him to cut me two pieces of glass exactly one square centimetre each. The
guy thought I was making fun of him. As a final step, I can finally install the carpc in my car, starting from the base plate in the ashtray compartment and the
scaffolding structure on top. I will attach all other parts to these two, so,
they better be solid! Next I need to prepare the panel mounted
ports and install the GPS and FM transmitter board on the bottom of the
hole. Now, I am ready to slot the Raspberry Pi and the screen into place,
and this is almost an emotional moment. Once done, I can fix the side panels in
place, choose a destination for the GPS antenna, and check if the custom keyboard
fits its slot, and spoiler alert: it does. And I’m finally ready to run this
little thing. So, the computer starts automatically as expected, and the
software is fired up as planned. Good! I kind of like the aesthetics of
the final result. You can see it’s a DIY work from a kilometre, but it’s still
acceptable to look at. My favourite part are the little windows for the light
sensors. They’re kind of cute. So, will it play music on my radio? Good, it works! And the audio quality is
better than expected. And what about video playback? Excellent. And now, it’s time to end this video. I
had a lot of fun with this project, and I learned a bunch of new things about cars,
electronics, design, an even paper craft, which is more than I initially planned.
Now, if you’ll excuse me, I’ll go play with my new carpc based on Raspberry Pi.
My name is Kradion and this was Maker’s Report.