Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kelvintechnical/vechicle-diagnostic-tool


https://github.com/kelvintechnical/vechicle-diagnostic-tool

Last synced: 27 days ago
JSON representation

Awesome Lists containing this project

README

        

Python Vehicle Diagnostic Tool

Description

Vehicle Diagnostic Tool is a Python-based script that simulates an automotive diagnostics system. It randomly generates diagnostic trouble codes (DTCs) to simulate the experience of running a real diagnostic check on a vehicle. This project helps understand how Python can be applied in automotive diagnostics, focusing on functions, dictionaries, and random selection.

Prerequisites

To run this project, make sure you have Python installed on your system.


  • Install Python: Download and install the latest version of Python from Python.org.

Installation


  1. Step 1: Clone the Repository
    • Clone the repository to your local machine:

    git clone https://github.com/kelvintechnical/Vechicle-Diagnostic-Tool.git

  2. Navigate into the project directory:
  3. cd Vehicle_Diagnostic_Tool

  4. Step 2: Run the Program
    • Start the program by running:

    python diagnostic_tool.py

Features


  • Simulates Diagnostic Trouble Codes: Randomly generates diagnostic trouble codes for practice.

  • Realistic Timing: Uses time delays to simulate actual scanning.

  • Educational Tool: Learn the basics of Python functions, dictionaries, and random selection.

Code Overview

Imports

This program uses two main imports:


python
Copy code
import time
import random
time: Creates delays to mimic the real-time scanning process.
random: Randomly selects error codes from the list to simulate a diagnostic scan.

Diagnostic Trouble Codes (DTCs)

We define a dictionary with sample DTCs:


python
Copy code
dtc_codes = {
"P0010": "Camshaft Position Actuator Circuit",
"P0102": "Mass Air Flow Circuit Low",
"P0128": "Coolant Thermostat Malfunction",
"P0300": "Random/Multiple Cylinder Misfire",
}

Function: run_diagnostics

The main function run_diagnostics simulates a vehicle diagnostics process:


python
Copy code
def run_diagnostics():
print("Starting vehicle diagnostics..")
time.sleep(2)
print("Scanning for error codes..")
time.sleep(5)
error_found = random.sample(list(dtc_codes.keys()), 2)
print("Error codes found")
for code in error_found:
print(f'{code}: {dtc_codes[code]}')
print("Diagnostics complete.")

Explanation:


  • Starting the Diagnostics: The initial print() statement and a time.sleep(2) delay create a starting message and short pause.

  • Scanning for Error Codes: Simulates scanning for errors with another print() message and a time.sleep(5) pause.

  • Error Codes Found: Uses random.sample() to select two random error codes from dtc_codes.

  • Display Results: Prints each selected code with its description.

Usage

Run the program to simulate a vehicle diagnostics scan:

python diagnostic_tool.py

Example output:

vbnet
Copy code
Starting vehicle diagnostics..
Scanning for error codes..
Error codes found
P0010: Camshaft Position Actuator Circuit
P0300: Random/Multiple Cylinder Misfire
Diagnostics complete.

What I Learned


  • Using Libraries: Leveraged time and random for simulation and randomness.

  • Dictionaries for Data Storage: Stored DTC codes and descriptions in a dictionary.

  • Modular Code with Functions: Structured code within functions for organization and reusability.

Support & Feedback

If you found this project helpful, please consider leaving feedback to support my growth as a developer. Suggestions are always welcome!

Follow Me on Instagram

Follow Me on Twitter