├── COPYING ├── README.md ├── bg_black.jpg ├── cowfish.png ├── debian ├── changelog ├── compat ├── control ├── copyright ├── dirs ├── docs └── rules ├── debugEvent.py ├── doc ├── install.html ├── mac_super_screenshot.png ├── super_screenshot.bmp ├── super_screenshot.tiff └── x11_super_screenshot.png ├── frame_C1.jpg ├── frame_C2.jpg ├── frame_S1.jpg ├── frame_temp.psd ├── log └── LogHere.rtf ├── obd2_codes.py ├── obd_capture.py ├── obd_gui.py ├── obd_gui_square.py ├── obd_io.py ├── obd_recorder.py ├── obd_sensors.py ├── obd_utils.py ├── pyobd ├── pyobd.desktop └── pyobd.gif /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 309 | 310 | 311 | Also add information on how to contact you by electronic and paper mail. 312 | 313 | If the program is interactive, make it output a short notice like this 314 | when it starts in an interactive mode: 315 | 316 | Gnomovision version 69, Copyright (C) year name of author 317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 | This is free software, and you are welcome to redistribute it 319 | under certain conditions; type `show c' for details. 320 | 321 | The hypothetical commands `show w' and `show c' should show the appropriate 322 | parts of the General Public License. Of course, the commands you use may 323 | be called something other than `show w' and `show c'; they could even be 324 | mouse-clicks or menu items--whatever suits your program. 325 | 326 | You should also get your employer (if you work as a programmer) or your 327 | school, if any, to sign a "copyright disclaimer" for the program, if 328 | necessary. Here is a sample; alter the names: 329 | 330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 | 333 | , 1 April 1989 334 | Ty Coon, President of Vice 335 | 336 | This General Public License does not permit incorporating your program into 337 | proprietary programs. If your program is a subroutine library, you may 338 | consider it more useful to permit linking proprietary applications with the 339 | library. If this is what you want to do, use the GNU Library General 340 | Public License instead of this License. 341 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | pyobd 2 | ===== 3 | 4 |
OBD-PiTFT: Display Car Diagnostics (OBD-II) Data On Adafruit's PiTFT Touchscreen Display For Raspberry Pi 
 5 | 
 6 | In this tutorial you will learn how to connect your Raspberry Pi to a Bluetooth OBD-II adapter and display realtime engine data on Adafruit's PiTFT touchscreen display.
 7 | 
 8 | Hardware Required:
 9 | 1. Raspberry Pi
10 | 2. Adafruit PiTFT Touchscreen Display
11 | 3. Plugable USB Bluetooth 4.0 Low Energy Micro Adapter 
12 | 4. 2A Car Supply / Switch or Micro USB Car Charger
13 | 5. ELM327 Bluetooth Adapter or ELM327 USB Cable
14 | 6. Sweetbox Raspberry Pi Case (*optional)
15 | 7. Car Mount Holder (*optional)
16 | 8. Keyboard (*optional)
17 | 
18 | What is OBD-II?
19 | OBD stands for On-Board Diagnostics, and this standard connector has been mandated in the US since 1996. Now you can think of OBD-II as an on-board computer system that is responsible for monitoring your vehicle’s engine, transmission, and emissions control components. 
20 | 
21 | Vehicles that comply with the OBD-II standards will have a data connector within about 2 feet of the steering wheel. The OBD connector is officially called a SAE J1962 Diagnostic Connector, but is also known by DLC, OBD Port, or OBD connector. It has positions for 16 pins.
22 | 
23 | pyOBD?
24 | pyOBD (aka pyOBD-II or pyOBD2) is an open source OBD-II (SAE-J1979) compliant scantool software written entirely in Python. It is designed to interface with low-cost ELM 32x OBD-II diagnostic interfaces such as ELM-USB. It will basically allow you to talk to your car's ECU, display fault codes, display measured values, read status tests, etc.
25 | 
26 | I took a fork of pyOBD’s software from their GitHub repository, https://github.com/peterh/pyobd, and used this as the basis for my program.
27 | 
28 | The program will connect through the OBD-II interface, display the gauges available dependent on the particular vehicle and display realtime engine data on Adafruit's PiTFT touchscreen display in an interactive GUI.
29 | 
30 | Software Installation
31 | In order to add support for the 2.8" TFT and touchscreen, we'll need to install a new Linux Kernel. Head over to Adafruit and follow their Software Installation, then come on back!
32 | 
33 | We'll be doing this from a console cable connection, but you can just as easily do it from the direct HDMI/TV console or by SSH'ing in. Whatever gets you to a shell will work!
34 | 
35 | Note: For the following command line instructions, do not type the '#', that is only to indicate that it is a command to enter. 
36 | 
37 | Before proceeding, run:
38 | #  sudo apt-get update
39 | #  sudo apt-get upgrade
40 | #  sudo apt-get autoremove
41 | #  sudo reboot
42 | 
43 | Install these components using the command:
44 | #  sudo apt-get install python-serial
45 | #  sudo apt-get install bluetooth bluez-utils blueman
46 | #  sudo apt-get install python-wxgtk2.8 python-wxtools wx2.8-i18n libwxgtk2.8-dev
47 | #  sudo apt-get install git-core
48 | #  sudo reboot 
49 | 
50 | Next, download the OBD-Pi Software direct from GitHub.
51 | (https://github.com/sakurusurya2000/pyobd.git)
52 | 
53 | Or using the command:
54 | #  cd ~
55 | #  git clone https://github.com/sakurusurya2000/pyobd.git
56 | 
57 | Vehicle Installation
58 | The vehicle installation is quite simple.
59 | 
60 | 1. Insert the USB Bluetooth dongle into the Raspberry Pi along with the SD card.
61 | 
62 | 2. Connect your PiTFT display to the Raspberry Pi.
63 | 
64 | 3. Insert the OBD-II Bluetooth adapter into the SAE J196216 (OBD Port) connector.
65 | 
66 | 4. Install your 2A Car Supply / Switch or Micro USB Car Charger.
67 | 
68 | 5. Finally, turn your key to the ON position.
69 | 
70 | 6. Enter your login credentials and run:
71 | #  startx
72 | 
73 | 7. Launch BlueZ, the Bluetooth stack for Linux. Pair + Trust your ELM327 Bluetooth Adapter and Connect To: SPP Dev. You should see the Notification "Serial port connected to /dev/rfcomm0"
74 | 
75 | Note: Click the Bluetooth icon, bottom right (Desktop) to configure your device. Right click on your Bluetooth device to bring up Connect To: SPP Dev.
76 | 
77 | 8. Open up Terminal and run:
78 | #  cd pyobd
79 | #  sudo su
80 | #  python obd_gui.py
81 | 
82 | Note: Run, # python obd_gui_square.py to use the rounded rectangle gauge.
83 | To exit the program just press Control and C or Alt and Esc.
84 | Tap the display to cycle through the gauges!
85 | 
86 | 9. To record the data sensed from the sensors:
87 | #  cd pyobd
88 | #  python obd_recorder.py
89 | 
90 | Enjoy and drive safe!
91 | -------------------------------------------------------------------------------- /bg_black.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakurusurya2000/pyobd/6736694989576e771fd68f534538430467d30517/bg_black.jpg -------------------------------------------------------------------------------- /cowfish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakurusurya2000/pyobd/6736694989576e771fd68f534538430467d30517/cowfish.png -------------------------------------------------------------------------------- /debian/changelog: -------------------------------------------------------------------------------- 1 | pyobd (0.9.2-2) unstable; urgency=low 2 | 3 | * Initial release (Closes: #nnnn) 4 | 5 | -- SeCons Ltd. www.obdtester.com Fri, 11 Sep 2009 15:24:35 +0200 6 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 7 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: pyobd 2 | Section:utils 3 | Priority: optional 4 | Maintainer: SeCons Ltd. 5 | Build-Depends: debhelper (>= 7) 6 | Standards-Version: 3.8.0 7 | Homepage: 8 | 9 | Package: pyobd 10 | Architecture: any 11 | Depends: python,python-serial,python-wxgtk2.6 12 | Description:pyOBD is an OBD-II (SAE-J1979) compliant scantool software written entirely in Python. It is meant to interface with the low cost ELM 32x devices such as ELM-USB. 13 | pyOBD was written by Donour Sizemore, now maintained and improved by SECONS Ltd.i and it is Free Software and is distributed under the terms of the GPL. For Python devlopers, pyOBD provides a single module, obd_io, that allows high level control over sensor data and diagnostic trouble code managment. The entire package has been tested to work on both Mac OSX 10.3 (panther) and Gentoo Linux. Generally speaking, any Posix-type system meeting the requirements below will be supported. In theory, Windows is also supported but has not been tested. 14 | -------------------------------------------------------------------------------- /debian/copyright: -------------------------------------------------------------------------------- 1 | This package was debianized by: 2 | 3 | SeCons Ltd. on Fri, 11 Sep 2009 15:24:35 +0200 4 | 5 | It was downloaded from: 6 | 7 | 8 | 9 | Upstream Author(s): 10 | 11 | SeCons Ltd. 12 | 13 | Copyright: 14 | 15 | Copyright 2004 Donour Sizemore (donour@uchicago.edu) 16 | Copyright 2009 Secons Ltd. (www.obdtester.com) 17 | 18 | License: 19 | 20 | pyOBD package is free software; you can redistribute it and/or modify 21 | it under the terms of the GNU General Public License as published by 22 | the Free Software Foundation; either version 2 of the License, or 23 | (at your option) any later version. 24 | 25 | pyOBD package is distributed in the hope that it will be useful, 26 | but WITHOUT ANY WARRANTY; without even the implied warranty of 27 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28 | GNU General Public License for more details. 29 | 30 | You should have received a copy of the GNU General Public License 31 | along with this package; if not, write to the Free Software 32 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 33 | 34 | On Debian systems, the complete text of the GNU General 35 | Public License can be found in `/usr/share/common-licenses/GPL'. 36 | 37 | The Debian packaging is: 38 | 39 | Copyright C) 2009, SeCons Ltd. 40 | 41 | and is licensed under the GPL, see above. 42 | 43 | 44 | # Please also look if there are files or directories which have a 45 | # different copyright/license attached and list them here. 46 | -------------------------------------------------------------------------------- /debian/dirs: -------------------------------------------------------------------------------- 1 | usr/bin/ 2 | usr/share/applications 3 | usr/share/pyobd 4 | -------------------------------------------------------------------------------- /debian/docs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakurusurya2000/pyobd/6736694989576e771fd68f534538430467d30517/debian/docs -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | # Sample debian/rules that uses debhelper. 4 | # This file was originally written by Joey Hess and Craig Small. 5 | # As a special exception, when this file is copied by dh-make into a 6 | # dh-make output file, you may use that output file without restriction. 7 | # This special exception was added by Craig Small in version 0.37 of dh-make. 8 | 9 | # Uncomment this to turn on verbose mode. 10 | #export DH_VERBOSE=1 11 | 12 | 13 | 14 | 15 | 16 | configure: configure-stamp 17 | 18 | configure-stamp: 19 | dh_testdir 20 | # Add here commands to configure the package. 21 | 22 | touch configure-stamp 23 | 24 | 25 | build: build-stamp 26 | 27 | build-stamp: configure-stamp 28 | dh_testdir 29 | touch build-stamp 30 | 31 | clean: 32 | dh_testdir 33 | dh_testroot 34 | rm -f build-stamp configure-stamp 35 | dh_clean 36 | 37 | install: build 38 | dh_testdir 39 | dh_testroot 40 | dh_prep 41 | dh_installdirs 42 | 43 | #Create temp dir 44 | mkdir -p $(CURDIR)/debian/pyobd 45 | 46 | #Install program files 47 | 48 | cp debugEvent.py $(CURDIR)/debian/pyobd/usr/share/pyobd/debugEvent.py 49 | cp obd_io.py $(CURDIR)/debian/pyobd/usr/share/pyobd/obd_io.py 50 | cp obd_sensors.py $(CURDIR)/debian/pyobd/usr/share/pyobd/obd_sensors.py 51 | cp obd2_codes.py $(CURDIR)/debian/pyobd/usr/share/pyobd/obd2_codes.py 52 | cp pyobd $(CURDIR)/debian/pyobd/usr/share/pyobd/pyobd 53 | cp pyobd.gif $(CURDIR)/debian/pyobd/usr/share/pyobd/pyobd.gif 54 | 55 | #Install menufile 56 | cp pyobd.desktop $(CURDIR)/debian/pyobd/usr/share/applications/pyobd.desktop 57 | cp -d pyobdlink $(CURDIR)/debian/pyobd/usr/bin/pyobd 58 | 59 | #TODO:Install man files 60 | 61 | # Build architecture-independent files here. 62 | binary-indep: install 63 | # We have nothing to do by default. 64 | 65 | # Build architecture-dependent files here. 66 | binary-arch: install 67 | dh_testdir 68 | dh_testroot 69 | dh_installchangelogs 70 | dh_installdocs 71 | dh_installexamples 72 | # dh_install 73 | # dh_installmenu 74 | # dh_installdebconf 75 | # dh_installlogrotate 76 | # dh_installemacsen 77 | # dh_installpam 78 | # dh_installmime 79 | # dh_python 80 | # dh_installinit 81 | # dh_installcron 82 | # dh_installinfo 83 | dh_installman 84 | dh_link 85 | dh_strip 86 | dh_compress 87 | dh_fixperms 88 | # dh_perl 89 | # dh_makeshlibs 90 | dh_installdeb 91 | dh_shlibdeps 92 | dh_gencontrol 93 | dh_md5sums 94 | dh_builddeb 95 | 96 | binary: binary-indep binary-arch 97 | .PHONY: build clean binary-indep binary-arch binary install configure 98 | -------------------------------------------------------------------------------- /debugEvent.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ########################################################################### 3 | # obd_sensors.py 4 | # 5 | # Copyright 2004 Donour Sizemore (donour@uchicago.edu) 6 | # Copyright 2009 Secons Ltd. (www.obdtester.com) 7 | # 8 | # This file is part of pyOBD. 9 | # 10 | # pyOBD is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 2 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # pyOBD is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with pyOBD; if not, write to the Free Software 22 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | ########################################################################### 24 | try: 25 | import wx 26 | 27 | EVT_DEBUG_ID = 1010 28 | 29 | def debug_display(window, position, message): 30 | if window is None: 31 | print message 32 | else: 33 | wx.PostEvent(window, DebugEvent([position, message])) 34 | 35 | class DebugEvent(wx.PyEvent): 36 | """Simple event to carry arbitrary result data.""" 37 | def __init__(self, data): 38 | """Init Result Event.""" 39 | wx.PyEvent.__init__(self) 40 | self.SetEventType(EVT_DEBUG_ID) 41 | self.data = data 42 | except ImportError as e: 43 | def debug_display(window, position, message): 44 | print message 45 | 46 | -------------------------------------------------------------------------------- /doc/install.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |

Installation Instructions

8 | 9 |

Prerequisites:

10 | 11 | First, install these and make sure they work. 12 | 13 |

Python:

14 | 15 | A recent release is needed. Developement took place using the 2.3.x 16 | release series. Any 2.X release should work, but hasn't been 17 | tested. Under MacOSX 10.3 (panther), Python is installed by 18 | default. Installation instructions are available at the python 19 | website: www.python.org 20 | 21 |

PySerial

22 | 23 | This is needed to communicate with the serial port. It is available 24 | from sourceforge: http://pyserial.sourceforge.net/. Download 26 | and install it. Use version 2.0. 27 | 28 |

WxPython (optional):

29 | 30 | WxPython is needed if you want to use the pretty graphical interface 31 | to sensor data and DTC management. It's available at www.wxpython.org. Version 33 | 2.4 is required. pyOBD will not work with the 2.5 34 | release series. 35 | 36 |

Ncurses (optional):

37 | 38 | In addition to wxpython, there is a text/ncurses interface. To use 39 | it, enable the ncurses module when you build python. It isn't very 40 | polished and use is not recommended. 41 | 42 | 43 |

Installation:

44 | 45 | After those requirements, installation is a snap. Simply download the 46 | release tarball and uncompress it. To "install" pyOBD on the system, simply copy 47 | the release directory to wherever you want (i.e. /opt, /usr/local). 48 | 49 | To use the wx interface run python wxgui.py. If you're using 50 | MacOSX, substitute "pythonw" for "python". 51 | 52 |
53 | -- Donour Sizemore 54 | 55 | 56 | -------------------------------------------------------------------------------- /doc/mac_super_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakurusurya2000/pyobd/6736694989576e771fd68f534538430467d30517/doc/mac_super_screenshot.png -------------------------------------------------------------------------------- /doc/super_screenshot.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakurusurya2000/pyobd/6736694989576e771fd68f534538430467d30517/doc/super_screenshot.bmp -------------------------------------------------------------------------------- /doc/super_screenshot.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakurusurya2000/pyobd/6736694989576e771fd68f534538430467d30517/doc/super_screenshot.tiff -------------------------------------------------------------------------------- /doc/x11_super_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakurusurya2000/pyobd/6736694989576e771fd68f534538430467d30517/doc/x11_super_screenshot.png -------------------------------------------------------------------------------- /frame_C1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakurusurya2000/pyobd/6736694989576e771fd68f534538430467d30517/frame_C1.jpg -------------------------------------------------------------------------------- /frame_C2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakurusurya2000/pyobd/6736694989576e771fd68f534538430467d30517/frame_C2.jpg -------------------------------------------------------------------------------- /frame_S1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakurusurya2000/pyobd/6736694989576e771fd68f534538430467d30517/frame_S1.jpg -------------------------------------------------------------------------------- /frame_temp.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakurusurya2000/pyobd/6736694989576e771fd68f534538430467d30517/frame_temp.psd -------------------------------------------------------------------------------- /log/LogHere.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\cocoartf1265\cocoasubrtf210 2 | {\fonttbl\f0\fswiss\fcharset0 Helvetica;} 3 | {\colortbl;\red255\green255\blue255;} 4 | \margl1440\margr1440\vieww10800\viewh8400\viewkind0 5 | \pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural 6 | 7 | \f0\fs24 \cf0 Log Data.} -------------------------------------------------------------------------------- /obd_capture.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import obd_io 4 | import serial 5 | import platform 6 | import obd_sensors 7 | from datetime import datetime 8 | import time 9 | 10 | from obd_utils import scanSerial 11 | 12 | class OBD_Capture(): 13 | def __init__(self): 14 | self.supportedSensorList = [] 15 | self.port = None 16 | localtime = time.localtime(time.time()) 17 | 18 | def connect(self): 19 | portnames = scanSerial() 20 | print portnames 21 | for port in portnames: 22 | self.port = obd_io.OBDPort(port, None, 2, 2) 23 | if(self.port.State == 0): 24 | self.port.close() 25 | self.port = None 26 | else: 27 | break 28 | 29 | if(self.port): 30 | print "Connected to "+self.port.port.name 31 | 32 | def is_connected(self): 33 | return self.port 34 | 35 | def getSupportedSensorList(self): 36 | return self.supportedSensorList 37 | 38 | def capture_data(self): 39 | 40 | text = "" 41 | #Find supported sensors - by getting PIDs from OBD 42 | # its a string of binary 01010101010101 43 | # 1 means the sensor is supported 44 | self.supp = self.port.sensor(0)[1] 45 | self.supportedSensorList = [] 46 | self.unsupportedSensorList = [] 47 | 48 | # loop through PIDs binary 49 | for i in range(0, len(self.supp)): 50 | if self.supp[i] == "1": 51 | # store index of sensor and sensor object 52 | self.supportedSensorList.append([i+1, obd_sensors.SENSORS[i+1]]) 53 | else: 54 | self.unsupportedSensorList.append([i+1, obd_sensors.SENSORS[i+1]]) 55 | 56 | for supportedSensor in self.supportedSensorList: 57 | text += "supported sensor index = " + str(supportedSensor[0]) + " " + str(supportedSensor[1].shortname) + "\n" 58 | 59 | time.sleep(3) 60 | 61 | if(self.port is None): 62 | return None 63 | 64 | #Loop until Ctrl C is pressed 65 | localtime = datetime.now() 66 | current_time = str(localtime.hour)+":"+str(localtime.minute)+":"+str(localtime.second)+"."+str(localtime.microsecond) 67 | #log_string = current_time + "\n" 68 | text = current_time + "\n" 69 | results = {} 70 | for supportedSensor in self.supportedSensorList: 71 | sensorIndex = supportedSensor[0] 72 | (name, value, unit) = self.port.sensor(sensorIndex) 73 | text += name + " = " + str(value) + " " + str(unit) + "\n" 74 | 75 | return text 76 | 77 | if __name__ == "__main__": 78 | 79 | o = OBD_Capture() 80 | o.connect() 81 | time.sleep(3) 82 | if not o.is_connected(): 83 | print "Not connected" 84 | else: 85 | o.capture_data() 86 | -------------------------------------------------------------------------------- /obd_gui.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ########################################################################### 3 | # obd_gui.py 4 | # 5 | # Created by Paul Bartek (pbartek@cowfishstudios.com) 6 | # 7 | ########################################################################### 8 | #------------------------------------------------------------------------------- 9 | 10 | import os 11 | import wx 12 | import time 13 | from threading import Thread 14 | 15 | from obd_capture import OBD_Capture 16 | from obd_sensors import SENSORS 17 | from obd_sensors import * 18 | 19 | #------------------------------------------------------------------------------- 20 | 21 | # OBD variable 22 | BACKGROUND_FILENAME = "bg_black.jpg" 23 | GAUGE_FILENAME = "frame_C1.jpg" 24 | LOGO_FILENAME = "cowfish.png" 25 | 26 | #------------------------------------------------------------------------------- 27 | 28 | def obd_connect(o): 29 | o.connect() 30 | 31 | class OBDConnection(object): 32 | """ 33 | Class for OBD connection. Use a thread for connection. 34 | """ 35 | 36 | def __init__(self): 37 | self.c = OBD_Capture() 38 | 39 | def get_capture(self): 40 | return self.c 41 | 42 | def connect(self): 43 | self.t = Thread(target=obd_connect, args=(self.c,)) 44 | self.t.start() 45 | 46 | def is_connected(self): 47 | return self.c.is_connected() 48 | 49 | def get_output(self): 50 | if self.c and self.c.is_connected(): 51 | return self.c.capture_data() 52 | return "" 53 | 54 | def get_port(self): 55 | return self.c.is_connected() 56 | 57 | def get_port_name(self): 58 | if self.c: 59 | port = self.c.is_connected() 60 | if port: 61 | try: 62 | return port.port.name 63 | except: 64 | pass 65 | return None 66 | 67 | def get_sensors(self): 68 | sensors = [] 69 | if self.c: 70 | sensors = self.c.getSupportedSensorList() 71 | return sensors 72 | 73 | #------------------------------------------------------------------------------- 74 | 75 | class OBDText(wx.TextCtrl): 76 | """ 77 | Text display while loading OBD application. 78 | """ 79 | 80 | def __init__(self, parent): 81 | """ 82 | Constructor. 83 | """ 84 | style = wx.TE_READONLY | wx.TE_MULTILINE 85 | wx.TextCtrl.__init__(self, parent, style=style) 86 | 87 | self.SetBackgroundColour('#21211f') 88 | self.SetForegroundColour(wx.WHITE) 89 | 90 | font = wx.Font(12, wx.ROMAN, wx.NORMAL, wx.NORMAL, faceName="Monaco") 91 | self.SetFont(font) 92 | 93 | def AddText(self, text): 94 | self.AppendText(text) 95 | 96 | #------------------------------------------------------------------------------- 97 | 98 | class OBDStaticBox(wx.StaticBox): 99 | """ 100 | OBD StaticBox. 101 | """ 102 | 103 | def __init__(self, *args, **kwargs): 104 | """ 105 | Constructor. 106 | """ 107 | wx.StaticBox.__init__(self, *args, **kwargs) 108 | 109 | def OnPaint(self, event): 110 | self.Paint(wx.PaintDC(self)) 111 | 112 | def Paint(self, dc): 113 | dc.DrawBitmap(self.bitmap, 0, 0) 114 | 115 | #------------------------------------------------------------------------------- 116 | 117 | class OBDPanelGauges(wx.Panel): 118 | """ 119 | Panel for gauges. 120 | """ 121 | 122 | def __init__(self, *args, **kwargs): 123 | """ 124 | Constructor. 125 | """ 126 | super(OBDPanelGauges, self).__init__(*args, **kwargs) 127 | 128 | # Background image 129 | image = wx.Image(GAUGE_FILENAME) 130 | width, height = wx.GetDisplaySize() 131 | image = image.Scale(width, height, wx.IMAGE_QUALITY_HIGH) 132 | self.bitmap = wx.BitmapFromImage(image) 133 | self.Bind(wx.EVT_PAINT, self.OnPaint) 134 | 135 | # Create an accelerator table 136 | lid = wx.NewId() 137 | cid = wx.NewId() 138 | rid = wx.NewId() 139 | self.Bind(wx.EVT_MENU, self.onCtrlC, id=cid) 140 | self.Bind(wx.EVT_MENU, self.onLeft, id=lid) 141 | self.Bind(wx.EVT_MENU, self.onRight, id=rid) 142 | self.accel_tbl = wx.AcceleratorTable([ 143 | (wx.ACCEL_CTRL, ord('C'), cid), 144 | (wx.ACCEL_NORMAL, wx.WXK_LEFT, lid), 145 | (wx.ACCEL_NORMAL, wx.WXK_RIGHT, rid), 146 | ]) 147 | self.SetAcceleratorTable(self.accel_tbl) 148 | 149 | # Handle events for mouse clicks 150 | self.Bind(wx.EVT_LEFT_DOWN, self.onLeft) 151 | self.Bind(wx.EVT_RIGHT_DOWN, self.onRight) 152 | 153 | # Connection 154 | self.connection = None 155 | 156 | # Sensors 157 | self.istart = 0 158 | self.sensors = [] 159 | 160 | # Port 161 | self.port = None 162 | 163 | # List to hold children widgets 164 | self.boxes = [] 165 | self.texts = [] 166 | 167 | 168 | def setConnection(self, connection): 169 | self.connection = connection 170 | 171 | def setSensors(self, sensors): 172 | self.sensors = sensors 173 | 174 | def setPort(self, port): 175 | self.port = port 176 | 177 | def getSensorsToDisplay(self, istart): 178 | """ 179 | Get at most 1 sensor to be displayed on screen. 180 | """ 181 | sensors_display = [] 182 | if istart> 2 52 | if tc == 0: 53 | type = "P" 54 | elif tc == 1: 55 | type = "C" 56 | elif tc == 2: 57 | type = "B" 58 | elif tc == 3: 59 | type = "U" 60 | else: 61 | raise tc 62 | 63 | dig1 = str(obd_sensors.hex_to_int(current[0]) & 3) 64 | dig2 = str(obd_sensors.hex_to_int(current[1])) 65 | dig3 = str(obd_sensors.hex_to_int(current[2])) 66 | dig4 = str(obd_sensors.hex_to_int(current[3])) 67 | dtc.append(type+dig1+dig2+dig3+dig4) 68 | current = current[4:] 69 | return dtc 70 | #__________________________________________________________________________ 71 | 72 | class OBDPort: 73 | """ OBDPort abstracts all communication with OBD-II device.""" 74 | def __init__(self,portnum,_notify_window,SERTIMEOUT,RECONNATTEMPTS): 75 | """Initializes port by resetting device and gettings supported PIDs. """ 76 | # These should really be set by the user. 77 | baud = 38400 78 | databits = 8 79 | par = serial.PARITY_NONE # parity 80 | sb = 1 # stop bits 81 | to = SERTIMEOUT 82 | self.ELMver = "Unknown" 83 | self.State = 1 #state SERIAL is 1 connected, 0 disconnected (connection failed) 84 | self.port = None 85 | 86 | self._notify_window=_notify_window 87 | debug_display(self._notify_window, 1, "Opening interface (serial port)") 88 | 89 | try: 90 | self.port = serial.Serial(portnum,baud, \ 91 | parity = par, stopbits = sb, bytesize = databits,timeout = to) 92 | 93 | except serial.SerialException as e: 94 | print e 95 | self.State = 0 96 | return None 97 | 98 | debug_display(self._notify_window, 1, "Interface successfully " + self.port.portstr + " opened") 99 | debug_display(self._notify_window, 1, "Connecting to ECU...") 100 | 101 | try: 102 | self.send_command("atz") # initialize 103 | time.sleep(1) 104 | except serial.SerialException: 105 | self.State = 0 106 | return None 107 | 108 | self.ELMver = self.get_result() 109 | if(self.ELMver is None): 110 | self.State = 0 111 | return None 112 | 113 | debug_display(self._notify_window, 2, "atz response:" + self.ELMver) 114 | self.send_command("ate0") # echo off 115 | debug_display(self._notify_window, 2, "ate0 response:" + self.get_result()) 116 | self.send_command("0100") 117 | ready = self.get_result() 118 | 119 | if(ready is None): 120 | self.State = 0 121 | return None 122 | 123 | debug_display(self._notify_window, 2, "0100 response:" + ready) 124 | return None 125 | 126 | def close(self): 127 | """ Resets device and closes all associated filehandles""" 128 | 129 | if (self.port!= None) and self.State==1: 130 | self.send_command("atz") 131 | self.port.close() 132 | 133 | self.port = None 134 | self.ELMver = "Unknown" 135 | 136 | def send_command(self, cmd): 137 | """Internal use only: not a public interface""" 138 | if self.port: 139 | self.port.flushOutput() 140 | self.port.flushInput() 141 | for c in cmd: 142 | self.port.write(c) 143 | self.port.write("\r\n") 144 | #debug_display(self._notify_window, 3, "Send command:" + cmd) 145 | 146 | def interpret_result(self,code): 147 | """Internal use only: not a public interface""" 148 | # Code will be the string returned from the device. 149 | # It should look something like this: 150 | # '41 11 0 0\r\r' 151 | 152 | # 9 seems to be the length of the shortest valid response 153 | if len(code) < 7: 154 | #raise Exception("BogusCode") 155 | print "boguscode?"+code 156 | 157 | # get the first thing returned, echo should be off 158 | code = string.split(code, "\r") 159 | code = code[0] 160 | 161 | #remove whitespace 162 | code = string.split(code) 163 | code = string.join(code, "") 164 | 165 | #cables can behave differently 166 | if code[:6] == "NODATA": # there is no such sensor 167 | return "NODATA" 168 | 169 | # first 4 characters are code from ELM 170 | code = code[4:] 171 | return code 172 | 173 | def get_result(self): 174 | """Internal use only: not a public interface""" 175 | #time.sleep(0.01) 176 | repeat_count = 0 177 | if self.port is not None: 178 | buffer = "" 179 | while 1: 180 | c = self.port.read(1) 181 | if len(c) == 0: 182 | if(repeat_count == 5): 183 | break 184 | print "Got nothing\n" 185 | repeat_count = repeat_count + 1 186 | continue 187 | 188 | if c == '\r': 189 | continue 190 | 191 | if c == ">": 192 | break; 193 | 194 | if buffer != "" or c != ">": #if something is in buffer, add everything 195 | buffer = buffer + c 196 | 197 | #debug_display(self._notify_window, 3, "Get result:" + buffer) 198 | if(buffer == ""): 199 | return None 200 | return buffer 201 | else: 202 | debug_display(self._notify_window, 3, "NO self.port!") 203 | return None 204 | 205 | # get sensor value from command 206 | def get_sensor_value(self,sensor): 207 | """Internal use only: not a public interface""" 208 | cmd = sensor.cmd 209 | self.send_command(cmd) 210 | data = self.get_result() 211 | 212 | if data: 213 | data = self.interpret_result(data) 214 | if data != "NODATA": 215 | data = sensor.value(data) 216 | else: 217 | return "NORESPONSE" 218 | 219 | return data 220 | 221 | # return string of sensor name and value from sensor index 222 | def sensor(self , sensor_index): 223 | """Returns 3-tuple of given sensors. 3-tuple consists of 224 | (Sensor Name (string), Sensor Value (string), Sensor Unit (string) ) """ 225 | sensor = obd_sensors.SENSORS[sensor_index] 226 | r = self.get_sensor_value(sensor) 227 | return (sensor.name,r, sensor.unit) 228 | 229 | def sensor_names(self): 230 | """Internal use only: not a public interface""" 231 | names = [] 232 | for s in obd_sensors.SENSORS: 233 | names.append(s.name) 234 | return names 235 | 236 | def get_tests_MIL(self): 237 | statusText=["Unsupported","Supported - Completed","Unsupported","Supported - Incompleted"] 238 | 239 | statusRes = self.sensor(1)[1] #GET values 240 | statusTrans = [] #translate values to text 241 | 242 | statusTrans.append(str(statusRes[0])) #DTCs 243 | 244 | if statusRes[1]==0: #MIL 245 | statusTrans.append("Off") 246 | else: 247 | statusTrans.append("On") 248 | 249 | for i in range(2,len(statusRes)): #Tests 250 | statusTrans.append(statusText[statusRes[i]]) 251 | 252 | return statusTrans 253 | 254 | # 255 | # fixme: j1979 specifies that the program should poll until the number 256 | # of returned DTCs matches the number indicated by a call to PID 01 257 | # 258 | def get_dtc(self): 259 | """Returns a list of all pending DTC codes. Each element consists of 260 | a 2-tuple: (DTC code (string), Code description (string) )""" 261 | dtcLetters = ["P", "C", "B", "U"] 262 | r = self.sensor(1)[1] #data 263 | dtcNumber = r[0] 264 | mil = r[1] 265 | DTCCodes = [] 266 | 267 | 268 | print "Number of stored DTC:" + str(dtcNumber) + " MIL: " + str(mil) 269 | # get all DTC, 3 per mesg response 270 | for i in range(0, ((dtcNumber+2)/3)): 271 | self.send_command(GET_DTC_COMMAND) 272 | res = self.get_result() 273 | print "DTC result:" + res 274 | for i in range(0, 3): 275 | val1 = hex_to_int(res[3+i*6:5+i*6]) 276 | val2 = hex_to_int(res[6+i*6:8+i*6]) #get DTC codes from response (3 DTC each 2 bytes) 277 | val = (val1<<8)+val2 #DTC val as int 278 | 279 | if val==0: #skip fill of last packet 280 | break 281 | 282 | DTCStr=dtcLetters[(val&0xC000)>14]+str((val&0x3000)>>12)+str((val&0x0f00)>>8)+str((val&0x00f0)>>4)+str(val&0x000f) 283 | 284 | DTCCodes.append(["Active",DTCStr]) 285 | 286 | #read mode 7 287 | self.send_command(GET_FREEZE_DTC_COMMAND) 288 | res = self.get_result() 289 | 290 | if res[:7] == "NODATA": #no freeze frame 291 | return DTCCodes 292 | 293 | print "DTC freeze result:" + res 294 | for i in range(0, 3): 295 | val1 = hex_to_int(res[3+i*6:5+i*6]) 296 | val2 = hex_to_int(res[6+i*6:8+i*6]) #get DTC codes from response (3 DTC each 2 bytes) 297 | val = (val1<<8)+val2 #DTC val as int 298 | 299 | if val==0: #skip fill of last packet 300 | break 301 | 302 | DTCStr=dtcLetters[(val&0xC000)>14]+str((val&0x3000)>>12)+str((val&0x0f00)>>8)+str((val&0x00f0)>>4)+str(val&0x000f) 303 | DTCCodes.append(["Passive",DTCStr]) 304 | 305 | return DTCCodes 306 | 307 | def clear_dtc(self): 308 | """Clears all DTCs and freeze frame data""" 309 | self.send_command(CLEAR_DTC_COMMAND) 310 | r = self.get_result() 311 | return r 312 | 313 | def log(self, sensor_index, filename): 314 | file = open(filename, "w") 315 | start_time = time.time() 316 | if file: 317 | data = self.sensor(sensor_index) 318 | file.write("%s \t%s(%s)\n" % \ 319 | ("Time", string.strip(data[0]), data[2])) 320 | while 1: 321 | now = time.time() 322 | data = self.sensor(sensor_index) 323 | line = "%.6f,\t%s\n" % (now - start_time, data[1]) 324 | file.write(line) 325 | file.flush() 326 | 327 | -------------------------------------------------------------------------------- /obd_recorder.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import obd_io 4 | import serial 5 | import platform 6 | import obd_sensors 7 | from datetime import datetime 8 | import time 9 | import getpass 10 | 11 | 12 | from obd_utils import scanSerial 13 | 14 | class OBD_Recorder(): 15 | def __init__(self, path, log_items): 16 | self.port = None 17 | self.sensorlist = [] 18 | localtime = time.localtime(time.time()) 19 | filename = path+"car-"+str(localtime[0])+"-"+str(localtime[1])+"-"+str(localtime[2])+".log" 20 | self.log_file = open(filename, "w", 128) 21 | self.log_file.write("Time,RPM,MPH,Throttle,Load,Fuel Status,Risk Score\n"); 22 | 23 | for item in log_items: 24 | self.add_log_item(item) 25 | 26 | self.gear_ratios = [34/13, 39/21, 36/23, 27/20, 26/21, 25/22] 27 | #log_formatter = logging.Formatter('%(asctime)s.%(msecs).03d,%(message)s', "%H:%M:%S") 28 | 29 | def connect(self): 30 | portnames = scanSerial() 31 | #portnames = ['COM10'] 32 | print portnames 33 | for port in portnames: 34 | self.port = obd_io.OBDPort(port, None, 2, 2) 35 | if(self.port.State == 0): 36 | self.port.close() 37 | self.port = None 38 | else: 39 | break 40 | 41 | if(self.port): 42 | print "Connected to "+self.port.port.name 43 | 44 | def is_connected(self): 45 | return self.port 46 | 47 | def add_log_item(self, item): 48 | for index, e in enumerate(obd_sensors.SENSORS): 49 | if(item == e.shortname): 50 | self.sensorlist.append(index) 51 | print "Logging item: "+e.name 52 | break 53 | 54 | 55 | def record_data(self): 56 | if(self.port is None): 57 | return None 58 | 59 | print "Logging started" 60 | 61 | while 1: 62 | localtime = datetime.now() 63 | current_time = str(localtime.hour)+":"+str(localtime.minute)+":"+str(localtime.second)+"."+str(localtime.microsecond) 64 | log_string = current_time 65 | results = {} 66 | for index in self.sensorlist: 67 | (name, value, unit) = self.port.sensor(index) 68 | log_string = log_string + ","+str(value) 69 | results[obd_sensors.SENSORS[index].shortname] = value; 70 | 71 | gear = self.calculate_gear(results["rpm"], results["speed"]) 72 | log_string = log_string #+ "," + str(gear) 73 | self.log_file.write(log_string+"\n") 74 | 75 | 76 | def calculate_gear(self, rpm, speed): 77 | if speed == "" or speed == 0: 78 | return 0 79 | if rpm == "" or rpm == 0: 80 | return 0 81 | 82 | rps = rpm/60 83 | mps = (speed*1.609*1000)/3600 84 | 85 | int overspeeding=0; 86 | if speed>=60: 87 | overspeeding+=overspeeding; 88 | int braking=0; 89 | int acc=0; 90 | int risk_score= ((3*overspeeding)+(2*(braking+accelaration)) / ); 91 | primary_gear = 85/46 #street triple 92 | final_drive = 47/16 93 | 94 | tyre_circumference = 1.978 #meters 95 | 96 | current_gear_ratio = (rps*tyre_circumference)/(mps*primary_gear*final_drive) 97 | 98 | #print current_gear_ratio 99 | gear = min((abs(current_gear_ratio - i), i) for i in self.gear_ratios)[1] 100 | return gear 101 | 102 | username = getpass.getuser() 103 | logitems = ["rpm", "speed", "throttle_pos", "load", "fuel_status","risk_score"] 104 | o = OBD_Recorder('/home/'+username+'/pyobd/log/', logitems) 105 | o.connect() 106 | 107 | if not o.is_connected(): 108 | print "Not connected" 109 | o.record_data() 110 | -------------------------------------------------------------------------------- /obd_sensors.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ########################################################################### 3 | # obd_sensors.py 4 | # 5 | # Copyright 2004 Donour Sizemore (donour@uchicago.edu) 6 | # Copyright 2009 Secons Ltd. (www.obdtester.com) 7 | # 8 | # This file is part of pyOBD. 9 | # 10 | # pyOBD is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 2 of the License, or 13 | # (at your option) any later version. 14 | # 15 | # pyOBD is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | # 20 | # You should have received a copy of the GNU General Public License 21 | # along with pyOBD; if not, write to the Free Software 22 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 | ########################################################################### 24 | 25 | def hex_to_int(str): 26 | i = eval("0x" + str, {}, {}) 27 | return i 28 | 29 | def maf(code): 30 | code = hex_to_int(code) 31 | return code * 0.00132276 32 | 33 | def throttle_pos(code): 34 | code = hex_to_int(code) 35 | return code * 100.0 / 255.0 36 | 37 | def intake_m_pres(code): # in kPa 38 | code = hex_to_int(code) 39 | return code / 0.14504 40 | 41 | def rpm(code): 42 | code = hex_to_int(code) 43 | return code / 4 44 | 45 | def speed(code): 46 | code = hex_to_int(code) 47 | return code / 1.609 48 | 49 | def percent_scale(code): 50 | code = hex_to_int(code) 51 | return code * 100.0 / 255.0 52 | 53 | def timing_advance(code): 54 | code = hex_to_int(code) 55 | return (code - 128) / 2.0 56 | 57 | def sec_to_min(code): 58 | code = hex_to_int(code) 59 | return code / 60 60 | 61 | def temp(code): 62 | code = hex_to_int(code) 63 | c = code - 40 64 | return 32 + (9 * c / 5) 65 | 66 | def cpass(code): 67 | #fixme 68 | return code 69 | 70 | def fuel_trim_percent(code): 71 | code = hex_to_int(code) 72 | #return (code - 128.0) * 100.0 / 128 73 | return (code - 128) * 100 / 128 74 | 75 | def dtc_decrypt(code): 76 | #first byte is byte after PID and without spaces 77 | num = hex_to_int(code[:2]) #A byte 78 | res = [] 79 | 80 | if num & 0x80: # is mil light on 81 | mil = 1 82 | else: 83 | mil = 0 84 | 85 | # bit 0-6 are the number of dtc's. 86 | num = num & 0x7f 87 | 88 | res.append(num) 89 | res.append(mil) 90 | 91 | numB = hex_to_int(code[2:4]) #B byte 92 | 93 | for i in range(0,3): 94 | res.append(((numB>>i)&0x01)+((numB>>(3+i))&0x02)) 95 | 96 | numC = hex_to_int(code[4:6]) #C byte 97 | numD = hex_to_int(code[6:8]) #D byte 98 | 99 | for i in range(0,7): 100 | res.append(((numC>>i)&0x01)+(((numD>>i)&0x01)<<1)) 101 | 102 | res.append(((numD>>7)&0x01)) #EGR SystemC7 bit of different 103 | 104 | #return res 105 | return "#" 106 | 107 | def hex_to_bitstring(str): 108 | bitstring = "" 109 | for i in str: 110 | # silly type safety, we don't want to eval random stuff 111 | if type(i) == type(''): 112 | v = eval("0x%s" % i) 113 | if v & 8 : 114 | bitstring += '1' 115 | else: 116 | bitstring += '0' 117 | if v & 4: 118 | bitstring += '1' 119 | else: 120 | bitstring += '0' 121 | if v & 2: 122 | bitstring += '1' 123 | else: 124 | bitstring += '0' 125 | if v & 1: 126 | bitstring += '1' 127 | else: 128 | bitstring += '0' 129 | return bitstring 130 | 131 | class Sensor: 132 | def __init__(self, shortName, sensorName, sensorcommand, sensorValueFunction, u): 133 | self.shortname = shortName 134 | self.name = sensorName 135 | self.cmd = sensorcommand 136 | self.value= sensorValueFunction 137 | self.unit = u 138 | 139 | SENSORS = [ 140 | Sensor("pids" , "Supported PIDs" , "0100" , hex_to_bitstring ,"" ), 141 | Sensor("dtc_status" , "S-S DTC Cleared" , "0101" , dtc_decrypt ,"" ), 142 | Sensor("dtc_ff" , "DTC C-F-F" , "0102" , cpass ,"" ), 143 | Sensor("fuel_status" , "Fuel System Stat" , "0103" , cpass ,"" ), 144 | Sensor("load" , "Calc Load Value" , "01041", percent_scale ,"" ), 145 | Sensor("temp" , "Coolant Temp" , "0105" , temp ,"F" ), 146 | Sensor("short_term_fuel_trim_1", "S-T Fuel Trim" , "0106" , fuel_trim_percent,"%" ), 147 | Sensor("long_term_fuel_trim_1" , "L-T Fuel Trim" , "0107" , fuel_trim_percent,"%" ), 148 | Sensor("short_term_fuel_trim_2", "S-T Fuel Trim" , "0108" , fuel_trim_percent,"%" ), 149 | Sensor("long_term_fuel_trim_2" , "L-T Fuel Trim" , "0109" , fuel_trim_percent,"%" ), 150 | Sensor("fuel_pressure" , "FuelRail Pressure" , "010A" , cpass ,"" ), 151 | Sensor("manifold_pressure" , "Intk Manifold" , "010B" , intake_m_pres ,"psi" ), 152 | Sensor("rpm" , "Engine RPM" , "010C1", rpm ,"" ), 153 | Sensor("speed" , "Vehicle Speed" , "010D1", speed ,"MPH" ), 154 | Sensor("timing_advance" , "Timing Advance" , "010E" , timing_advance ,"degrees"), 155 | Sensor("intake_air_temp" , "Intake Air Temp" , "010F" , temp ,"F" ), 156 | Sensor("maf" , "AirFlow Rate(MAF)" , "0110" , maf ,"lb/min" ), 157 | Sensor("throttle_pos" , "Throttle Position" , "01111", throttle_pos ,"%" ), 158 | Sensor("secondary_air_status" , "2nd Air Status" , "0112" , cpass ,"" ), 159 | Sensor("o2_sensor_positions" , "Loc of O2 sensors" , "0113" , cpass ,"" ), 160 | Sensor("o211" , "O2 Sensor: 1 - 1" , "0114" , fuel_trim_percent,"%" ), 161 | Sensor("o212" , "O2 Sensor: 1 - 2" , "0115" , fuel_trim_percent,"%" ), 162 | Sensor("o213" , "O2 Sensor: 1 - 3" , "0116" , fuel_trim_percent,"%" ), 163 | Sensor("o214" , "O2 Sensor: 1 - 4" , "0117" , fuel_trim_percent,"%" ), 164 | Sensor("o221" , "O2 Sensor: 2 - 1" , "0118" , fuel_trim_percent,"%" ), 165 | Sensor("o222" , "O2 Sensor: 2 - 2" , "0119" , fuel_trim_percent,"%" ), 166 | Sensor("o223" , "O2 Sensor: 2 - 3" , "011A" , fuel_trim_percent,"%" ), 167 | Sensor("o224" , "O2 Sensor: 2 - 4" , "011B" , fuel_trim_percent,"%" ), 168 | Sensor("obd_standard" , "OBD Designation" , "011C" , cpass ,"" ), 169 | Sensor("o2_sensor_position_b" , "Loc of O2 sensor" , "011D" , cpass ,"" ), 170 | Sensor("aux_input" , "Aux input status" , "011E" , cpass ,"" ), 171 | Sensor("engine_time" , "Engine Start MIN" , "011F" , sec_to_min ,"min" ), 172 | Sensor("engine_mil_time" , "Engine Run MIL" , "014D" , sec_to_min ,"min" ), 173 | ] 174 | 175 | 176 | #___________________________________________________________ 177 | 178 | def test(): 179 | for i in SENSORS: 180 | print i.name, i.value("F") 181 | 182 | if __name__ == "__main__": 183 | test() 184 | -------------------------------------------------------------------------------- /obd_utils.py: -------------------------------------------------------------------------------- 1 | import serial 2 | import platform 3 | 4 | def scanSerial(): 5 | """scan for available ports. return a list of serial names""" 6 | available = [] 7 | # Enable Bluetooh connection 8 | for i in range(10): 9 | try: 10 | s = serial.Serial("/dev/rfcomm"+str(i)) 11 | available.append( (str(s.port))) 12 | s.close() # explicit close 'cause of delayed GC in java 13 | except serial.SerialException: 14 | pass 15 | # Enable USB connection 16 | for i in range(256): 17 | try: 18 | s = serial.Serial("/dev/ttyUSB"+str(i)) 19 | available.append(s.portstr) 20 | s.close() # explicit close 'cause of delayed GC in java 21 | except serial.SerialException: 22 | pass 23 | # Enable obdsim 24 | #for i in range(256): 25 | #try: #scan Simulator 26 | #s = serial.Serial("/dev/pts/"+str(i)) 27 | #available.append(s.portstr) 28 | #s.close() # explicit close 'cause of delayed GC in java 29 | #except serial.SerialException: 30 | #pass 31 | 32 | return available -------------------------------------------------------------------------------- /pyobd: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ############################################################################ 3 | # 4 | # wxgui.py 5 | # 6 | # Copyright 2004 Donour Sizemore (donour@uchicago.edu) 7 | # Copyright 2009 Secons Ltd. (www.obdtester.com) 8 | # 9 | # This file is part of pyOBD. 10 | # 11 | # pyOBD is free software; you can redistribute it and/or modify 12 | # it under the terms of the GNU General Public License as published by 13 | # the Free Software Foundation; either version 2 of the License, or 14 | # (at your option) any later version. 15 | # 16 | # pyOBD is distributed in the hope that it will be useful, 17 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 18 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 | # GNU General Public License for more details. 20 | # 21 | # You should have received a copy of the GNU General Public License 22 | # along with pyOBD; if not, write to the Free Software 23 | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 24 | ############################################################################ 25 | 26 | #import wxversion 27 | #wxversion.select("2.6") 28 | import wx 29 | 30 | import obd_io #OBD2 funcs 31 | import os #os.environ 32 | 33 | import threading 34 | import sys 35 | import serial 36 | import platform 37 | import time 38 | import ConfigParser #safe application configuration 39 | import webbrowser #open browser from python 40 | 41 | from obd2_codes import pcodes 42 | from obd2_codes import ptest 43 | from obd_utils import scanSerial 44 | 45 | from wx.lib.mixins.listctrl import ListCtrlAutoWidthMixin 46 | 47 | ID_ABOUT = 101 48 | ID_EXIT = 110 49 | ID_CONFIG = 500 50 | ID_CLEAR = 501 51 | ID_GETC = 502 52 | ID_RESET = 503 53 | ID_LOOK = 504 54 | ALL_ON = 505 55 | ALL_OFF = 506 56 | 57 | ID_DISCONNECT = 507 58 | ID_HELP_ABOUT = 508 59 | ID_HELP_VISIT = 509 60 | ID_HELP_ORDER = 510 61 | 62 | # Define notification event for sensor result window 63 | EVT_RESULT_ID = 1000 64 | def EVT_RESULT(win, func,id): 65 | """Define Result Event.""" 66 | win.Connect(-1, -1, id, func) 67 | 68 | #event pro akutalizaci Trace tabu 69 | class ResultEvent(wx.PyEvent): 70 | """Simple event to carry arbitrary result data.""" 71 | def __init__(self, data): 72 | """Init Result Event.""" 73 | wx.PyEvent.__init__(self) 74 | self.SetEventType(EVT_RESULT_ID) 75 | self.data = data 76 | 77 | #event pro aktualizaci DTC tabu 78 | EVT_DTC_ID = 1001 79 | class DTCEvent(wx.PyEvent): 80 | """Simple event to carry arbitrary result data.""" 81 | def __init__(self, data): 82 | """Init Result Event.""" 83 | wx.PyEvent.__init__(self) 84 | self.SetEventType(EVT_DTC_ID) 85 | self.data = data 86 | 87 | #event pro aktualizaci status tabu 88 | EVT_STATUS_ID = 1002 89 | class StatusEvent(wx.PyEvent): 90 | """Simple event to carry arbitrary result data.""" 91 | def __init__(self, data): 92 | """Init Result Event.""" 93 | wx.PyEvent.__init__(self) 94 | self.SetEventType(EVT_STATUS_ID) 95 | self.data = data 96 | 97 | #event pro aktualizaci tests tabu 98 | EVT_TESTS_ID = 1003 99 | class TestEvent(wx.PyEvent): 100 | """Simple event to carry arbitrary result data.""" 101 | def __init__(self, data): 102 | """Init Result Event.""" 103 | wx.PyEvent.__init__(self) 104 | self.SetEventType(EVT_TESTS_ID) 105 | self.data = data 106 | 107 | #defines notification event for debug tracewindow 108 | from debugEvent import * 109 | 110 | class MyApp(wx.App): 111 | # A listctrl which auto-resizes the column boxes to fill 112 | class MyListCtrl(wx.ListCtrl, ListCtrlAutoWidthMixin): 113 | def __init__(self, parent, id, pos = wx.DefaultPosition, 114 | size = wx.DefaultSize, style = 0): 115 | wx.ListCtrl.__init__(self,parent,id,pos,size,style) 116 | ListCtrlAutoWidthMixin.__init__(self) 117 | 118 | class sensorProducer(threading.Thread): 119 | def __init__(self, _notify_window,portName,SERTIMEOUT,RECONNATTEMPTS,_nb): 120 | from Queue import Queue 121 | self.portName = portName 122 | self.RECONNATTEMPTS=RECONNATTEMPTS 123 | self.SERTIMEOUT=SERTIMEOUT 124 | self.port = None 125 | self._notify_window=_notify_window 126 | self._nb=_nb 127 | threading.Thread.__init__ ( self ) 128 | 129 | def initCommunication(self): 130 | self.port = obd_io.OBDPort(self.portName,self._notify_window,self.SERTIMEOUT,self.RECONNATTEMPTS) 131 | 132 | if self.port.State==0: #Cant open serial port 133 | return None 134 | 135 | self.active = [] 136 | self.supp = self.port.sensor(0)[1] #read supported PIDS 137 | 138 | self.active.append(1); #PID 0 is always supported 139 | 140 | wx.PostEvent(self._notify_window, ResultEvent([0,0,"X"])) 141 | wx.PostEvent(self._notify_window, DebugEvent([1,"Communication initialized..."])) 142 | 143 | for i in range(1, len(self.supp)): 144 | if self.supp[i-1] == "1": #put X in coloum if PID is supported 145 | self.active.append(1) 146 | wx.PostEvent(self._notify_window, ResultEvent([i,0,"X"])) 147 | else: 148 | self.active.append(0) 149 | wx.PostEvent(self._notify_window, ResultEvent([i,0,""])) 150 | return "OK" 151 | 152 | def run(self): 153 | wx.PostEvent(self._notify_window, StatusEvent([0,1,"Connecting...."])) 154 | self.initCommunication() 155 | if self.port.State==0: #cant connect, exit thread 156 | self.stop() 157 | wx.PostEvent(self._notify_window, StatusEvent([666])) #signal apl, that communication was disconnected 158 | wx.PostEvent(self._notify_window, StatusEvent([0,1,"Error cant connect..."])) 159 | return None 160 | 161 | wx.PostEvent(self._notify_window, StatusEvent([0,1,"Connected"])) 162 | wx.PostEvent(self._notify_window, StatusEvent([2,1,self.port.ELMver])) 163 | prevstate=-1 164 | curstate=-1 165 | while self._notify_window.ThreadControl!=666: 166 | prevstate=curstate 167 | curstate=self._nb.GetSelection() 168 | if curstate==0: #show status tab 169 | pass 170 | elif curstate==1: #show tests tab 171 | res=self.port.get_tests_MIL() 172 | for i in range(0,len(res)): 173 | wx.PostEvent(self._notify_window, TestEvent([i,1,res[i]])) 174 | 175 | elif curstate==2: #show sensor tab 176 | for i in range(3, len(self.active)): 177 | if self.active[i]: 178 | s = self.port.sensor(i) 179 | wx.PostEvent(self._notify_window, ResultEvent([i,2,"%s (%s)" % (s[1], s[2])])) 180 | if self._notify_window.ThreadControl==666: 181 | break 182 | elif curstate==3: #show DTC tab 183 | if self._notify_window.ThreadControl == 1: #clear DTC 184 | self.port.clear_dtc() 185 | 186 | if self._notify_window.ThreadControl==666: #before reset ThreadControl we must check if main thread did not want us to finish 187 | break 188 | 189 | self._notify_window.ThreadControl=0 190 | prevstate=-1 # to reread DTC 191 | if self._notify_window.ThreadControl == 2: #reread DTC 192 | prevstate=-1 193 | 194 | if self._notify_window.ThreadControl==666: 195 | break 196 | 197 | self._notify_window.ThreadControl=0 198 | if prevstate!=3: 199 | wx.PostEvent(self._notify_window, DTCEvent(0)) #clear list 200 | DTCCodes=self.port.get_dtc() 201 | if len(DTCCodes)==0: 202 | wx.PostEvent(self._notify_window, DTCEvent(["","","No DTC codes (codes cleared)"])) 203 | for i in range (0,len(DTCCodes)): 204 | wx.PostEvent(self._notify_window, DTCEvent([DTCCodes[i][1],DTCCodes[i][0],pcodes[DTCCodes[i][1]]])) 205 | else: 206 | pass 207 | self.stop() 208 | 209 | def off(self, id): 210 | if id >= 0 and id < len(self.active): 211 | self.active[id] = 0 212 | else: 213 | debug("Invalid sensor id") 214 | def on(self, id): 215 | if id >= 0 and id < len(self.active): 216 | self.active[id] = 1 217 | else: 218 | debug("Invalid sensor id") 219 | 220 | def all_off(self): 221 | for i in range(0, len(self.active)): 222 | self.off(i) 223 | def all_on(self): 224 | for i in range(0, len(self.active)): 225 | self.off(i) 226 | 227 | def stop(self): 228 | if self.port != None: #if stop is called before any connection port is not defined (and not connected ) 229 | self.port.close() 230 | wx.PostEvent(self._notify_window, StatusEvent([0,1,"Disconnected"])) 231 | wx.PostEvent(self._notify_window, StatusEvent([2,1,"----"])) 232 | 233 | #class producer end 234 | 235 | def sensor_control_on(self): #after connection enable few buttons 236 | self.settingmenu.Enable(ID_CONFIG,False) 237 | self.settingmenu.Enable(ID_RESET,False) 238 | self.settingmenu.Enable(ID_DISCONNECT,True) 239 | self.dtcmenu.Enable(ID_GETC,True) 240 | self.dtcmenu.Enable(ID_CLEAR,True) 241 | self.GetDTCButton.Enable(True) 242 | self.ClearDTCButton.Enable(True) 243 | 244 | def sensor_toggle(e): 245 | sel = e.m_itemIndex 246 | state = self.senprod.active[sel] 247 | print sel, state 248 | if state == 0: 249 | self.senprod.on(sel) 250 | self.sensors.SetStringItem(sel,1,"1") 251 | elif state == 1: 252 | self.senprod.off(sel) 253 | self.sensors.SetStringItem(sel,1,"0") 254 | else: 255 | debug("Incorrect sensor state") 256 | 257 | self.sensors.Bind(wx.EVT_LIST_ITEM_ACTIVATED,sensor_toggle,id=self.sensor_id) 258 | 259 | def sensor_control_off(self): #after disconnect disable fer buttons 260 | self.dtcmenu.Enable(ID_GETC,False) 261 | self.dtcmenu.Enable(ID_CLEAR,False) 262 | self.settingmenu.Enable(ID_DISCONNECT,False) 263 | self.settingmenu.Enable(ID_CONFIG,True) 264 | self.settingmenu.Enable(ID_RESET,True) 265 | self.GetDTCButton.Enable(False) 266 | self.ClearDTCButton.Enable(False) 267 | #http://pyserial.sourceforge.net/ empty function 268 | #EVT_LIST_ITEM_ACTIVATED(self.sensors,self.sensor_id, lambda : None) 269 | 270 | def build_sensor_page(self): 271 | HOFFSET_LIST=0 272 | tID = wx.NewId() 273 | self.sensor_id = tID 274 | panel = wx.Panel(self.nb, -1) 275 | 276 | self.sensors = self.MyListCtrl(panel, tID, pos=wx.Point(0,HOFFSET_LIST), 277 | style= 278 | wx.LC_REPORT | 279 | wx.SUNKEN_BORDER | 280 | wx.LC_HRULES | 281 | wx.LC_SINGLE_SEL) 282 | 283 | 284 | self.sensors.InsertColumn(0, "Supported",width=70) 285 | self.sensors.InsertColumn(1, "Sensor",format=wx.LIST_FORMAT_RIGHT, width=250) 286 | self.sensors.InsertColumn(2, "Value") 287 | for i in range(0, len(obd_io.obd_sensors.SENSORS)): 288 | s = obd_io.obd_sensors.SENSORS[i].name 289 | self.sensors.InsertStringItem(i, "") 290 | self.sensors.SetStringItem(i, 1, s) 291 | 292 | 293 | #################################################################### 294 | # This little bit of magic keeps the list the same size as the frame 295 | def OnPSize(e, win = panel): 296 | panel.SetSize(e.GetSize()) 297 | self.sensors.SetSize(e.GetSize()) 298 | w,h = self.frame.GetClientSizeTuple() 299 | self.sensors.SetDimensions(0,HOFFSET_LIST, w-10 , h - 35 ) 300 | 301 | panel.Bind(wx.EVT_SIZE,OnPSize) 302 | #################################################################### 303 | 304 | self.nb.AddPage(panel, "Sensors") 305 | 306 | def build_DTC_page(self): 307 | HOFFSET_LIST=30 #offset from the top of panel (space for buttons) 308 | tID = wx.NewId() 309 | self.DTCpanel = wx.Panel(self.nb, -1) 310 | self.GetDTCButton = wx.Button(self.DTCpanel,-1 ,"Get DTC" , wx.Point(15,0)) 311 | self.ClearDTCButton = wx.Button(self.DTCpanel,-1,"Clear DTC", wx.Point(100,0)) 312 | 313 | #bind functions to button click action 314 | self.DTCpanel.Bind(wx.EVT_BUTTON,self.GetDTC,self.GetDTCButton) 315 | self.DTCpanel.Bind(wx.EVT_BUTTON,self.QueryClear,self.ClearDTCButton) 316 | 317 | self.dtc = self.MyListCtrl(self.DTCpanel,tID, pos=wx.Point(0,HOFFSET_LIST), 318 | style=wx.LC_REPORT|wx.SUNKEN_BORDER|wx.LC_HRULES|wx.LC_SINGLE_SEL) 319 | 320 | self.dtc.InsertColumn(0, "Code", width=100) 321 | self.dtc.InsertColumn(1, "Status",width=100) 322 | self.dtc.InsertColumn(2, "Trouble code") 323 | #################################################################### 324 | # This little bit of magic keeps the list the same size as the frame 325 | def OnPSize(e, win = self.DTCpanel): 326 | self.DTCpanel.SetSize(e.GetSize()) 327 | self.dtc.SetSize(e.GetSize()) 328 | w,h = self.frame.GetClientSizeTuple() 329 | # I have no idea where 70 comes from 330 | self.dtc.SetDimensions(0,HOFFSET_LIST, w-16 , h - 70 ) 331 | 332 | self.DTCpanel.Bind(wx.EVT_SIZE,OnPSize) 333 | #################################################################### 334 | 335 | self.nb.AddPage(self.DTCpanel, "DTC") 336 | 337 | def TraceDebug(self,level,msg): 338 | if self.DEBUGLEVEL<=level: 339 | self.trace.Append([str(level),msg]) 340 | 341 | def OnInit(self): 342 | self.ThreadControl = 0 #say thread what to do 343 | self.COMPORT = 0 344 | self.senprod = None 345 | self.DEBUGLEVEL = 0 #debug everthing 346 | 347 | tID = wx.NewId() 348 | 349 | #read settings from file 350 | self.config = ConfigParser.RawConfigParser() 351 | 352 | #print platform.system() 353 | #print platform.mac_ver()[] 354 | 355 | if "OS" in os.environ.keys(): #runnig under windows 356 | self.configfilepath="pyobd.ini" 357 | else: 358 | self.configfilepath=os.environ['HOME']+'/.pyobdrc' 359 | if self.config.read(self.configfilepath)==[]: 360 | self.COMPORT="/dev/ttyACM0" 361 | self.RECONNATTEMPTS=5 362 | self.SERTIMEOUT=2 363 | else: 364 | self.COMPORT=self.config.get("pyOBD","COMPORT") 365 | self.RECONNATTEMPTS=self.config.getint("pyOBD","RECONNATTEMPTS") 366 | self.SERTIMEOUT=self.config.getint("pyOBD","SERTIMEOUT") 367 | 368 | frame = wx.Frame(None, -1, "pyOBD-II") 369 | self.frame=frame 370 | 371 | EVT_RESULT(self,self.OnResult,EVT_RESULT_ID) 372 | EVT_RESULT(self,self.OnDebug, EVT_DEBUG_ID) 373 | EVT_RESULT(self,self.OnDtc,EVT_DTC_ID) 374 | EVT_RESULT(self,self.OnStatus,EVT_STATUS_ID) 375 | EVT_RESULT(self,self.OnTests,EVT_TESTS_ID) 376 | 377 | # Main notebook frames 378 | self.nb = wx.Notebook(frame, -1, style = wx.NB_TOP) 379 | 380 | self.status = self.MyListCtrl(self.nb, tID,style=wx.LC_REPORT|wx.SUNKEN_BORDER) 381 | self.status.InsertColumn(0, "Description",width=200) 382 | self.status.InsertColumn(1, "Value") 383 | self.status.Append(["Link State","Disconnnected"]); 384 | self.status.Append(["Protocol","---"]); 385 | self.status.Append(["Cable version","---"]); 386 | self.status.Append(["COM port",self.COMPORT]); 387 | 388 | self.nb.AddPage(self.status, "Status") 389 | 390 | self.OBDTests = self.MyListCtrl(self.nb, tID,style=wx.LC_REPORT|wx.SUNKEN_BORDER) 391 | self.OBDTests.InsertColumn(0, "Description",width=200) 392 | self.OBDTests.InsertColumn(1, "Value") 393 | self.nb.AddPage(self.OBDTests, "Tests") 394 | 395 | for i in range(0,len(ptest)): #fill MODE 1 PID 1 test description 396 | self.OBDTests.Append([ptest[i],"---"]); 397 | 398 | self.build_sensor_page() 399 | 400 | self.build_DTC_page() 401 | 402 | self.trace = self.MyListCtrl(self.nb, tID,style=wx.LC_REPORT|wx.SUNKEN_BORDER) 403 | self.trace.InsertColumn(0, "Level",width=40) 404 | self.trace.InsertColumn(1, "Message") 405 | self.nb.AddPage(self.trace, "Trace") 406 | self.TraceDebug(1,"Application started") 407 | 408 | # Setting up the menu. 409 | self.filemenu= wx.Menu() 410 | self.filemenu.Append(ID_EXIT,"E&xit"," Terminate the program") 411 | 412 | self.settingmenu = wx.Menu() 413 | self.settingmenu.Append(ID_CONFIG,"Configure"," Configure pyOBD") 414 | self.settingmenu.Append(ID_RESET,"Connect"," Reopen and connect to device") 415 | self.settingmenu.Append(ID_DISCONNECT,"Disconnect","Close connection to device") 416 | 417 | self.dtcmenu= wx.Menu() 418 | # tady toto nastavi automaticky tab DTC a provede akci 419 | self.dtcmenu.Append(ID_GETC ,"Get DTCs", " Get DTC Codes") 420 | self.dtcmenu.Append(ID_CLEAR ,"Clear DTC", " Clear DTC Codes") 421 | self.dtcmenu.Append(ID_LOOK ,"Code Lookup"," Lookup DTC Codes") 422 | 423 | self.helpmenu = wx.Menu() 424 | 425 | self.helpmenu.Append(ID_HELP_ABOUT ,"About this program", " Get DTC Codes") 426 | self.helpmenu.Append(ID_HELP_VISIT ,"Visit program homepage"," Lookup DTC Codes") 427 | self.helpmenu.Append(ID_HELP_ORDER ,"Order OBD-II cables", " Clear DTC Codes") 428 | 429 | 430 | # Creating the menubar. 431 | self.menuBar = wx.MenuBar() 432 | self.menuBar.Append(self.filemenu,"&File") # Adding the "filemenu" to the MenuBar 433 | self.menuBar.Append(self.settingmenu,"&OBD-II") 434 | self.menuBar.Append(self.dtcmenu,"&Trouble codes") 435 | self.menuBar.Append(self.helpmenu,"&Help") 436 | 437 | frame.SetMenuBar(self.menuBar) # Adding the MenuBar to the Frame content. 438 | 439 | frame.Bind(wx.EVT_MENU,self.OnExit,id=ID_EXIT)# attach the menu-event ID_EXIT to the 440 | frame.Bind(wx.EVT_MENU,self.QueryClear,id=ID_CLEAR) 441 | frame.Bind(wx.EVT_MENU,self.Configure,id=ID_CONFIG) 442 | frame.Bind(wx.EVT_MENU,self.OpenPort,id=ID_RESET) 443 | frame.Bind(wx.EVT_MENU,self.OnDisconnect,id=ID_DISCONNECT) 444 | frame.Bind(wx.EVT_MENU,self.GetDTC,id=ID_GETC) 445 | frame.Bind(wx.EVT_MENU,self.CodeLookup,id=ID_LOOK) 446 | frame.Bind(wx.EVT_MENU,self.OnHelpAbout,id=ID_HELP_ABOUT) 447 | frame.Bind(wx.EVT_MENU,self.OnHelpVisit,id=ID_HELP_VISIT) 448 | frame.Bind(wx.EVT_MENU,self.OnHelpOrder,id=ID_HELP_ORDER) 449 | 450 | self.SetTopWindow(frame) 451 | 452 | frame.Show(True) 453 | frame.SetSize((520,400)) 454 | self.sensor_control_off() 455 | 456 | return True 457 | 458 | def OnHelpVisit(self,event): 459 | webbrowser.open("http://www.obdtester.com/pyobd") 460 | 461 | def OnHelpOrder(self,event): 462 | webbrowser.open("http://www.obdtester.com/order") 463 | 464 | def OnHelpAbout(self,event): #todo about box 465 | Text = """ PyOBD is an automotive OBD2 diagnosting application using ELM237 cable. 466 | 467 | (C) 2008-2009 SeCons Ltd. 468 | (C) 2004 Charles Donour Sizemore 469 | 470 | http://www.obdtester.com/ 471 | http://www.secons.com/ 472 | 473 | PyOBD is free software; you can redistribute it and/or modify 474 | it under the terms of the GNU General Public License as published by the Free Software Foundation; 475 | either version 2 of the License, or (at your option) any later version. 476 | 477 | PyOBD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 478 | without even the implied warranty of MEHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 479 | See the GNU General Public License for more details. You should have received a copy of 480 | the GNU General Public License along with PyOBD; if not, write to 481 | the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 482 | """ 483 | 484 | #HelpAboutDlg = wx.Dialog(self.frame, id, title="About") 485 | 486 | 487 | #box = wx.BoxSizer(wx.HORIZONTAL) 488 | #box.Add(wx.StaticText(reconnectPanel,-1,Text,pos=(0,0),size=(200,200))) 489 | #box.Add(wx.Button(HelpAboutDlg,wx.ID_OK),0) 490 | #box.Add(wx.Button(HelpAboutDlg,wx.ID_CANCEL),1) 491 | 492 | #HelpAboutDlg.SetSizer(box) 493 | #HelpAboutDlg.SetAutoLayout(True) 494 | #sizer.Fit(HelpAboutDlg) 495 | #HelpAboutDlg.ShowModal() 496 | 497 | self.HelpAboutDlg = wx.MessageDialog(self.frame, Text, 'About',wx.OK | wx.ICON_INFORMATION) 498 | self.HelpAboutDlg.ShowModal() 499 | self.HelpAboutDlg.Destroy() 500 | 501 | def OnResult(self,event): 502 | self.sensors.SetStringItem(event.data[0], event.data[1], event.data[2]) 503 | 504 | def OnStatus(self,event): 505 | if event.data[0] == 666: #signal, that connection falied 506 | self.sensor_control_off() 507 | else: 508 | self.status.SetStringItem(event.data[0], event.data[1], event.data[2]) 509 | 510 | def OnTests(self,event): 511 | self.OBDTests.SetStringItem(event.data[0], event.data[1], event.data[2]) 512 | 513 | def OnDebug(self,event): 514 | self.TraceDebug(event.data[0],event.data[1]) 515 | 516 | def OnDtc(self,event): 517 | if event.data == 0: #signal, that DTC was cleared 518 | self.dtc.DeleteAllItems() 519 | else: 520 | self.dtc.Append(event.data) 521 | 522 | def OnDisconnect(self,event): #disconnect connection to ECU 523 | self.ThreadControl=666 524 | self.sensor_control_off() 525 | 526 | def OpenPort(self,e): 527 | 528 | if self.senprod: # signal current producers to finish 529 | self.senprod.stop() 530 | self.ThreadControl = 0 531 | self.senprod = self.sensorProducer(self,self.COMPORT,self.SERTIMEOUT,self.RECONNATTEMPTS,self.nb) 532 | self.senprod.start() 533 | 534 | self.sensor_control_on() 535 | 536 | def GetDTC(self,e): 537 | self.nb.SetSelection(3) 538 | self.ThreadControl=2 539 | 540 | def AddDTC(self, code): 541 | self.dtc.InsertStringItem(0, "") 542 | self.dtc.SetStringItem(0, 0, code[0]) 543 | self.dtc.SetStringItem(0, 1, code[1]) 544 | 545 | 546 | def CodeLookup(self,e = None): 547 | id = 0 548 | diag = wx.Frame(None, id, title="Diagnostic Trouble Codes") 549 | 550 | tree = wx.TreeCtrl(diag, id, style = wx.TR_HAS_BUTTONS) 551 | 552 | root = tree.AddRoot("Code Reference") 553 | proot = tree.AppendItem(root,"Powertrain (P) Codes") 554 | codes = obd_io.pcodes.keys() 555 | codes.sort() 556 | group = "" 557 | for c in codes: 558 | if c[:3] != group: 559 | group_root = tree.AppendItem(proot, c[:3]+"XX") 560 | group = c[:3] 561 | leaf = tree.AppendItem(group_root, c) 562 | tree.AppendItem(leaf, obd_io.pcodes[c]) 563 | 564 | uroot = tree.AppendItem(root,"Network (U) Codes") 565 | codes = obd_io.ucodes.keys() 566 | codes.sort() 567 | group = "" 568 | for c in codes: 569 | if c[:3] != group: 570 | group_root = tree.AppendItem(uroot, c[:3]+"XX") 571 | group = c[:3] 572 | leaf = tree.AppendItem(group_root, c) 573 | tree.AppendItem(leaf, obd_io.ucodes[c]) 574 | 575 | diag.SetSize((400,500)) 576 | diag.Show(True) 577 | 578 | 579 | def QueryClear(self,e): 580 | id = 0 581 | diag = wx.Dialog(self.frame, id, title="Clear DTC?") 582 | 583 | sizer = wx.BoxSizer(wx.VERTICAL) 584 | sizer.Add(wx.StaticText(diag, -1, "Are you sure you wish to"),0) 585 | sizer.Add(wx.StaticText(diag, -1, "clear all DTC codes and "),0) 586 | sizer.Add(wx.StaticText(diag, -1, "freeze frame data? "),0) 587 | box = wx.BoxSizer(wx.HORIZONTAL) 588 | box.Add(wx.Button(diag,wx.ID_OK, "Ok" ),0) 589 | box.Add(wx.Button(diag,wx.ID_CANCEL, "Cancel"),0) 590 | 591 | sizer.Add(box, 0) 592 | diag.SetSizer(sizer) 593 | diag.SetAutoLayout(True) 594 | sizer.Fit(diag) 595 | r = diag.ShowModal() 596 | if r == wx.ID_OK: 597 | self.ClearDTC() 598 | 599 | def ClearDTC(self): 600 | self.ThreadControl=1 601 | self.nb.SetSelection(3) 602 | 603 | def Configure(self,e = None): 604 | id = 0 605 | diag = wx.Dialog(self.frame, id, title="Configure") 606 | sizer = wx.BoxSizer(wx.VERTICAL) 607 | 608 | ports = scanSerial() 609 | rb = wx.RadioBox(diag, id, "Choose Serial Port", 610 | choices = ports, style = wx.RA_SPECIFY_COLS, 611 | majorDimension = 2) 612 | 613 | sizer.Add(rb, 0) 614 | 615 | #timeOut input control 616 | timeoutPanel = wx.Panel(diag, -1) 617 | timeoutCtrl = wx.TextCtrl(timeoutPanel, -1, '',pos=(140,0), size=(35, 25)) 618 | timeoutStatic = wx.StaticText(timeoutPanel,-1,'Timeout:',pos=(3,5),size=(140,20)) 619 | timeoutCtrl.SetValue(str(self.SERTIMEOUT)) 620 | 621 | #reconnect attempt input control 622 | reconnectPanel = wx.Panel(diag, -1) 623 | reconnectCtrl = wx.TextCtrl(reconnectPanel, -1, '',pos=(140,0), size=(35, 25)) 624 | reconnectStatic = wx.StaticText(reconnectPanel,-1,'Reconnect attempts:',pos=(3,5),size=(140,20)) 625 | reconnectCtrl.SetValue(str(self.RECONNATTEMPTS)) 626 | 627 | #web open link button 628 | self.OpenLinkButton = wx.Button(diag,-1,"Click here to order ELM-USB interface",size=(260,30)) 629 | diag.Bind(wx.EVT_BUTTON,self.OnHelpOrder,self.OpenLinkButton) 630 | 631 | #set actual serial port choice 632 | if (self.COMPORT != 0) and (self.COMPORT in ports): 633 | rb.SetSelection(ports.index(self.COMPORT)) 634 | 635 | 636 | sizer.Add(self.OpenLinkButton) 637 | sizer.Add(timeoutPanel,0) 638 | sizer.Add(reconnectPanel,0) 639 | 640 | box = wx.BoxSizer(wx.HORIZONTAL) 641 | box.Add(wx.Button(diag,wx.ID_OK),0) 642 | box.Add(wx.Button(diag,wx.ID_CANCEL),1) 643 | 644 | sizer.Add(box, 0) 645 | diag.SetSizer(sizer) 646 | diag.SetAutoLayout(True) 647 | sizer.Fit(diag) 648 | r = diag.ShowModal() 649 | if r == wx.ID_OK: 650 | 651 | #create section 652 | if self.config.sections()==[]: 653 | self.config.add_section("pyOBD") 654 | #set and save COMPORT 655 | self.COMPORT = ports[rb.GetSelection()] 656 | self.config.set("pyOBD","COMPORT",self.COMPORT) 657 | 658 | #set and save SERTIMEOUT 659 | self.SERTIMEOUT = int(timeoutCtrl.GetValue()) 660 | self.config.set("pyOBD","SERTIMEOUT",self.SERTIMEOUT) 661 | self.status.SetStringItem(3,1,self.COMPORT); 662 | 663 | #set and save RECONNATTEMPTS 664 | self.RECONNATTEMPTS = int(reconnectCtrl.GetValue()) 665 | self.config.set("pyOBD","RECONNATTEMPTS",self.RECONNATTEMPTS) 666 | 667 | #write configuration to cfg file 668 | self.config.write(open(self.configfilepath, 'wb')) 669 | 670 | 671 | def OnExit(self,e = None): 672 | import sys 673 | sys.exit(0) 674 | 675 | app = MyApp(0) 676 | app.MainLoop() 677 | -------------------------------------------------------------------------------- /pyobd.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Encoding=UTF8 3 | Icon=/usr/share/pyobd/pyobd.gif 4 | Name=pyOBD: OBD2 Diagnostics 5 | Comment=Car On-Board 2 vehicle diagnostics (ELM-32x compatible interface) 6 | Exec=python /usr/bin/pyobd 7 | Terminal=false 8 | Type=Application 9 | Categories=Utility; 10 | StartupNotify=true 11 | -------------------------------------------------------------------------------- /pyobd.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/sakurusurya2000/pyobd/6736694989576e771fd68f534538430467d30517/pyobd.gif --------------------------------------------------------------------------------