ODB2 Diagnostic Insights

Posted by : on

Category : powershell   scripts   network


table table

YOU CAN ACCESS THE TOOL HERE https://arsscriptum.github.io/odb2-insights/

What’s This ?

It’s my lazy attempt at setting up a database containing all the possible ODB2 diagnostic codes. This project consist of a

first part: Gather all ODB2 Diagnostics Codes from online Resources second part: Create a UI to get data on a ODB2 Code

What is a Diagnostic Trouble Code (DTC)?

Diagnostic trouble codes, in broad terms, are codes that computer diagnostic system in a given car has. The system displays a certain code depending on what kind of problem that the system can detect from inside of a car. Diagnostic trouble costs are used to help car mechanics and owners with a rich expertise in car maintenance understand problems with the car and where the root of the car’s problem or problems may lie. These codes must be used along with the car’s manual to determine what needs to be examined and tested to properly diagnose a car’s problem whether from professional OBD 2 software or with a car code reader.

Explication of Diagnostic Codes

DTCs come in a string of five characters. One code for example, might be “P0806”.

banner

The first character will either be P (powertrain), B (Body-AC/Airbag), C (chassis-ABS) or U (network-CAN/BUS). This character will help you determine which of the four main car’s parts is at fault.

The second character either will be a 0 or 1. 0 means it is a generic OBD 2 code. 1 means it is a car manufacturer exclusive code.

The third character can be one of many letters or numbers. This list of characters include 1 (fuel and air metering), 2 (fuel and air metering-injector circuit), 3 (ignition system or misfire), 4 (auxiliary emission control), 5 (vehicle speed and idle control systems), 6 (computer autput circuit), 7,8 or 9 (transmission) and A, B or C (hybrid propulsion).

The fourth and fifth characters in the code represent a specific description of the problem with the part and system in question. These are numbered by “00”, “01”, “02” and so on.

In total, there are over 10,000 generic and manufacturer exclusive OBD 2 troubleshooting codes that exist. You can refer to our master list of DTCs to help you best understand your specific car problem based on your code.

In my database, I have listed 10,755 codes.

Difference Between Generic & Manufacturer Specific…

As explained earlier, general DTCs start with P0XXX, and manufacturer exclusive DTCs start with P1XXX. Generic DTCs are defined in the standards for OBD 2 and EOBD 2, and applies to all official car manufacturers.

banner

Manufacturer exclusive DTCs, however, are not available in the generic code databases, and are instead created and defined by a car manufacturer for all the cars they make.

B Codes

B codes are also broken down into generic and manufacturer-specific code lists and should be looked at carefully when diagnosing your vehicle. Again, B0000-B1000 and B3000-B4000 codes are generic, while codes between B1000-B3000 are manufacturer-specific and may not necessarily be found in generic databases.

bcodes

U Codes - Network

For networking codes, U0000 to U1000 and U3000 to U4000 are generic, whereas codes from U1000 to U3000 are manufacturer-specific.

ucodes

C Codes

Following the pattern of both B and U codes, chassis codes are generic when they range from C000-C1000 and C3000-C4000. DTCs that are between C1000-C3000 are manufacturer-specific and further research is needed to properly diagnose your car’s issue.

ccodes

P Codes

For powertrain codes, P0000 to P1000, P2000 to P3000 and P34xx and P39xx are generic, whereas codes from P1xxx to P2xxx and P30xx-P33xx are manufacturer-specific.

pcodes

Resources

I have found the following online resources for codes

  1. obd2pros
  2. obd-codes.com
  3. Kelly’s Blue Book

Resolving Codes Using PowerShell

Scripts

HtmlAgilityPack

I use Html Agility Pack (HAP), an HTML parser written in C# to read/write DOM and supports plain XPATH or XSLT to parse the pages where my data is stored.

You can download it using a script I wrote:

install

Parsing obd-codes.com

Parsing Body Codes

banner
gif
function Get-GenericBodyCodesUrls {
    [CmdletBinding(SupportsShouldProcess)]
    param()

    try {

        Add-Type -AssemblyName System.Web

        $Null = Register-HtmlAgilityPack

        $Ret = $False

        $Url = "https://www.obd-codes.com/body-codes"
        $HeadersData = @{
            "authority" = "www.obd-codes.com"
            "method" = "GET"
            "path" = "/body-codes"
            "scheme" = "https"
            "accept" = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8"
            "cache-control" = "no-cache"
            "pragma" = "no-cache"
            "priority" = "u=0, i"
            "referer" = "https://www.obd-codes.com/body-codes"
        }
        $Results = Invoke-WebRequest -UseBasicParsing -Uri $Url -Headers $HeadersData
        $Data = $Results.Content
        if ($Results.StatusCode -eq 200) {
            $Ret = $True
        }

        $HtmlContent = $Results.Content

        [HtmlAgilityPack.HtmlDocument]$HtmlDoc = @{}
        $HtmlDoc.LoadHtml($HtmlContent)
        $HtmlNode = $HtmlDoc.DocumentNode

        [System.Collections.ArrayList]$ParsedList = [System.Collections.ArrayList]::new()
        $Valid = $True
        $Id = 1
        while ($Valid) {
            try {
                $XPathLinks = "/html/body/div/div[2]/p[3]/a[{0}]" -f $Id
                $Id++

                $ResultNodeLinks = $HtmlNode.SelectSingleNode($XPathLinks)

                if (!$ResultNodeLinks) {
                    Write-Verbose "EMPTY"
                    $Valid = $False
                    break;
                }

                $CodeValue = $ResultNodeLinks.InnerText
                $CodeUrlSuffix = $ResultNodeLinks.Attributes[0].Value

                $CodesUrl = 'https://www.obd-codes.com{0}' -f $CodeUrlSuffix
                [void]$ParsedList.Add($CodesUrl)

            } catch {
                Write-Verbose "$_"
                continue;
            }

        }

        return $ParsedList
    }
    catch {
        Write-Warning "Error occurred: $_"
        return $null
    }
}

function Get-GenericBodyCodes {
    [CmdletBinding(SupportsShouldProcess)]
    param()

    try {

        Add-Type -AssemblyName System.Web

        $Null = Register-HtmlAgilityPack

        $Ret = $False

        $Url = "https://www.obd-codes.com/body-codes"
        $HeadersData = @{
            "authority" = "www.obd-codes.com"
            "method" = "GET"
            "path" = "/body-codes"
            "scheme" = "https"
            "accept" = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8"
            "cache-control" = "no-cache"
            "pragma" = "no-cache"
            "priority" = "u=0, i"
            "referer" = "https://www.obd-codes.com/body-codes"
        }
        $Results = Invoke-WebRequest -UseBasicParsing -Uri $Url -Headers $HeadersData
        $Data = $Results.Content
        if ($Results.StatusCode -eq 200) {
            $Ret = $True
        }

        $HtmlContent = $Results.Content

        [HtmlAgilityPack.HtmlDocument]$HtmlDoc = @{}
        $HtmlDoc.LoadHtml($HtmlContent)
        $HtmlNode = $HtmlDoc.DocumentNode

        [System.Collections.ArrayList]$ParsedList = [System.Collections.ArrayList]::new()
        $Valid = $True
        $Id = 1
        Write-Host "Fetching Description for Body Codes..." -f DarkCyan
        while ($Valid) {
            try {
                $XPathLinks = "/html/body/div/div[2]/p[3]/a[{0}]" -f $Id
                $Id++

                $ResultNodeLinks = $HtmlNode.SelectSingleNode($XPathLinks)

                if (!$ResultNodeLinks) {
                    Write-Verbose "EMPTY"
                    $Valid = $False
                    break;
                }

                $CodeValue = $ResultNodeLinks.InnerText
                $CodeUrlSuffix = $ResultNodeLinks.Attributes[0].Value
                Write-Host -n " -> $CodeValue" -f DarkYellow
                

                $CodesUrl = 'https://www.obd-codes.com{0}' -f $CodeUrlSuffix
                $BodyCodeDescription = Get-GenericBodyCodeDescriptionFromUrl $CodeUrlSuffix

                [pscustomobject]$o = [pscustomobject]@{
                    Code = "$CodeValue"
                    Description = $BodyCodeDescription
                    Url = "$CodesUrl"
                    Type = 'Body'
                }
                [void]$ParsedList.Add($o)
                Write-Host "OK" -f DarkGreen
            } catch {
                Write-Verbose "$_"
                continue;
            }

        }

        return $ParsedList
    }
    catch {
        Write-Warning "Error occurred: $_"
        return $null
    }
}

Parsing Chassis Codes

banner

function Get-GenericChassisCodes {
    [CmdletBinding(SupportsShouldProcess)]
    param()

    try {

        Add-Type -AssemblyName System.Web

        $Null = Register-HtmlAgilityPack

        $Ret = $False

        $Url = "https://www.obd-codes.com/trouble_codes/obd-ii-c-chassis-codes.php"
        $HeadersData = @{
            "authority" = "www.obd-codes.com"
            "method" = "GET"
            "path" = "/trouble_codes/obd-ii-c-chassis-codes.php"
            "scheme" = "https"
            "cache-control" = "no-cache"
            "pragma" = "no-cache"
            "priority" = "u=0, i"
            "referer" = "https://www.obd-codes.com/trouble_codes/"
        }
        $Results = Invoke-WebRequest -UseBasicParsing -Uri $Url -Headers $HeadersData
        $Data = $Results.Content
        if ($Results.StatusCode -eq 200) {
            $Ret = $True
        }

        $HtmlContent = $Results.Content

        [HtmlAgilityPack.HtmlDocument]$HtmlDoc = @{}
        $HtmlDoc.LoadHtml($HtmlContent)
        $HtmlNode = $HtmlDoc.DocumentNode

        [System.Collections.ArrayList]$ParsedList = [System.Collections.ArrayList]::new()
        $Valid = $True
        $Id = 1
        while ($Valid) {
            try {
                $XPathLinks = "/html/body/div/div[2]/p[2]/text()[{0}]" -f $Id
                $Id++

                $ResultNodeLinks = $HtmlNode.SelectSingleNode($XPathLinks)

                if (!$ResultNodeLinks) {
                    Write-Verbose "EMPTY"
                    $Valid = $False
                    break;
                }

                $TmpString = $ResultNodeLinks.InnerText.Trim()

                $Code = $TmpString.SubString(0, 5)
                $Desc = $TmpString.SubString(7).Trim()
                $Url = 'n/a'
                [pscustomobject]$o = [pscustomobject]@{
                    Code = "$Code"
                    Description = "$Desc"
                    Url = "$Url"
                    Type = 'Chassis'
                }

                [void]$ParsedList.Add($o)
            } catch {
                Write-Verbose "$_"
                continue;
            }

        }

        return $ParsedList
    }
    catch {
        Write-Warning "Error occurred: $_"
        return $null
    }
}

Parsing Network Codes

banner

function Get-GenericNetworkCodes {
    [CmdletBinding(SupportsShouldProcess)]
    param()

    try {

        Add-Type -AssemblyName System.Web

        $Null = Register-HtmlAgilityPack

        $Ret = $False

        $Url = "https://www.obd-codes.com/trouble_codes/obd-ii-u-network-codes.php"
        $HeadersData = @{
            "authority" = "www.obd-codes.com"
            "method" = "GET"
            "path" = "/trouble_codes/obd-ii-u-network-codes.php"
            "scheme" = "https"
            "cache-control" = "no-cache"
            "pragma" = "no-cache"
        }
        $Results = Invoke-WebRequest -UseBasicParsing -Uri $Url -Headers $HeadersData
        $Data = $Results.Content
        if ($Results.StatusCode -eq 200) {
            $Ret = $True
        }

        $HtmlContent = $Results.Content

        [HtmlAgilityPack.HtmlDocument]$HtmlDoc = @{}
        $HtmlDoc.LoadHtml($HtmlContent)
        $HtmlNode = $HtmlDoc.DocumentNode

        [System.Collections.ArrayList]$ParsedList = [System.Collections.ArrayList]::new()
        $Valid = $True
        $CategoryId = 1
        $CodeId = 1
        $ValidCodeCount = 0
        for ($CategoryId = 1; $CategoryId -lt 20; $CategoryId++) {
            for ($CodeId = 1; $CodeId -lt 300; $CodeId++) {
                try {
                    $IsSpecial = $False

                    $XPathLinks = "/html/body/div/div[2]/ul[{0}]/li[{1}]" -f $CategoryId, $CodeId
                    $ResultNodeLinks = $HtmlNode.SelectSingleNode($XPathLinks)

                    if (!$ResultNodeLinks) {
                        Write-Verbose "$tableId,$statsId EMPTY"
                        continue;
                    }
                    $ContainsValidLink = $ResultNodeLinks.InnerHtml.Contains('href')

                    $TmpString = $ResultNodeLinks.InnerText.Trim()
                    $CodeValue = $TmpString.SubString(0, 5).Trim()
                    $NetworkCodeDescription = $TmpString.Replace($CodeValue, '').Trim()
                    $NetworkCodeDescription = [System.Net.WebUtility]::HtmlDecode($NetworkCodeDescription)
                    if (($Null -ne $ResultNodeLinks.Attributes) -and ($Null -ne $ResultNodeLinks.Attributes[0].Value)) {
                        $CodeUrlSuffix = $ResultNodeLinks.Attributes[0].Value
                        $CodesUrl = 'https://www.obd-codes.com{0}' -f $CodeUrlSuffix
                    } else {
                        if ($ContainsValidLink) {
                            $CodesUrl = 'https://www.obd-codes.com/{0}' -f $CodeValue
                        } else {
                            $CodesUrl = 'https://www.obd-codes.com/trouble_codes/obd-ii-u-network-codes.php'
                        }
                    }

                    if (($NetworkCodeDescription[0] -eq ',') -or ($NetworkCodeDescription[0] -eq '-')) {
                        $IsSpecial = $True
                    }

                    if ($IsSpecial) {
                        if ($NetworkCodeDescription[0] -eq ',') {
                            $Array = $NetworkCodeDescription.Split(',').Trim()
                            foreach ($s in $Array) {
                                if ($pattern.Match($s).Success) {
                                    $c = $pattern.Match($s).Value
                                    $d = 'ISO/SAE Reserved'
                                    [pscustomobject]$o = [pscustomobject]@{
                                        Code = $c
                                        Description = $d
                                        Url = 'https://www.obd-codes.com/trouble_codes/obd-ii-u-network-codes.php'
                                        Type = 'Network'
                                    }
                                    [void]$ParsedList.Add($o)
                                }
                            }
                        }
                    } else {
                        [pscustomobject]$o = [pscustomobject]@{
                            Code = "$CodeValue"
                            Description = $NetworkCodeDescription
                            Url = "$CodesUrl"
                            Type = 'Network'
                        }
                        [void]$ParsedList.Add($o)
                    }
                    $ValidCodeCount++
                } catch {
                    Write-Verbose "$_"
                    continue;
                }
            }
            #Write-Host "Codes Count $ValidCodeCount"
            $ValidCodeCount = 0
        }

        return $ParsedList
    }
    catch {
        Write-Warning "Error occurred: $_"
        return $null
    }
}

Parsing Power Train Codes

A bit more complex, we need to get teh list of URLS from the code categories, then

banner

function Get-GenericPowertrainCodesFromUrl {
    [CmdletBinding(SupportsShouldProcess)]
    param(
        [Parameter(Mandatory = $true, Position = 0)]
        [string]$Url
    )

    try {

        Add-Type -AssemblyName System.Web

        $Null = Register-HtmlAgilityPack

        $Ret = $False

        $SubPath = $Url.Replace('https://www.obd-codes.com/', '')


        $HeadersData = @{
            "authority" = "www.obd-codes.com"
            "method" = "GET"
            "path" = "$SubPath)"
            "scheme" = "https"
            "accept" = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8"
            "cache-control" = "no-cache"
            "pragma" = "no-cache"
            "priority" = "u=0, i"
            "referer" = "https://www.obd-codes.com/trouble_codes/"
        }
        $Results = Invoke-WebRequest -UseBasicParsing -Uri $Url -Headers $HeadersData
        $Data = $Results.Content
        if ($Results.StatusCode -eq 200) {
            $Ret = $True
        }

        $HtmlContent = $Results.Content

        [HtmlAgilityPack.HtmlDocument]$HtmlDoc = @{}
        $HtmlDoc.LoadHtml($HtmlContent)
        $HtmlNode = $HtmlDoc.DocumentNode

        [System.Collections.ArrayList]$ParsedList = [System.Collections.ArrayList]::new()
        $Valid = $True
        $Id = 2
        [regex]$pattern = '^P[0-3A-Fa-f][0-9A-Fa-f]{3}'
        while ($Valid) {
            try {

                $XPathCode = "/html/body/div/div[2]/ul/li[{0}]/a" -f $Id

                $ResultNodeCode = $HtmlNode.SelectSingleNode($XPathCode)

                if (!$ResultNodeCode) {
                    Write-Verbose "EMPTY"
                    $Valid = $False
                    break;
                }

                [string]$Text = $ResultNodeCode.InnerText.Trim()
                [bool]$IsSuccess = $pattern.Match($Text).Success
                if ($IsSuccess) {
                    $IsSpecial = $False
                    [string]$CodeValue = $pattern.Match($Text).Value
                    $UrlCodeValue = ($ResultNodeCode.Attributes[0].Value).TrimStart(" ").Trim()
                    $FullUrl = 'https://www.obd-codes.com{0}' -f $UrlCodeValue
                    $Desc1 = $Text.Replace($CodeValue, '').Trim()
                    if (($Desc1[0] -eq ',') -or ($Desc1[0] -eq '-')) {
                        $IsSpecial = $True
                    }
                    $Desc2 = [System.Net.WebUtility]::HtmlDecode($Desc1)
                    [pscustomobject]$o = [pscustomobject]@{
                        Code = $CodeValue.Trim()
                        Description = $Desc2.Trim()
                        Url = $FullUrl
                        Type = 'Powertrain'
                    }
                    if ($IsSpecial) {
                        if ($Desc1[0] -eq ',') {
                            $Array = $Desc1.Split(',').Trim()
                            foreach ($s in $Array) {
                                if ($pattern.Match($s).Success) {
                                    $c = $pattern.Match($s).Value
                                    $d = 'ISO/SAE Reserved'
                                    [pscustomobject]$o = [pscustomobject]@{
                                        Code = $c
                                        Description = $d
                                        Url = $FullUrl
                                        Type = 'Powertrain'
                                    }
                                    [void]$ParsedList.Add($o)
                                }
                            }
                        } elseif ($Desc1[0] -eq '-') {
                            $TmpDesc = $Desc1.TrimStart('- ')
                            $CodeValue1 = $CodeValue
                            [string]$CodeValue2 = $pattern.Match($TmpDesc).Value

                            Get-Obd2CodeRange $CodeValue1 $CodeValue2 | % {
                                $NewDesc = $Desc2.Trim('- ').Trim($CodeValue2).Trim()
                                [pscustomobject]$o = [pscustomobject]@{
                                    Code = "$_"
                                    Description = $NewDesc
                                    Url = $FullUrl
                                    Type = 'Powertrain'
                                }
                                [void]$ParsedList.Add($o)
                            }
                        }
                    } else {
                        [void]$ParsedList.Add($o)
                    }

                }

                $Id++
                Write-Verbose "ok"

            } catch {
                Write-Verbose "$_"
                continue;
            }

        }
        $ParsedList


    } catch {
        Write-Warning "Error occurred: $_"
        return $null
    }
}
function Get-GenericPowertrainCodes {
    [CmdletBinding(SupportsShouldProcess)]
    param()


    $CodeUrls = Get-GenericPowertrainCodesUrls
    $CodeUrlsCount = $CodeUrls.Count
    Write-Host "[Powertrain Codes] Found $CodeUrlsCount Urls"
    $i = 0

    $All = $CodeUrls.ForEach({
            Write-Host "[Powertrain Codes] $i) Listing Codes from `"$_`"..."
            Get-GenericPowertrainCodesFromUrl -Url "$_"
            $i++
        })

    $All
}

function Get-GenericPowertrainCodesUrls {
    [CmdletBinding(SupportsShouldProcess)]
    param()

    try {

        Add-Type -AssemblyName System.Web

        $Null = Register-HtmlAgilityPack

        $Ret = $False

        $Url = "https://www.obd-codes.com/p00-codes"
        $HeadersData = @{
            "authority" = "www.obd-codes.com"
            "method" = "GET"
            "path" = "/p00-codes"
            "scheme" = "https"
            "accept" = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8"
            "cache-control" = "no-cache"
            "pragma" = "no-cache"
            "priority" = "u=0, i"
            "referer" = "https://www.obd-codes.com/p01-codes"
        }
        $Results = Invoke-WebRequest -UseBasicParsing -Uri $Url -Headers $HeadersData
        $Data = $Results.Content
        if ($Results.StatusCode -eq 200) {
            $Ret = $True
        }

        $HtmlContent = $Results.Content

        [HtmlAgilityPack.HtmlDocument]$HtmlDoc = @{}
        $HtmlDoc.LoadHtml($HtmlContent)
        $HtmlNode = $HtmlDoc.DocumentNode

        [System.Collections.ArrayList]$ParsedList = [System.Collections.ArrayList]::new()
        $Valid = $True
        $Id = 1
        while ($Valid) {
            try {
                $XPathLinks = "/html/body/div/div[2]/p[3]/a[{0}]" -f $Id
                $Id++

                $ResultNodeLinks = $HtmlNode.SelectSingleNode($XPathLinks)

                if (!$ResultNodeLinks) {
                    Write-Verbose "EMPTY"
                    $Valid = $False
                    break;
                }

                $TagEnd = '">{0}</a>' -f $ResultNodeLinks.InnerHtml
                $UrlSuffix = $ResultNodeLinks.OuterHtml.TrimStart('<a href="').TrimEnd($TagEnd)

                $CodesUrl = 'https://www.obd-codes.com{0}' -f $UrlSuffix
                [void]$ParsedList.Add($CodesUrl)
            } catch {
                Write-Verbose "$_"
                continue;
            }

        }

        return $ParsedList
    }
    catch {
        Write-Warning "Error occurred: $_"
        return $null
    }
}

P1*** Manufacturer Specific Trouble Codes

P1* Manufacturer Specific Trouble Codes If your DTC (diagnostic trouble code) begins with **P1___, that means it’s a manufacturer specific code. For more information on P1 codes, choose your vehicle make below:

Suppose you want to get the list of manufacturers listed on this website:

carmakes

function Get-AllCarMakes {
    [CmdletBinding(SupportsShouldProcess)]
    param()

    try {

        Add-Type -AssemblyName System.Web

        $Null = Register-HtmlAgilityPack

        $Ret = $False

        $Url = "https://www.obd-codes.com/trouble_codes/"
        $HeadersData = @{
           "authority"="www.obd-codes.com"
           "method"="GET"
           "path"="/trouble_codes/"
           "scheme"="https"
           "cache-control"="no-cache"
           "pragma"="no-cache"
           "priority"="u=0, i"
        }
        $Results = Invoke-WebRequest -UseBasicParsing -Uri $Url -Headers $HeadersData
        $Data = $Results.Content
        if ($Results.StatusCode -eq 200) {
            $Ret = $True
        }

        $HtmlContent = $Results.Content

        [HtmlAgilityPack.HtmlDocument]$HtmlDoc = @{}
        $HtmlDoc.LoadHtml($HtmlContent)
        $HtmlNode = $HtmlDoc.DocumentNode

        [System.Collections.ArrayList]$ParsedList = [System.Collections.ArrayList]::new()

        for ($x = 1; $x -lt 6; $x++) {
            for ($y = 1; $y -lt 6; $y++) {
                try {
                    $XPath = "/html/body/div/div[2]/div[3]/div[{0}]/ul/li[{1}]/a" -f $x,$y
                    $ResultNodeDesc = $HtmlNode.SelectSingleNode($XPath)

                    if (!$ResultNodeDesc) {
                        Write-Verbose "[$x,$y] EMPTY"
                        Continue;
                    }

                    [string]$CarMake = $ResultNodeDesc.InnerText
                    Write-Verbose "[$x,$y] FOUND $CarMake"
                    [void]$ParsedList.Add($CarMake)
                } catch {
                    Write-Verbose "$_"
                    continue;
                }
         }   
        }
        
        return $ParsedList
        
    }
    catch {
        Write-Warning "Error occurred: $_"
        return $null
    }
}

Then:

 > GEt-AllCarMakes

Name       Description
----       -----------
acura      Acura
audi       Audi
bmw        BMW
chevrolet  Chevrolet
dodge      Dodge / Chrysler / Jeep
ford       Ford
honda      Honda
hyundai    Hyundai
infiniti   Infiniti
isuzu      Isuzu
jaguar     Jaguar
kia        Kia
landrover  Land Rover
lexus      Lexus
mazda      Mazda
mitsubishi Mitsubishi
nissan     Nissan
subaru     Subaru
toyota     Toyota
vw         VW

Get-ManufacturerSpecificCodes

Will load a page in the manufacturer’s specific list, for example, bmw, download the page, parse it and export the codes to JSON format.

> Get-ManufacturerSpecificCodes -CarMake audi

Code  Description
----  -----------
P1101 O2 Sensor Circ.,Bank1-Sensor1Voltage too Low/Air Leak
P1102 O2 Sensor Heating Circ.,Bank1-Sensor1 Short to B+
P1103 O2 Sensor Heating Circ.,Bank1-Sensor1 Output too Low
...

Export-ManufacturerSpecificCodesJson

Will Export all the specific codes for all manufacturers, in a list of Json files. See the files here. For Example bmw.json

> Export-ManufacturerSpecificCodesJson
Wrote acura.json
Wrote audi.json
Wrote bmw.json
Wrote chevrolet.json
Wrote dodge.json
...

ls ManufacturerSpecificCodes

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a---           5/29/2025 12:17 AM           4459 acura.json
-a---           5/29/2025 12:17 AM          58327 audi.json
-a---           5/29/2025 12:17 AM          26646 bmw.json
-a---           5/29/2025 12:17 AM              6 chrysler.json
-a---           5/29/2025 12:17 AM           8176 dodge.json
-a---           5/29/2025 12:17 AM          19469 ford.json
-a---           5/29/2025 12:17 AM           6681 honda.json
-a---           5/29/2025 12:17 AM          12856 hyundai.json
-a---           5/29/2025 12:17 AM           3243 infiniti.json
-a---           5/29/2025 12:17 AM           5176 isuzu.json
-a---           5/29/2025 12:17 AM              6 jeep.json
-a---           5/29/2025 12:17 AM           4378 kia.json
-a---           5/29/2025 12:17 AM              6 land.json
-a---           5/29/2025 12:17 AM           5248 lexus.json
-a---           5/29/2025 12:17 AM           1048 mitsubishi.json
-a---           5/29/2025 12:17 AM           2908 nissan.json
-a---           5/29/2025 12:17 AM              6 rover.json
-a---           5/29/2025 12:17 AM           3737 toyota.json
-a---           5/29/2025 12:17 AM              6 vw.json

Get-CodeDescription

> Get-CodeDescription -Code "P1457" -CarMake bmw

Code  Description                                                                CarMake
----  -----------                                                                -------
P1457 Heated Catalyst Heater Power Switch Temperature Sensor Electrical (Bank 1) bmw

If it doesn’t exists in the Manufacturere Specific COdes (Generic Code), it will open a web page:

banner

Update-CodeDescriptions

Will get codes for Chassis, PowerTrain, Body and Network.

> . .\Update-CodeDescriptions.ps1

=========================================
Updating Body Codes
=========================================

Fetching Description for b00e6
Fetching Description for b00e7
Fetching Description for b00e8
Writing Body Codes Json File "W:\odb2-insights\html\data\bodycodes.json"

=========================================
Updating Powertrain Codes
=========================================

[Powertrain Codes] Found 24 Urls
[Powertrain Codes] 0) Listing Codes from "https://www.obd-codes.com/p00-codes"...
[Powertrain Codes] 1) Listing Codes from "https://www.obd-codes.com/p01-codes"...
[Powertrain Codes] 23) Listing Codes from "https://www.obd-codes.com/p34-codes"...


Writing Powertrain Codes Json File "W:\odb2-insights\html\data\powertraincodes.json"

=========================================
Updating Chassis Codes
=========================================


Writing Body Chassis Json File "W:\odb2-insights\html\data\chassiscodes.json"

Get-GenericBodyCodes

Get all the Body Codes

> Get-GenericBodyCodes

Code  Description                                                                                   Url                             Type
----  -----------                                                                                   ---                             ----
b0001 Driver Frontal Stage 1 Deployment Control (Subfault)                                          https://www.obd-codes.com/b0001 Body
b0002 Driver Frontal Stage 2 Deployment Control (Subfault)                                          https://www.obd-codes.com/b0002 Body
b0003 Driver Frontal Stage 3 Deployment Control (Subfault)                                          https://www.obd-codes.com/b0003 Body

Get-GenericChassisCodes

Get all the Chassis Codes

> Get-GenericChassisCodes

Code  Description                                                                                Url Type
----  -----------                                                                                --- ----
C0000 Vehicle Speed Information Circuit Malfunction                                              n/a Chassis
C0035 Left Front Wheel Speed Circuit Malfunction                                                 n/a Chassis
C0040 Right Front Wheel Speed Circuit Malfunction                                                n/a Chassis
C0800 Device Power #1 Circuit Malfunction                                                        n/a Chassis
C0896 Electronic Suspension Control (ESC) voltage is outside the normal range                   n/a Chassis

Get-GenericPowertrainCodes

Get all the Powertrain Codes

> Get-GenericPowertrainCodes
[Powertrain Codes] Found 24 Urls
[Powertrain Codes] 0) Listing Codes from "https://www.obd-codes.com/p00-codes"...

Code  Description                                                                                                 Url                                                Type
----  -----------                                                                                                 ---                                                ----
P0001 Fuel Volume Regulator Control Circuit/Open                                                                  https://www.obd-codes.com/p0001                    Powertrain
P0002 Fuel Volume Regulator Control Circuit Range/Performance                                                     https://www.obd-codes.com/p0002                    Powertrain
P0003 Fuel Volume Regulator Control Circuit Low                                                                   https://www.obd-codes.com/p0003                    Powertrain
P0004 Fuel Volume Regulator Control Circuit High                                                                  https://www.obd-codes.com/p0004                    Powertrain
P0005 Fuel Shutoff Valve "A" Control Circuit/Open                                                                 https://www.obd-codes.com/p0005                    Powertrain


Kelly’s Error Codes Book

$codeTable = Get-KellyBlueBookCodesTable
$description = $codeTable["P0420"]
Write-Host $description  # ➜ Catalyst System Efficiency Below Threshold (Bank 1)

Kelly’s Code Block

When loading https://www.kbb.com/obd-ii/, we get a list of codes in a GZipped-Compressed Base64 Data blob. I use this to get the codes from Kelly’s

banner

Database

Schema

banner

To Test Data Extraction

Use the script scripts/Test.ps1

banner

To Insert Data

Use the script scripts/Import-DataInDb.ps1

banner

Using Data in the HTML Site

Since Github Pages is hosting Static pages, I need to export the database data to a list of JSON files.


About Guillaume Plante
Guillaume Plante

A developper with a passion for technology, music, astronomy and art. Coding range: hardware/drivers, security, ai,. c/c++, powershell

Email : guillaumeplante.qc@gmail.com

Website : https://arsscriptum.ddns.net

Useful Links