Car Dashboard
Introduction:
This project allows you to create your own car dashboard connect it to your car via OBDII adapter. Use your own xml config for you car model that you can find on internet, or edit a default one to add commands.
what is car dashboard?
A dashboard is a control panel set within the central console of a vehicle . Usually located directly ahead of the driver it displays instrumentation and controls for the vehicle's operation.
Project Idea :
Provide other information to the driver of the vehicle
Supplies
-
Raspberry Pi 4 Model B
-
HDMI display for Raspberry Pi 5 inch
-
OBDll adapter
-
Micro SD card 32GB
-
micro HDMI
-
power supply 5V-3A
-
type C cable
Supplies Order
Raspberry Pi 4 Model B:
https://www.amazon.sa/dp/B07TC2BK1X/ref=cm_sw_r_wa...
HDMI display for Raspberry Pi 5 inch:
https://www.amazon.sa/dp/B07P7SNTL7/ref=cm_sw_r_wa...
OBDll adapter:
Micro SD card 32GB:
https://gear-up.me/sandisk-ultra-microsdhc-32gb-10...
micro HDMI:
https://www.amazon.sa/dp/B013PWQN1Y/ref=cm_sw_r_wa...
power supply 5V-3A:
https://etqan.sa/product/power-adapter-5v-3a-type-...
type C cable:
Raspberry Pi Setup
steps of setting :
After you connected the micro SD card, start to down load the obrution system from the official website of the Raspberry Pi, https://www.raspberrypi.org/downloads/ ,use the NOBBS software and downloaded to the micro SD card by copping all the file on it. After that, insert the micro SD card to the Raspberry Pi and plug all the cable ( HDMI cable to the monitor, usb cable to ac, etc.), all the optional will seen on the screen.
OBDll Installation
Raspbian Setup:
First, make sure your package lists are up-to-date:
$ sudo apt-get update
Confirm that Python is installed (should be included by default in your Raspbian installation):
$ python --version
Install Python setuptools to get PIP (the Python package manager):
$ sudo apt-get -y install python-pip
Install the python-OBD library via PIP:
$ sudo pip install obd
Install the RPi-GPIO library via PIP:
$ sudo pip install RPi.GPIO
Install the pyserial library:
$ sudo apt-get install python-serial
Next, enable auto-login to the 'pi' user (or whichever user you choose to run the scripts under):
$ sudo nano /etc/systemd/system/getty.target.wants/getty@tty1.service
Change the ExecStart line to:
$ ExecStart=-/sbin/agetty -a pi %I $TERM
Code
import pygame
from pygame.locals import *
import obd
pygame.init()
#connection = obd.OBD()
connection = obd.Async(fast=False)
screen = pygame.display.set_mode((0,0),pygame.FULLSCREEN)
screen_w = screen.get_width()
screen_h = screen.get_height()
circle_y = screen_h/2
circle1_x = screen_w * .25
circle2_x = screen_w * .5
circle3_x = screen_w * .75
circle_rad = (circle2_x - circle1_x)/2
speed_text_x = screen_w * .25
speed_text_y = screen_h * .25
rpm_text_x = screen_w * .5
rpm_text_y = screen_h * .25
load_text_x = screen_w * .75
load_text_y = screen_h * .25
headerFont = pygame.font.SysFont("Arial", 50)
digitFont = pygame.font.SysFont("Arial", 50)
white = (255,255,255)
black = (0,0,0)
grey = (112, 128, 144)
speed = 0
rpm = 0
load = 0
def draw_hud():
screen.fill(grey)
pygame.draw.circle(screen, black, (int(circle1_x), int(circle_y)), int(circle_rad), 5)
pygame.draw.circle(screen, black, (int(circle2_x), int(circle_y)), int(circle_rad), 5)
pygame.draw.circle(screen, black, (int(circle3_x), int(circle_y)), int(circle_rad), 5)
speed_text = headerFont.render("SPEED", True, black)
rpm_text = headerFont.render("RPM", True, black)
load_text = headerFont.render("LOAD", True, black)
speed_text_loc = speed_text.get_rect(center=(speed_text_x, speed_text_y))
rpm_text_loc = rpm_text.get_rect(center=(rpm_text_x, rpm_text_y))
load_text_loc = load_text.get_rect(center=(load_text_x, load_text_y))
screen.blit(speed_text, speed_text_loc)
screen.blit(rpm_text, rpm_text_loc)
screen.blit(load_text, load_text_loc)
def get_speed(s):
global speed
if not s.is_null():
speed = int(s.value.magnitude) #for kph
#speed = int(s.value.magnitude * .060934) #for mph
def get_rpm(r):
global rpm
if not r.is_null():
rpm = int(r.value.magnitude)
def get_load(l):
global load
if not l.is_null():
load = int(l.value)
connection.watch(obd.commands.SPEED, callback=get_speed)
connection.watch(obd.commands.RPM, callback=get_rpm)
connection.watch(obd.commands.ENGINE_LOAD, callback=get_load)
connection.start()
running = True
while running:
for event in pygame.event.get():
if event.type == KEYDOWN:
if event.key == K_ESCAPE:
connection.stop()
connection.close()
running = False
elif event.type == QUIT:
connection.stop()
connection.close()
running = False
draw_hud()
speedDisplay = digitFont.render(str(speed), 3, white)
rpmDisplay = digitFont.render(str(rpm), 3, white)
loadDisplay = digitFont.render(" " + str(load) + " %", 3, white)
screen.blit(loadDisplay, (circle3_x-(circle3_x/8), circle_y-45))
screen.blit(rpmDisplay, (circle2_x-(circle2_x/8), circle_y-45))
screen.blit(speedDisplay,(circle1_x-(circle1_x/8), circle_y-45))
pygame.display.update()
pygame.display.flip()
Downloads
Project Problems
problem:
Bluetooth OBD doesn't send data from car to Raspberry Pi.
The solution:
Using USB-OBDII.
Video
Thanks and Appreciation to Dr. Jabber
Dear Dr. Jabber
We would like to extend our sincere thanks and appreciation to you for your support and patronage in the accomplishment of our project.
God bless of you..