Raspberry Pi Carputer Page 2

It's alive!!
This page is continuing my Raspberry Pi carputer project. I'm making this new page as a place to hold information regarding actual progress, whereas the first page was more the planning phase.

Today's news is this: I've all the parts, and the LCD up and running! I still have to fool around with software, of course, but this is a great start.

UPDATE 11/22/12

Some great news! I plugged the Pi into my car and managed to get some readings off the ECU! This was just a test but it certainly worked.
OBD II link cable

My setup was as follows. I have a Samsung Galaxy S3 (just got it), and I downloaded an app called ConnectBot. I managed to get a very weak signal to my home wifi in my car parked outside (I live in an appartment so I'm just happy it worked), and was able to SSH into the Pi from my phone.

SSH on my phone
On the Pi I downloaded a program called Minicom, which allows communicating over serial to the OBD 2 cable. I sent some commands, for example AT @1 returned the name of the cable. When plugged into the car, 0105 returned the temperature of my coolant.
The setup

One thing that I've been trying to get working unsuccessfully is setting up a different wifi connection on the Pi. I want to use my phone's tethering hotspot so that I will have a perfect signal and can test it out anywhere, rather than having to drive out back and test various areas to get a decent connection. It was quite frustrating and I had to reconnect multiple times.

As you can see in the SSH screenshot, the value I received from sending 0105 was 1 05 76. 1 05 is simply the code I sent (I think I had headers turned off), while 76 is the hex value returned. According to wikipedia, to get the coolant temp in °C, you must subtract 40 from the value. 76 (hex) is 118, so my coolant temp was 78°C.

There's still a lot of testing to do, but I think I might be able to start on a C++ program to at least put a basic output on the LCD.

In the meantime, I bought a phone dock and plan to use my Galaxy S3 as my media center. It has everything I really need - GPS, maps, music, etc. I plan to set up the Pi so that I can remove it fairly easily and still use it for other things, such as streaming movies off my media server at home.

UPDATE 1/23/13

Just a little update. I tried a few different distros on the Pi, namely Raspbmc and Xbian. They both worked pretty much the same, if I recall, I think I liked Raspbmc just slightly more, but either would do fine as a multimedia platform for movies and a few other things. I didn't thoroughly investigate addons for them, but there's definitely a lot out there. For people looking for an entertainment center, these distros might be a good start. They worked great at home, streaming 1080p video to them from my media server.

The other thing is I have been having issues with my wifi dongle. I went to the store to buy a new one and, sadly, it was not compatible with the Pi. I returned it and picked up another one that they had, the only one which appeared on the "working" list (http://elinux.org/RPi_VerifiedPeripherals) but, unfortunately, I had no luck with that one either after toying around with it for a few hours. So, I was a bit hooped for a while, but I just put in an order for one that is definitely on the list and... well, fingers are crossed.

In the mean time I've been working on a C++ project and have learned a lot. When I get the wifi dongle I'll be able to do a little more testing with the LCD screen, and then hopefully get some crude code written that can talk with my car.

UPDATE 2/21/13

A few things to mention here. First up is something quick. You're going to want your Pi to login automatically when it boots, so here's how to do it: http://www.elinux.org/RPi_Debian_Auto_Login

Second up is the issue that a lot of people have brought up in the comments about starting up and shutting down safely in a car. There's a pretty good solution to this. Firstly, see this thread for a little information on Waking From Halt. Basically you can setup the Pi to wake up from halt state with a push button on the GPIO pins. In that thread is a link to this page on how to wire in a reset button (he uses a PC reset button).

So that's great, but what about safe shutdown? Not too hard, actually. There's a DIY method and a $30 method. The DIY is this: run a relay on the car's ACC power - this is the one that turns on your radio. Then run the relay to two GPIO pins. When the relay loses power, a simple program (using WiringPi) can tell the Pi to "sudo halt" and put it into the halt state. Then when you turn the car back on, possibly with the same relay spliced to the reset pins, it reboots the Pi out of halt state and away you go. For power, it will be permanently connected via a 12V->5V converter. You can use something like this buck coverter for $7 (available in wired or USB versions).

For the purchase version, you can see this post. He's made a Pi power switch that will turn it on and off safely. However, he's also made a car version. I emailed him about it, he said it would be $30 plus shipping and they're printing them right now. He had this to say about it:

"After some tests with the prototypes, it indeed looks like the final design will be best suited with +/- connections to battery and the ACC line serving as the switch (much in the same way a car stereo would be hooked up). My original concern was that after switching off the car, if the Pi for some reason froze or didn't shut down then it might drain the car battery while the car was off. I've programmed the switch's processor with a mode that will cut power to the Pi if the ignition has been off for more than 30minutes and the Pi is still drawing power. It's not ideal but it would prevent the Pi from draining the battery and if the Pi is indeed frozen then it would need that hard shutdown anyhow. The car switch will come with an attached 12-14V step-down converter to 5V, capable of providing over 2amps."


So that's pretty great. Right now I'm working on trying to get a push button to boot the Pi into XBMC from terminal (I'm running the standard Raspbian OS). On the note of XBMC, you can install it on Raspbian just fine, so you don't need Raspbmc or Xbian - which is great if you want to run other stuff than just XBMC. You can find instructions here.

31 comments:

  1. Hello
    What OS are you using? I´m working on something simmilar, I wanna have a media center and GPS navigation...

    ReplyDelete
    Replies
    1. Currently it has Raspbian, but for this project it will not use the OS. I'm simply writing a C++ program that will run at start up, in terminal. However, I intend to also use the Pi for streaming movies at home, so I may start playing around with different OSes, but right now this project is priority.

      Delete
    2. To Anon;

      Unfortunately I do not believe, even after extensive research, that GPS navigation is a realistic possiblity as of now, unless you have extensive knowledge of programming and GPS utilities.

      It is possible, however, and when time passes by, someone is going to do it for you and in true linux spirit you can download their fruits of work as well. :D

      However, right now, most of the GPS dongles don't really work that well and the best of them still need a driver, sort of, something to translate the gps signals to the way a linux navigation program understands.

      I did however find Navit which seems to be quite a usable GPS Navi program for linux, so thats one major step forward.

      Oh, and if Android really gets done at some point to Rasp, that might be the solution to navigation, as obviously google navigation would be available after someone gets the gps usb modules working with it.

      I'm waiting as well. :) In the meanwhile, I'll just navigate with my phone and get rasp to run my car-media.

      Delete
    3. on Newer GM vehicles you can tap into their GPS unit via Bluetooth, this is usually for 2009-10 and newer.

      Delete
  2. How do you get around the shutting down of the Raspberry Pi when you turn the car off? Do you have a read only OS, or do you just risk the corruption?

    ReplyDelete
    Replies
    1. Since I'm not booting to the OS I have no fear of the shut down. There should not be any writes to the drive.

      If I was going to require a safe shut down, I would probably just put a line in the program that checks for a switch or maybe having a button held for 5 seconds, which would then execute the shutdown command. This would be easy to accomplish with WiringPi.

      Delete
    2. Wolfram23: I don't think you quite get how this works. You still have to have an OS to run a C++ program. That GUI that you are using isn't the "OS." The "terminal" you're talking about is a shell for the kernel ("the OS") that will still be necessary to run a C++ program. You're still going to have to worry about shutting it down properly. However, on this note, my idea was to hook up a battery source that allowed the Pi time to shut down, then have the battery source shut itself off. It wouldn't need much time, maybe only 10 seconds or so. The battery source could start up when power was applied from the +12V, continue to charge while the car was on, then let the Pi derive power from it when the car shut off until the Pi shut down. Once no power was being drained, it could shut itself off. This would require a microcontroller of some sort.

      Delete
    3. @Max5684, I looked into car PC over a decade ago, and I'm fairly certain there are two power sources. One where it gets constant power from the car battery and another from when it is turned on (ACC). I even think you can set things up to trigger boot when ACC is enabled and shutdown when it is off. But the whole system running on the main line. But I'm just now starting back into this, so I could be way off.

      Delete
    4. Steve, that is true, but the question is how to accomplish that in RaspPi.

      I'm building a vagualy similar system and people tend to go way overhead with their plans on this one, it should be easily accomplished with a few cheap components from the radioshack.

      Here's my solution; car battery --> relay --> car usb charger ("psu") --> pi
      relay control: ignition live 12v from car --> capacitor --> relay trigger
      split ---> pi gpio

      i do not know the peripherals of using the gpio pins so you might have to add something in between the ignition 12v split line, for instance, the gpio might require a specific voltage to operate (many easy cheap ways to overcome this problem) or may be that gpio doesn't understand and/or is not code-able to perform any task under the circumstance "voltage present --> voltage disappears"

      what happens is when you turn the key, the Pi starts as it normally would. When you turn the car off, the capacitor holds the relay trigger (a lot of cheap capacitors can do this as the current is very small) a while longer, so the Pi can shutdown. It will do so when GPIO pins "see" that there's no ignition-live voltage anymore. Pi shuts down, and a while later, relay opens, no power drainage what so ever.

      it may be that I'm still missing something, but so far the costs involved are probably around 10$. A lot of people are actually considering buying 100$+ car PSUs to power their Pi's, to me that eliminates the purpose of a cheap car pc.

      Delete
  3. Keep up with the good work man! I check your blog every day for updates. I'm planning to do a simmilar project when i'll have some more time...

    ReplyDelete
  4. Awesome!!! Please could you show a diagram? I'm trying to do this with a stn1110 an arduino

    ReplyDelete
  5. great work i'm planning a Heads up display using a pi so your in site into the odbII stuff is very useful to me, if you need any help with the c++ stuff let me know

    ReplyDelete
  6. Wolfram: Today I successfully completed a full raspberry pi carputer install complete with wifi via my Galaxy Nexus (running android 4.2.1; similar to the S III) hotspot, 7" touchscreen, XBMC running on openElec on the pi, a hardwired power toggle for the pi, uninterrupted media streaming from my home library, and it's dual booted running one of the stock images from the rPi foundation so I can actually run game emulators using the nexus as a controller over wifi. Working on gps right now but it seems to me that screen sharing via the gps on the nexus may be my ultimate route. I've been reading your blog updates and love your ideas.... I too am in no way a programmer or linux guy. I'm putting together a n00b guide as we speak (wanted to wait until i actually had this successfully installed) that I'll put a link to right here.

    ReplyDelete
  7. Hello! your blog is awsome, yhanks for sharing your projects!
    How are you guys connecting the power on the pi inside the car? I'm also planning on put the pi inside my car but I was worried if the power will be stable and how to manage the shutdown as well..

    ReplyDelete
    Replies
    1. http://www.amazon.com/Car-PC-Hacks-Damien-Stolarz/dp/0596008716/ref=sr_1_1?ie=UTF8&qid=1302670221&sr=8-1

      Check out this book. While it may be a bit outdated in the computers it uses, the topics covered are still very much relevant. It even has a whole section devoted to powering the Car PC.

      Delete
    2. I bought a slim line power inverter with a usb connection and it provides ample power for the pi. For the shutdowns i installed a rocker switch on the microUSB cable..... works like a charm.

      Delete
  8. Good to know that the carputer is getting along pretty well! How is it now? I think using Raspberry Pi as an alternative operating system for you carputer was a great idea, especially since your phone can’t always be in your car. The battery life would have been another problem with the old carputer. The new one would provide a boost to the car’s performance, that’s for sure!

    ReplyDelete
  9. http://www.autozone.com/autozone/accessories/Duralast-130-Watts-slim-power-inverter/_/N-26g4?itemIdentifier=28046_0_0_

    http://www.radioshack.com/product/index.jsp?productId=2062533

    ReplyDelete
  10. Waiting in anticipation here for more updates, as I'm wanting to start something similar myself, except I was thinking Android OS, and possibly daisy chaining 2 Pis together. Would make a mean in car centre console!

    ReplyDelete
  11. Loving this write up. I have been aiming for the same goal as you. Now I would ideally like to ideally have something similar to the torque app running on the 7 " screen. Just not sure whether to go the same route as yourself or mirror my phone on the screen.

    ReplyDelete
    Replies
    1. Great writeup Wolfram. I Love Torque. I'll probably be doing a screen share with my Samsung Note 2.

      Delete
  12. How does the android screen sharing work? Obviously I could just use the HDMI out but it sounds like Eric and BigBobE are referring to wireless sharing. What are the options there. VNC doesn't seem like a viable solution given the poor framerate. Allcast Share seems to be limited to an hdmi dongle.

    ReplyDelete
    Replies
    1. I'm using a Samsung Galaxy Nexus which has been flashed with Android 4.2.2. This supports wireless screen sharing (it's built right into the OS) but requires a Miracast compatible device. I bought a Miracast hub off Amazon that connects via RCA/HDMI which is running to the screen in the car. The problem I'm running into now is power as the screen, video hub, usb hub, rPi, and external SSD are all taking a lot of juice. I'm putting in a capacitor this week so hopefully that will change things, but the native Android 4.2.2 wireless screen sharing is definitely your best route.

      Delete
  13. One other issue I'm struggling with is putting the RPi into sleep mode. I'm very familiar with relays so I can provide some help there, but I'm not sure what ability the RPi has to sleep and wake via GPIO or how to integrate with the GPIO.

    ReplyDelete
  14. dude.. send me an email... scrooks@microsoft.com I want to collaborate on your RPi project (personal project, not company-related), and also have a bit of an expanded feature set. I had a similar idea for a device I wanted a year ago. I went to look in the market for just one aspect of the features I had for my idea, and there is nothing out there.. pathetic.

    http://the8thlayerof.net

    ReplyDelete
  15. Hi!

    Very nice post Wolfram!
    I am also working at a car pc project with raspberry PI for my car. Until now I have Raspbian with XBMC 12 on a 7 inch display with touch screen and they are working very well.
    http://www.engineering-diy.blogspot.ro/2013/02/raspberry-pi-raspbian-xbmc-and-egalax-7.html
    I have also compiled navit for offline navigation(tutorial: http://astrobeano.blogspot.com/2012/10/navit-gps-on-raspberry-pi.html).
    The problem I have encountered is that XBMC runs in the framebuffer and navit is running in xserver and I cannot switch between them because XBMC always stays on top - the only solution is to close xbmc in order to see navit.
    Now I have two possibilities:
    1. Run just xbmc for media center on the display and use my phone on the windshield for navigation
    2. Replace Raspberry PI with the cheapest laptop I find and install ubuntu + compiz + XBMC + Navit

    Regards,
    Andrei

    ReplyDelete
  16. Howdy!

    Just wondering if you ever finished your project. I'm working on my own iPhone tethering, Bluetooth, Wifi, GPS, ODB-II, Wikispeedia uplinked, meta-cruise-control driving in-dash infotainment computer for my truck. I've got a long way to go, but I've already solved a few interesting problems.

    http://blog.wolfteck.com/projects/truckputer/

    That's the overview page -- check out the sub-projects for the actual fun and games.

    Cheers!

    ReplyDelete
  17. This comment has been removed by the author.

    ReplyDelete
  18. Hi!

    I have made a new post with my CarPC
    http://www.engineering-diy.blogspot.ro/2013/08/car-pc-projectaugust-2013-update.html

    Andrei

    ReplyDelete
  19. This comment has been removed by a blog administrator.

    ReplyDelete