I kept flipping back and forth between using an Arduino and a Raspberry Pi for this project. Both have libraries for reading from an OBD-II serial connection. My gut was to go with the Arduino since I have more experience with the language and I know they are pretty versatile, but I ran into a big problem...displays. There was nothing that I found that seemed easy to implement and would allow for a touch screen without extra code. I also saw this as a good opportunity for me to use a Pi that I had gotten a while back and never used. I have pretty minimal experience with python but took on the challenge anyways.
The parts that I used for this are:
- Raspberry Pi
- 7" Touch Screen (Raspberry Pi Foundation)
- OBD-II to USB
- Blank Gauge Plate
- Custom 3D print Case (Will link to files for printing after testing)
The first thing to note is that the screen is a touch screen, which is really handy for being in the car. This means I can go in and change things or click on things without an attached keyboard or mouse. The other great thing about it is that there is a sender board with the screen that turns the touch actions into a fake mouse essentially. This sender board then plugs into the Pi with USB and requires no extra programming or wiring! It truly is plug and play!
CRAPPY FLOW CHART |
I used whatever the most current distribution of Raspian is for the OS on the Pi. I then set to work with making a python program that would pull the information from the car and send it to a GUI. I chose Tkinter as the GUI package to use (probably wouldn't use again for something more dynamic like this). The screen below is what I came up with for a general layout.
The boxes are changeable to pull the different data that is available over the OBD-II. I have also added color changing such as the coolant cell, where it looks at the temperature coming in and changes the background color of the cell depending on the values. So when the car is cold it is blue, normal operating temperature is gray, and if it goes over a set threshold it turns red. This allows for quick visual analysis of what is happening with the car. This same concept was put into the RPM value, where the number changes colors depending on the value to act as a shift light. COOL STUFF RIGHT! LETS SEE THAT IQ3 DO THAT!
I am still working on the programming, but at some point I intend to add a push button in place of the quit button that will trigger data logging. So you can push it when you want to start and it will save whatever data you have specified to a file and then stop when the car is turned off or if the button is pushed again.
One of the other hurdles that I am trying to get over right now is to set up the Pi so that when the car is turned on it will automatically start his program and make it full screen. I have read some things on the internet on how to do this, but the ones I have tried have not been successful. Any recommendations are welcome.
Below is the case I designed to be 3D printed to hold it all. I will cut a hole out of the blank gauge plate and then bolt this whole assembly to it. I am still figuring out what I was to do about wiring in the power from the car to the screen/Pi. There will be more on that down the road.
Front of screen attached to 3D printed case |
Back side of case and screen |
I really hate when people post code for projects like this that are half finished, so at this time I am not going to post my code unless someone asks for it. I will make a second entry about this as I get it put into the car and work out the final bugs with everything. At that point I will release files for the 3D print and the finalized code that I am going to run. SO STAY TUNED!