In this previous post I went through my initial setup of OpenAuto Pro (OAP). There are still a few bits-and-bobs to sort out.
I came across the CarPiHat PCB board on the OAP forum. The seller had developed it while installing OAP into his Subaru Forester STi (below), so a good bet for playing nicely with my JDM Subaru.
I purchased the board off Tindie (also available from The Pi Hut). It was quite pricey getting it to New Zealand from the UK, but it adds some interesting features, and there are some good instructions on the wiki page on GitHub. If you are thinking about getting one, consider getting the maker’s 4-pin and 6-pin Molex Nanofit pigtails too – they are a ball ache to get (in NZ anyway) and make yourself.
The CarPiHat’s features (amongst others):
- A real-time clock (RTC). Not a biggie, since my OAP will get time from connected phone – but nice to have. Setup here.
- A power down latch. The intended purpose for this is ‘safe shutdown’ of RPi – power is drawn from always-on 12V line and the IGN line is used to trigger a power down sequence.
- Four optically isolated inputs between the 12V car lines and GPIO pins (3.3V) – safer than the potential dividers I have been using for illumination and reverse.
- A 12V > 5V buck converter built in, for power supply to RPi and screen.
Anyway, as I said, more info and instructions are on the github repo.
Accessing unused GPIO pins
The wiki lists GPIO pins 5, 6, 15, 16, 18, 19, 20, 21 and 26 as still being free, not used for CAN etc. I am using some of these for button controls. Unfortunately, the 40-pin header on the CarPiHat is not ‘stackable’ so not easy to get at these pins.
I Jerry-rigged a ‘hat’ (if one can call it that), that sits in between the CarPiHat and the RPi. Not pretty but it works.
I could not get reversing app function to work (GPIO7) with the CarPiHat connected. I thought I had blown the pin and tried another RPi. No luck. It was driving me nuts. I’d missed this line in the instructions: you must redirect CS1 for SPI peripherals (which is on GPIO7 too). So, make sure to add the following to the end of
sudo nano /boot/config.txt
The seller’s wiki gives instruction on how to setup so the system powers down 10 seconds after ignition is turned off using a Python script running in the background.
I have written an alternative which pops up a dialog overlay with a countdown and the option to snooze for however-many minutes. This gives a bit more feedback what is going on and saves a reboot if you are popping into the shops. Github repo here.
The setup instructions are in the GitHub repo readme.
What really drove (BahhHahahaha!) me to buy the CarPiHat was the advertised ‘independent CAN bus port’. The board has CAN L and CAN H inputs and I have CAN L and CAN H output on the car port I am reusing (that plugged into back of the old Japanese OEM system). The seller having a JDM Subaru like mine made me hopeful.
Seemed too good to be true, and it was.
I emailed the seller. It is not as simple as connecting car CAN H/L to hat CAN H/L and setting something up in OAP. He is using an iDrive system (I’d not heard of before before):
Anyway, I currently do not have OBD dials working in OAP, with no identifiable solution presently – my 2006 Subaru does not work with Bluetooth ELM327 dongles.
Am sure there’s a fix – for another day.