Giter Site home page Giter Site logo

skuzzle-uk / mx5_arduino_diagnostics Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 0.0 59 KB

A small project to read the blink codes from an 89-95 Mazda MX5 diagnostic port and display them as text on an LCD screen.

License: MIT License

C++ 100.00%
arduino mazda mx5 miata obd diagnostics automotive

mx5_arduino_diagnostics's Introduction

MX5 Arduino Diagnostics

A small project to read the blink codes from an 89-95 Mazda MX5 diagnostic port and display them as text on an LCD screen.
Feel free to get involved and test this out or even help to improve it.

Built on an Arduino Mega 2560 with a 2x16 standard kit LCD.
Schematic now included in pdf. Incorrect naming of diagnostic socket pin FEN shown as FEM in schematic

Noteworthy files

MX5_Arduino_Diagnostic.ino

Contains the basic program functions.

  • void setup() - sets up pins, lcd and attaches interrupt
  • void loop() - main program loop
  • void LogCode() - logs an error code when found into fault_array
  • void FlashPin_Interrupt() - called when pin 21 changes state
  • void NewFlashState() - decides what new state means i.e long flash, short flash etc
  • void RebuildFaultArray() - rebuilds fault_array
  • void UpdateDisplay() - updates the LCD display. Called from loop()

lcd_pages.ino

Sets up all of the different display pages of the LCD display.

  • void LCD_ProductInfo() - shows the product information
  • void LCD_ScanningCodes() - displays a visually pleasing scanning codes page so user has feedback to see scanner is doing something
  • void LCD_NoCodesFound() - best result for user as displays no fault codes found in vehicle
  • void LCD_CodesFound() - page that is displayed when fault codes are present
  • Contains other functions used by the 4 noted above

Schematic PDF.pdf

Incorrect naming of diagnostic socket pin FEN shown as FEM in schematic
Circuit schematic to make the hardware the same as I have using an Arduino Mega 2560 and the 1602A LCD screen.
Pins B+, GND, TEN and FEN used from the Mazda MX5 under bonnet diagnostic socket.

Diagnostic socket possible pin meanings

  • B+ : battery positive
  • GND : battery negative
  • TEN : test engine - drops engine into test mode for setting idle speed, ignition timing etc and prepares ecu for fault code output
  • FEN : fault engine - reads out the fault codes via a sequence of going low Potentiometer is included to fine tune the contrast of the LCD screen, but once a nice resistance value is found that gives the best contrast for chosen LCD display, R1 could be swapped out for a resistor of that value.

mx5_arduino_diagnostics's People

Contributors

skuzzle-uk avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mx5_arduino_diagnostics's Issues

Unknown error codes

MX5_Arduino_Diagnostics.ino

Unknown fault codes should display something other than just the flash code number.
Suggest modify FAULT_CODE_LOOKUP_TABLE to have the string "Unknown fault code" or similar in all unknown codes.

Strange LCD character display

Line 140 of lcd_pages.ino

code_display_string[i] = "#"; //@TODO why does this display as a blank space rather than #

This line is part of the codes_found page drawn by LCD_CodesFound() method.
It was designed to add # characters after the error code string had scrolled passed just for visual effect before starting the scroll from the first character again but # draws on my lcd in this line as a non break space (space bar). If I replace the # with a space then I get a lower case p or similar looking character instead.

Work out why this is displaying a totally incorrect character and then make it display # or anything that may be more suitable. This could end up being a space if it looks better, but I hate the fact it does display what I ask it to.

Testing needed to improve times

MX5_Arduino_Diagnostics.ino

9 constexpr float INITIALIZE_TIME = 5000;
10 constexpr float LONG_FLASH_TIME = 1000;
11 constexpr float SHORT_FLASH_TIME = 300;
12 constexpr float DARK_TIME = 1600;
13 constexpr float SEPERATION_TIME = 4000;
14 constexpr float TIME_ERROR_ALLOWED = 200;

These constant expressions are supposed to be set to match the cars flash output system.

There are multiple guides found through google which state that long flash is tens, short flash ones, but nothing to say how long a long flash actually is in millis.

The one's of most interest are LONG_FLASH_TIME, SHORT_FLASH_TIME and DARK_TIME, DARK_TIME being the gap between error codes.

TIME_ERROR_ALLOWED has been added to allow some variation in case between vehicle times are not accurate to the exact millis. This value can be reduced once we have good data of test vehicles.

If you cant test this code on a vehicle, then maybe you could use a scope to measure the time that the pin in the diag box goes to gnd.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.