CarPC build part 2: hardware, still
This is the second part of building a RaspberryPi powered CarPC. I ended previous entry with seemingly nice photos of home etched PCB of hardware revision 1. Unfortunately, things did not go as planned, and I had to derail this project a bit.
After careful inspection of rev 1 PCB, I discovered some hardware bugs, namely:
- I forgot to pull RESET line high. This prevented controller to start when no programmer was attached.
- Pinouts for surface mount transistors can and do differ from what's in Altium designer's libraries.
- A few broken traces.
Frustrated with problems I experienced etching it, I decided to first debug a prototype version of hardware soldered on a protoboard.
It's definitely not pretty, but it works.
As for the software side- I had some of the bits ready (communication via SPI with MCP2515- to read messages from CAN), but I decided to start from scratch, this time ditching the Arduino libraries completely and using plain avr-gcc. It was actually quite an experience, given my last encounters with pure C were a few years ago.
Nevertheless, I got the controller side working- nicely outputting key press/release events via serial port.
As for Linux side of the software- I went for Arch Linux ARM, because I wanted a fairly low control of what's running on Pi.
I was afraid of not getting a decent navigation software running on RaspberryPi. One of the best options seemed to be navit, which I actually went for. Compiled it on Raspberry (which took a good half an hour, relevant xkcd link).
Feeding keypresses from steering wheel buttons to navit turned out to be a straightforward process. In Linux, there is a kernel module for this purpose- uinput. It basically allows user-space software to create virtual input devices, and inject events via this device. These events are then passed to kernel input layer, and are further processed as if they came from hardware keyboard.
There are nice python bindings in
evdev python library, which made this process really easy.
After plugging in USB GPS dongle and running
gpsd, I have almost usable navigation system.
Why almost? A couple of things I don't like in current setup:
- navit is quite laggy for me, in a relatively dense city (Riga, Latvia). I will investigate the reason for this further.
- I still have to configure navit's UI. Font size needs increase (because of abysmal resolution of LCD), and I need to come up with OSD I like. By default, navit only displays a map, without speed, route information etc.
- Street names are virtually unreadable. I'm not sure whether it's entirely display's fault (resolution is too 674x543), or some configuration problem.
More pictures can be found in my Google+ album.
- Ability to see Waze activity (initially, as text because I have heard it's not trivial to add/remove dynamic POIs in navit).
- Integration with stock audio unit to be able to play music from RasPi.
As usual, all the code is available in my github repo.