Joined: 13 Apr 2013
|Posted: Tue 16 Apr 2013, 23:02 Post subject:
OBD II Scantool on Puppy Precise 5.5
Subject description: Compile sources for allegro, dzcomm and scantool 1.21 with changes to run on Puppy Linux
Since 1996 all cars sold in the US have been required to support the OBD II standard (On-Board Diagnostics). There are many devices available on the market to interface to these cars, both stand alone and PC based. One popular set of devices are based around the ELM327 microcontroller from ELM Electronics, which includes versions in RS-232, USB and Bluetooth. These ELM327 and ELM327 based clones allow a PC to communicate to the car's OBD port, and support most, if not all, OBD II protocols used today.
This post details the steps needed to create a Puppy Linux (or other Linux) based PC OBD II Scantool using the USB version of ELM327 based Diagnostics Interface cables and open source software from scantool.net version 1.21, allegro version 18.104.22.168, and dzcomm version 099i. The correct OBD II cable/interface has an OBD II connector on one end and a USB connector on the other and can be bought online for a (very) nominal price. The open source software OBD II functionality includes:
- Auto detect of OBD protocol (no need to input car vehicle parameters to determine OBD protocol)
- Monitoring of over 70 common sensor parameters
- Read and clear stored Diagnostic Trouble Codes/ Malfunction Indicator Lamp (DTC/MIL)
This was done using Puppy Precise 5.5 (Ubuntu 12.04 LTS based), and would probably work for other Puppy versions as well. The method outlined here also provides an environment to build upon the basic functionality provided by the open source software, that is, additional functionality can be added as needed as all source code is present. Modifications have been implemented to dzcomm to allow use with USB, and Scantool to allow the use of clones, so be sure to use the files as attached; no change is needed for allegro. These changes have been documented on the web previously, and this post is essentially a condensation of those prior works, as related to Puppy Linux.
Everything is done as root for Puppy (by default). Of course for other Linux versions, this is not the case. If you make a mistake during compile and want to start over, use 'make clean'. Comments in parenthesis () are not part of command line.
Basically you will need to do the following:
- compile allegro library (the Ubuntu allegro libraries don't seem to work for Puppy Precise)
- get dzcomm and scantool sources, unzip, and replace modified files with the files from
attached ReplaceFiles.zip file
- compile dzcomm (which handles RS232 to USB conversion)
- compile Scantool121
- clean up any other issues like setting USB port to COM port
Perform all unzip/tar operations at a base directory, e.g. /root/, now referred to as ~ .
This means to place downloaded files at this base ~ directory for operation.
The exception to this is scantool, because the unzip does not generate a new directory.
1. Install devx.sfs package for Puppy (compiler), needs about 140M via Puppy Package Manager
2. tar and compile Allegro source:
Get Allegro source tar.gz from:
In shell console, at ~
tar -zxvf allegro-22.214.171.124.tar.gz
chmod +x fix.sh (change files to Linux compatible)
make (there will be warnings)
If you want to see if allegro works, run demo at ./demo/demo, hit ESC to end.
Note a sound initialization issue on the demo does not affect Scantool operation.
3. Unzip dzcomm and scantool sources:
Get dzcomm dz099i.zip here, place at base directory:
In shell console, at ~:
mkdir Scantool121 (scantool zip file does not create a new directory)
Get scantool scantool_net121src.zip source here, place in ~/Scantool121/
In shell console, at ~/Scantool121/:
4. Make ReplaceFiles.zip changes to dzcomm and scantool:
Copy attached ReplaceFiles.zip to ~, then in shell console:
unzip -uo ReplaceFiles.zip
This overwrites modified files in both dz0991 and Scantool121 directories with updated files.
Note for this to work, you must have the correct directory names as used here. The -u option
overwrites existing files, and the -o suppresses querying for each file.
An alternative would be to unzip the ReplaceFiles.zip file elsewhere and manually replace those files.
At this point you should have all (3) source directories, all with the correct files.
5. Compile dzcomm source:
In shell console, at ~
chmod +x fixunix.sh
make (there will be warnings here)
6. Compile Scantool121 source:
In shell console, at ~/Scantool121/:
chmod +x ScanTool (make executable)
This creates the output file wanted named ScanTool
7. Determine USB port and map to tty (this is to interface between the dzcomm software and USB):
Determine which port USB is coming in, in shell type ls /dev.
Plug in USB cable, wait 15 seconds, then type ls /dev again
You should see a new device similar to /dev/ttyUSB0
Map the USB port on the PC to a free serial port (e.g. tyyS5).
This can be done by adding 2 lines in /etc/rc.d/rc.local which will run during bootup:
ln -s /dev/ttyUSB0 /dev/ttyS5 (replace with correct USB port found above)
Note ttyS5 corresponds to COM6 on the Scantool GUI Interface Options screen.
Execute these lines as root on the command line if you do not plan to reboot now.
8. Check config of scantool.cfg file in Scantool directory, first lines should be similar to
version = 1.21
system_of_measurements = 1
display_mode = 1
baud_rate = 14
comport_number = 5 (corresponds to ttyS5, and COM6 on ScanTool GUI Interface)
Notes: measurements in US, display in non full windowed, factory default Baud rate is 38400.
Change comport number if not using ttyS5.
Appears ScanTool can only be run in non full windowed mode due to allegro.
9. You should now be able to execute ./ScanTool.
See running ScanTool notes at end for proper sequence.
The remaining steps create a pretty desktop icon.
Create bash shell st with the following:
Make st executable using chmod +x st.
Create desktop icon to run ScanTool via st script, use ~/Scantool121/scantool.ico for icon
This sequence seems to work the best and most consistently.
Turn car on to run position, but do not start car. (Start car if you want to view real time data)
Plug in OBD connector to car
Plug in USB to PC
Wait 5 seconds
execute ./ScanTool from Scantool121 directory, or use pretty Desktop Icon
It appears that some Sensor Data parameters can cause the ScanTool to lock up, perhaps these may be specific to a vehicle and not supported. Luckily, there is a "Reset Interface' button on the Sensor Data screen, be sure to click off the offending parameter first.
As ScanTool runs, it creates a log.txt file in the ScanTool directory, this can be used for troubleshooting.
The following URL contains ELM327 suppoprt documentation from ELM Electronics.
OBD-II Diagnostic Trouble Codes are 4-digit, preceded by a letter:
P for engine and transmission (powertrain),
B for body, C for chassis, and U for network.
||Unzip to replace dzcomm and scantool files with updates