Ever since I started driving in heavy traffic to places I'm often unfamiliar with, I've realized how dangerous it is to glance down at Google maps running on my phone which I always put in a cup holder. It's so low it completely takes my eyes off the road and the phone is just is obnoxious to use doing basic tasks like skipping a song.



Now a normal person would just spend $10 on a phone holder that clips to a vent and be done with it. But that's not good enough for me! That would block air from the vent making it useless. Besides, I'm a computer scientist, I basically have a degree in over complicating things! So I've spent the past few weeks engineering a head unit that should work in any car that has even a little bit of free space on the dash. Apparently it's much trickier than I anticipated (as per usual) but I managed to make something I'm pretty happy with!

I originally planned on taking out my stereo and replacing it with an after market one that had Android Auto built in. That is until I realized the new stereo wouldn't have any knobs or physical buttons, yuck! Also After some more research, I discovered I could install Android Auto onto a Raspberry Pi with a custom OS called Crankshaft. I had a spare 3b laying around so I tested the software with a bog standard monitor. Thankfully the OS could be controlled with a mouse despite being designed for touch screens. It didn't look all that pretty but seemed very functional and customizable. It immediately started Android Auto when I plugged my phone in via usb a to c cable so I wouldn't have to mess with the default UI anyways. Apparently there's a wireless mode using WiFi but I was unable to get that working. The only downside was the boot times. It took 30 seconds to boot but it immediately launched into Android Auto when it was done so I wasn't too concerned about it.

With the proof of concept complete, I started searching for LCD displays. I knew I wanted a display that
1. Looked good. This meant TN/TFT panels were off the list. They have terrible viewing angles and I really didn't want the main feature of the project to look bad or be difficult to see on bright days. I specifically looked for IPS panels.
2. Had a capacitive touch screen. I would have settled for a resistive touch screen if I needed to, but I don't plan on wearing gloves in my car and capacitive screens just feel and respond so much better in my experience.
3. Was at least 7" and roughly 16:9 aspect ratio. My phone screen is already 6" but it's 21:9 aspect ratio so it's not great to use in landscape mode. I wanted something larger and more usable horizontally.
4. Was at least 720p. Most infotainment displays in cars are 480p and I never really liked how soft they looked so I wanted something better.


I cut out different screen sizes to figure out which would fit best in my car

Turns out Android Auto only supports 480p by default and requires you to go into the developer settings to enable 720p or 1080p mode. Unfortunately, small 720p touch screens don't really exist for the Raspberry Pi so I settled on this 7 inch Waveshare 1024x600. It's not 720p so the scaling won't be perfect but it has both an IPS panel and a capacitive touch screens so my two big points were covered. Also, it was guaranteed by the Crankshaft developer to require minimal setup.



I got the display and verified it worked simply by plugging it in! I had all the hardware proven to work, now I needed to attach it to my dash. There's a small, oddly shaped area just above my vents I figured I could use. I sketched out the area with paper then cut a block of MDF to fit it.




I also made the mount for the display out of the same wood, cutting out areas for the tall parts of the circuit board and heat generating components. It took several hours and quite a lot of jig sawing but the result wasn’t too bad. It was a little crooked but I had to take it off and paint it anyways so I wasn't concerned. I plugged everything in just to test it. In order to get the wires coming out the left side, I turned the display upside down. No problem, there was a software setting that would rotate the display. Easy right?




I took the parts down and painted it all, even creating some trim pieces so it'd look a bit better!




I stuck it in my car, putting the Raspberry Pi in the console space (where the AUX input is oddly enough) and left thinking my work was almost done.



But no, since my display was a non-standard resolution, I had to add an hdmi_cvt command to force the resolution in the config file. This meant that display rotation wasn't as simple as clicking a button or just adding 'lcd_rotate 2' (nor all the alternatives of lcd_rotate). I had to look up the manual on the manufacturer's website. I ended up switching from EGL to X11 so I could rotate the display, however the touch input was not rotated. This meant I needed to edit the a conf file for X11 (after remounting the file system as read-write) and manually change the calibration matrix. As a Linux noob it was doable, but very frustrating since it took most of the day to troubleshoot and fix. Finally, I had the rotation of the display and the touch input correct, but there was another, much bigger issue.



The heat. I did some prior research and knew it'd probably get up to 150 degrees Fahrenheit in the car which is, within spec of the display and other electronic ratings. I don't live in a very hot area so I didn't expect it to reach much higher than that. When I measured my car in the middle of a sunny day, the dashboard was 180 degrees! The head unit itself was around 165 degrees. The double sided tape I used to attach it to the dash was barely holding on, but much worse, the display had peeled off the circuit board and was hanging by just the ribbon cable. Even the layers in the LCD itself were separating! I immediately took it inside to cool down but there was already damage to the backlight diffuser so there's a bright patch in the top right corner. It honestly could have been much worse but I was pretty disappointed.


Thankfully it's only super noticeable when the screen is all one color

It was time to redesign the project with heat shielding as the main focus. First, I got my hands on a windscreen sunshield which dropped the dash temperature to a mere (sarcasm) 150 degrees. I then focused on the tape. I figured it was having trouble holding on because the wood was too heavy (1 pound/458 grams) and sticking out too far from the dash creating a lot of torque. I picked up some Lexan polycarbonate (because it was cheaper than acrylic) and copied the shape of the wood. It saved over 150 grams total and brought the display a full inch closer to the dash.



Next I needed a way to reduce the heat impact of direct sunlight. I just took some aluminum foil and covered the back with a few layers of kapton tape. This covered the electronics on the back, and the new bezels I made in the front so even if the display gets too hot, it can't separate and damage itself any more.



I think it looks… unique. Definitely not what I had in mind at the start of this project but if it works then it's not stupid. Razz



I haven't had the chance to drive with it yet, but I left it out on a hot day again (regularly checking it). The tape held and the display wasn't too hot or damaged so I considered it a success! It's a bit askew (again) but I'll be fixing that once I get the newer cables that should fit better. I'm currently powering it from my 12v outlet but I plan on switching to an always on fuse box adapter (with low battery voltage detection of course) if it continues to hold up. I tested the current draw peaks at 1.2A (when booting) but is typically more around 1A and drops to .4A when sleeping.

I'm pretty pleased with how it ended up. It took over 2 weeks of research and building but I ended up with a much safer way to glance at Google Maps, skip a song, and I also still get the full functionality of my vent along with the stereo's knobs and buttons to use! Laughing

I think it's pretty cool that I could adapt this project to just about any car I get in the future. I'll update you guys when I finally get to drive with it!
Nice work, I thought about taking this project on as well to replace my aging Uconnect display in my car. I'll be curious to see how well the device holds up while driving as well as responsiveness!
This is incredible! Having your phone on the dash like this is such an underrated feature. Being able to browse for a location or a playlist while walking to my car and just having the navigation ready to go is next level integration. Yeah, you can do that with a vent clip and a phone but it's not the same to me.

Quote:
Definitely not what I had in mind at the start of this project but if it works then it's not stupid.


Exactly! Now that you have something that works get back to the drawing board and make a second version that addresses everything you don't like and enhances everything you do like. Looking forward to your future iterations. Perhaps powering the screen off the RPi then using Thunderbolt 3 to carry power (and video)? With wireless Android Auto you could drop the USB to the phone and get away with just one cable to the RPi.

Quote:
Now a normal person would just spend $10 on a phone holder that clips to a vent and be done with it. But that's not good enough for me!


I went with the "throw money at it and it'll solve itself" approach. I bought a head unit for my car and replaced my radio entirely. A few years ago the USB port on the unit died. It sucked because only that USB port supported AA & CarPlay. By that time Wireless AA and CarPlay were out and I knew I used the feature enough that I wanted it to be wireless.

Best upgrade ever.

I have an iPhone but the wireless processing to the head unit uses so little power that I don't worry about having to plug in. Plus, as a safety bonus, if I'm ever in a crash or accident I know my phone won't go flying out a window or hide under a seat and render me incapable of contacting help; the phone will be securely in my pocket.

Quote:
It took 30 seconds to boot but it immediately launched into Android Auto when it was done so I wasn't too concerned about it.


Maybe not ideal but I think that's acceptable. When you think about it, the first minute of driving could be leaving your neighborhood, work, a shopping mall parking lot, etc. Aside from a rare occurrence, I don't really need to know where I'm going the first 5 or so minutes anyways. Plus, using your phone to look for a destination as you walk to your vehicle makes the 30s boot a non-issue.

One thing I'm not a big fan of, at least with CarPlay, is that audio controls seem to lag by 4 seconds. Press Play, music starts playing 4 seconds later. Pause, Skip, Back, etc. Audio calls are fine, there's no 4 second lag and Siri would be unusable since I don't even think it waits 4 seconds for a prompt after activation.

As I've incorporated smart home tech into my residence, I can now control only one accessory from my car, and that's my garage door. Which touches on my second safety point.

I love that if my car were to get stolen, the thief wouldn't be able to easily get directions to my residence and open my garage. The built in buttons or the visor clip remotes are a physical security nightmare. Now everything I need is in my pocket. I rent a car with CarPlay? I can still open and park in my garage because the remote is my phone/CarPlay now.

If I get carjacked, I can just leave the car and my phone stays in my pocket. Downside, can't track the car but I think I'd rather have my phone than know where my car is.
Great work on this, TheLastMillennial, and as always, a comprehensive and engaging build log. That's too bad that heat has been such a problem; I would not have expected that! Although you didn't call it out explicitly, it seems like one of the project constraints/parameters is that you didn't want to cut into the dash at all, correct? I'm nervous about that set of cables hanging down near your steering wheel and potentially pedals if they get disconnected, and I'd love to see a v2 where you replace the existing audio unit and tuck the cables away.
Thank you everyone!
I agree with you Alex, wireless Android Auto is the best and it's one of my future goals!

Kerm, I thought the same thing about the wires being too close to the steering wheel (they don't run anywhere near the pedals). I've since replace the ones in the photo with flat ones that run along the dash. They're not perfectly flush but they're out of the way and look much more discrete. I also discovered I don't need the third cable to the display for power, the Pi can power it.

That brings me to the only significant problem with this project, the Pi can't provide enough power for both the display and my phone. If the Pi powers the display, my phone doesn't charge at all. Android Auto does appear to drain the battery somewhat quickly but I'm not quite sure how I'll fix that without running a third cable to the display.

Other than the charging issue, the head unit has been fantastic to use! The tape has held perfectly even if I drive over a rough bump in the road. It also doesn't vibrate at all which is a relief. Waiting 30 seconds for it to boot is a little long if I'm in a hurry but it's not that big of a deal since it reliably turns on maps and my music when it does boot. I'll still look into improving the boot time.

I think the only major change I'd like to do is hijack the skip forward/back buttons that are on my steering wheel and plug them into the Pi. I think I'll have to tamper with the stereo so I'll need to do more research before I attempt it.

I may also get a DAC hat. The Pi's onboard audio honestly isn't bad but I'd like to see if I can improve it. The hats can get expensive really quickly ($40-$120) also I don't really know what to look for in a good DAC so I'm not really sure I want to spend the extra for one right now.
TheLastMillennial wrote:
I think the only major change I'd like to do is hijack the skip forward/back buttons that are on my steering wheel and plug them into the Pi. I think I'll have to tamper with the stereo so I'll need to do more research before I attempt it.


I looked into this brand a while ago for a separate reason/project and found this adapter. Not sure if it'll work for your project but could maybe put you down an already forged DIY path.

https://www.crutchfield.com/S-fIcOqNUYKfv/p_794ADSMSW/iDatalink-Maestro-SW-Steering-Wheel-Control-Adapter.html
Quote:
The Pi's onboard audio honestly isn't bad but I'd like to see if I can improve it.
It doesn't get you much in terms of advanced audio, but for less than $10 you can get a USB sound "card" (e.g. Amazon). I want to do some voice recognition and generation with my Raspberry Pi 4B, and I'm going that route for audio input/output.
Its been about 6 months so I wanted to give an update on how things have held up!

Overall things have been pretty great! I find it amusing most passengers think it's an aftermarket product and don't realize it's DIY until I mention it. I guess that's the best compliment I could get for its looks. Laughing



Here's a demo of it working. I can't open Maps without doxing myself so enjoy me launching some music apps.



I've replaced the original cables with flat ones so they're pinned out of the way against the trim and they can get into my console area even if the lid is closed. Wiring has become a mess again, so I'm considering getting ribbon cable thin wires for the USB and HDMI connections. This would prevent the cables from getting pinched by the console lid. My large, high-ish resolution display is so much better than some built-in systems since the UI can be smaller so I can see more map. Its still been a trip to get everything working just the way I want though.



Surprisingly I've only had a one major issues with the hardware. Last I reported, the Pi took 30 seconds to boot completely. That slowly creeped up to 45 seconds as of a few weeks ago and the Pi would often fail to start. It'd blink the green LED 4 times which means it couldn't find start.elf. However, powercycling would almost always result in a sucessful boot. I eventually suspected that my no-name micro SD card that I've used for countless projects was dying. I splurged on a SanDisk Ultra card with the maximum read speed my Pi supports hoping that it would fix my unreliable setup. I was impressed at the difference it made, boot times were cut by more than half! It only takes 15 seconds to completely start which means everything is running before I even get out of my driveway!



I've been using the Pi mic-less so I couldn't take phone calls. I'd have to unplug the phone which was just a hassle. The Pi's headphone jack doesn't support microphones so I got a UGREEN USB to headphone-microphone splitter which claimed to be plug-and-play with Raspian. Thankfully it 'just works' and I haven't noticed any change in audio quality from just using the Pi's DAC. The microphone I purchased is suuuper cheap but it gets the job done. Audio quality is legible but my friends sometimes claimed I sounded underwater. I've had issues where the Pi will sometimes use the phone's speakers and microphone but I haven't had the time to diagnose that.



The other issues I have revolve around software. Most of my grievencies fall on Google Maps. A little while ago, Google detached the switching of dark/light mode away from your phone's dark/light mode state. Instead, dark/light mode now relies on your car's headlights state. This makes sense for cars with Android Auto built-in, but for me it makes my job more complicated. I recently discovered I can attach a GPIO pin to the to the headlight relay fuse and have Crankshaft monitor that pin to switch dark/light mode accordingly. Entering developer settings again allows me to change the dark/light mode setting from "Phone Controlled" (which does nothing) to "Car Controlled".

There's a few other annoying bugs Google Maps has that makes me tempted to switch to a different mapping app. I've tried Open Street Map but it's clunky to use compared to Google Maps. If you have recommendations I'd be happy to try them!
It's been a few more months and I've made a lot of quality of life changes!

Audio Upgrade! (And regrets)
I've been wanting to upgrade my pi's audio for a long time and a few days ago I finally pulled the trigger and ordered a HifiBerry DAC+ ADC Pro which has RCA output and an audio input. I was pretty excited to finally have a mic input and hear how it sounded! Unfortunately, despite a long list of supported DACs, Crankshaft doesn't have an easy option to select that particular DAC. I had to manually edit the config.txt file to tell it what DAC to use.


When I finally got the DAC situated and playing music it sounded good! It's a good DAC no doubt, but my major grievance with it isn't when it's playing sound, it's when it's idle. After the music stops, a few seconds later a high pitch whine (just over 10khz) starts and it's loud enough that it's very audible and distracting even at medium audio levels.


(Click for full size)

Another major issue I discovered was the ADC only supports one type of microphone: dynamic. It only sort-of works with electret mics and doesn't work at all with my condenser mic. I didn't realize different mic types aren't cross compatible when I bought it.

The whine + the mic incompatibility meant I had to return the HifiBerry. I decided to try a simply approach to audio by getting a ugreen USB sound card. This sounded fine as well, but has aggressive pops and whines especially while the Pi is booting up. The microphone did work perfectly though!

The Pi's headphone jack, while not better in sound quality, only has an audible whine when the volume is turned up to unreasonable levels I never listen at. So I figured, I'll just use the USB sound card for mic input then just use the Pi's headphone jack for audio. Unfortunately, this is not trivial. Whenever the USB sound card is plugged in, the Pi will only output to the sound card and I cannot find a way to disable it.

There's so many audio software installed it's hard to tell which software is the culprit. There's Aplay, Alsa audio, and Pulse Audio. I think the problem is with Pulse since changing Aplay and Alsa settings haven't change anything. Pulse doesn't appear to recognize the Pi's headphone jack as an audio output device unless there are no other output devices connected. I'm not sure why or how to fix that. Sad

Here's my config.txt audio setup. If you know something I can add to force sound through on-board audio, I would really appreciate it.

Code:
# Audio Setup
dtparam=audio=on #enables on-board sound
audio_pwm_mode=2 #enable 7bit mode
hdmi_ignore_edid_audio=1 #don't output to my hdmi screen
disable_audio_dither=1 #don't intentionally add noise to output


On the bright side, I did discover a free way to improve the quality for free! Adding `audio_pwm_mode=2` to the config.txt file enables 7bit, 781khz mode instead of 11bit, 48khz!

Button controls
Alex wrote:
TheLastMillennial wrote:
I think the only major change I'd like to do is hijack the skip forward/back buttons that are on my steering wheel and plug them into the Pi. I think I'll have to tamper with the stereo so I'll need to do more research before I attempt it.

I looked into this brand a while ago for a separate reason/project and found this adapter. Not sure if it'll work for your project but could maybe put you down an already forged DIY path.

Since I don't want to take my dash apart to access the wires required to plug in, I decided to go a different route. Android Auto by default allows keyboards to control its interface. So, I got a 3 key (Cherry MX reds) macropad and programmed each key to open Google maps, open phone app, or skip a song. It's right next to my shifter so it's very easy to reach. I've been using it for a few months and I'm very pleased with it!


Power to Phone
Previously, I had the Pi powering the display on the dash. This took so much power (400mA) that the Pi couldn't charge my phone. I got a fuse box to micro usb adapter originally for powering the Pi, but the right angle connector was the wrong way so it didn't fit. Instead, I plugged it into the display and it's been fantastic! My phone slowly charges when plugged in so I don't have to worry about driving on low battery!

Bluetooth
It turns out that one of the reasons phone calls weren't really working before was because the Pi doesn't support the bluetooth Hands Free Profile on a hardware level. I believe that using an external bluetooth adapter (I had a CSR bluetooth 4.0 adapter laying around) will provide this functionality. I haven't had time to test this feature but fingers crossed phone calls will no longer be a hassle!


RTC
I'm so tired of Google maps being stuck in either dark or light mode. Wiring the pi up to my headlight state is too much of a project. The only other way to have the pi switch light/dark mode is to put Crankshaft on a timed schedule. This schedule tells Android Auto when it should be in light/dark mode. However, it only works if the Pi's time is accurate. Since I won't be wiring the Pi up to my ignition switch, it would have to be always on to keep time. The Pi draws too much power to leave running in my car for extended periods of time. Instead, I bought a DS3231 Real Time Clock. This RTC has it's own battery for keeping time even while the Pi is shut down and disconnected from power. I only installed it yesterday but it's been functioning quite well so far!


Future plans
I really want to get the mic input through the sound card but sound output through the on-board audio. I'd really like help getting that working! If that gets sorted out, I might try adding a reverse camera to the setup. I'm pretty happy with the way the setup is at the moment, I just need the audio fixed!
I'm glad to see that you're still tweaking this project! So many DIY projects with life integration potential (home automation, wearables, car mods, etc.) are cool in isolation but don't stand the test of "is this actually well-built and practical enough to use every day", and end up sitting on a shelf permanently, so I'm pleased to see this still in use. Power and headlight state: my brief experience with aftermarket car gauges suggested gnd, +12V, and headlight state are pretty accessible, so I wonder if it might not be that many things you'd have to take apart to get to those, but I also freely admit I haven't poked around in this area before.
Thank you! This is definitely my most used diy project. Last I checked, the headlight state for my car is behind the dash (which I'm trying to avoid disassembling) but I'll have to look into it again to verify that. That's a sweet looking train setup by the way, I'm looking forward to seeing it completed!

I think I actually got my audio configured the correct way! This was one of the most frustrating parts of this entire project. I spent no less than 5 hours learning by trial and error what pulseaudio and alsa audio are and what they do. I actually wasn't too far from getting it working when I started. I set the default audio sink (output device) in /etc/pulse/defaults.pa to the pi's analog out. Yet, I couldn't figure out why pulseaudio was ignoring the default I set and kept using the usb sound card. Turns out pulseaudio was running in system mode which meant I actually needed to change system.pa instead. Rolling Eyes

After applying the change to system.pa, music is coming from the Pi's headphone jack! When I started a phone call, the mic from the sound card was working and the voice on the other end was still going through the Pi's headphone jack!

Something I spent too much time doing was trying to figure out how to disable a specific audio sink. While you can easily disable a source or entire audio device (disabling the usb sound card would disable the mic as well), it's not trivial to disable a specific sink. If setting the default in system.pa hadn't worked, my next idea to try was to output to both the usb sound card and the Pi's headphone jack simultaneously. This should have worked by using module-combine-sink but thankfully I won't have to bother trying!

I'm so happy this was resolvable! I was worried it'd become yet another Linux issue I wasn't experienced enough to fix. I'll definitely post if it suddenly stops working. I've been making full .img backups of my SD card so I can revert if anything goes catastrophically wrong. Very Happy
I still daily this mod and I still love it! I'm worried I may not be able to enjoy it for much longer.

Google recently pushed out an update to Android Auto v12.7 that broke compatibility with any head unit that relies on OpenAuto. This is a major problem for a few reasons.
1. I don't have confidence that the Crankshaft team can get an update out to fix the incompatibility. The last release was two years ago and the last code change was over a year ago.
2. I can't just stay on the last working version of v12.6 forever because Google time bombed Android Auto to disable itself when it's more than a month or so out of date.

There's a Google support ticket created but the DIY group is so small it's unlikely to get noticed. If you could please click 'I have this question too' then maybe Google will take some sort of notice: https://support.google.com/androidauto/thread/297405071/recent-aa-updates-break-crankshaft-ng-not-beta

Edit: thanks to those who voted! The post got flagged as a 'trending issue' now! I don't know if that means Google will actually take a look though. More votes are definitely appreciated!
That's too bad, TheLastMillennial, but I'm glad it's been flagged as a trending issue. Would you consider contributing to Crankshaft yourself, or do you lack the time and/or relevant expertise?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement