RasPiCar Projekt Forum
PyObd 0100 response: NO DATA / Alternative zu PyObd - Druckversion

+- RasPiCar Projekt Forum (https://RasPiCarProjekt.de)
+-- Forum: Hardware (https://RasPiCarProjekt.de/forumdisplay.php?fid=5)
+--- Forum: OBD / CAN (https://RasPiCarProjekt.de/forumdisplay.php?fid=46)
+--- Thema: PyObd 0100 response: NO DATA / Alternative zu PyObd (/showthread.php?tid=1039)



PyObd 0100 response: NO DATA / Alternative zu PyObd - R4PTUR3 - 16.04.2017

Servus Leute,
Nachdem Ich mich schon in etlichen Pi-Foren nun angemeldet habe, um PyObd zum laufen zu kriegen, hoffe ich dass ich nun hier Hilfe finde.
Zunächst kurz was ich vor habe.

Da mein neuer BMW F20 keinerlei Daten wie Wassertemperatur o.ä. anzeigt würde ich gerne so etwas selbst machen, da der Preis für solche Geräte eine Frechheit ist. :Big Grin

https://www.insideperformance.de/datendisplay-1er-bmw-f21-f22_1296/

Das Ganze wollte ich mit diesem Projekt realisieren:
http://www.cowfishstudios.com/blog/obd-pitft-display-car-diagnostics-obd-ii-data-on-adafruits-pitft-touchscreen-display-for-raspberry-pi

Dabei bin ich auf viele Hindernisse gestoßen, habe es erst mit dem Pi3 probiert, nachdem ich dort permanent Probleme hatte mit SPP, welches bei Jessie wohl ziemlich verbuggt sein soll, habe ich mir einen teureren OBD Adapter bestellt, ohne Erfolg, naja irgendwann habe ich das mit dem Seriellen Problemen hin bekommen und dann zeigte die Grafische Oberfläche leider nichts an, und im Terminal ist die Fehlermeldung bzw. die Meldung: 0100 response: NO DATA.

[Bild: img_0370.jpg]

[Bild: img_0369.jpg]
Die Bilder sind durch die Upload-Website warum auch immer gedreht..

Dann habe ich den Pi3 verworfen und mir einen Bluetooth-Dongle gekauft und bin auf den Pi2 umgestiegen mit Wheezie, dort klappt das mit dem verbinden schonmal deutlich leichter, aber dennoch die selbe Meldung: NO DATA.
Ich habe mit dem Pi3 das ganze an verschiedenen Autos mit sehr unterschiedlichen Baujahren getestet, überall das Selbe.
Hat jemand ne Idee, was das Problem sein kann?

Die andere Frage wäre, gibt es eine Alternative zu pyobd für den Raspberry, die auch Bluetooth nutzen kann.


Danke schonmal und Grüße
Timo


RE: PyObd 0100 response: NO DATA / Alternative zu PyObd - R4PTUR3 - 17.04.2017

Zitat:Hello Paul,

Please find paste of modified code which managed to get my RPi working with the CAN bus on my Ford.

Whilst studying the file 'obd_io.py' I misunderstood the baud rate, or rather what function it serves with the ELM327 device. I thought it had to be set at 500Kb to match the CAN bus speed of my Ford car but it doesn't. The baud rate is set by the user to one of two values. In my case, 38400Kb per sec. Your code alludes to users needing to set the baud rate and this is what led to me thinking I needed to trim the baud rate to that of the car. Not the case, as I now know. Whereas I do need to set it, fortunately in my case 38400Kb was right by default. Anyway, like I say, it should be set to communicate reliably with the ELM327 device depending on the user need at the time I guess.

In the second code snip, (again taken from 'pyOBD.io') the next modification was key to making my script working on my particular car, is the protocol value. I read into the ELM327 data sheet and found on page 25 a table containing the various protocols used by each vehicle manufacturer. In my case, Ford.

Since my vehicle was made in 2007, I needed to use 'AT SP' command (again taken from the ELM 327 data sheet) to the value '6' in order to activate the correct protocol for the CAN on my Ford and ELM to talk to each other, i.e. 'AT SP 6'. On doing this, the script burst into life and my car sent steams of data which were organised well onto the terminal window, from the Raspberry Pi.

All I need to do now is capture the speed data specifically so that I can drive a script which runs a scrolling LED matrix. I'm not sure how to achieve this yet, as integrating a 3rd party script (ldp.py), which drives the Embedded Adventures 80x8 LED matrix - Type LDP-8008, is proving difficult to pass data values to (presumably through variables). The part of pyOBD which seems to handle text output is 'obd_capture.py' but as I say work in progress at the moment. However, I realise I'm on my own with this latter modification as I know pyOBD isn't designed for this add-on functionality.

Anyway, thank you to you and to everyone who has worked on this script to make a really rewarding software application. I have great respect to you as authors and everyone involved in making theirs work for their cars.

Many thanks,

Mark

Code Snip 1: 'obd_io.py'
================================================

class OBDPort:
""" OBDPort abstracts all communication with OBD-II device."""
def __init__(self,portnum,_notify_window,SERTIMEOUT,RECONNATTEMPTS):
"""Initializes port by resetting device and gettings supported PIDs. """
# These should really be set by the user.
baud = 38400 # set the baud rate either to 9600 or 38400. In my case 38400
databits = 8
par = serial.PARITY_NONE # parity
sb = 1 # stop bits
to = SERTIMEOUT
self.ELMver = "Unknown"
self.State = 1 #state SERIAL is 1 connected, 0 disconnected (connection failed)
self.port = None
#======================================================================================

# . . . . . .
#======================================================================================

Code snip 2: 'obd_io.py'

debug_display(self._notify_window, 2, "atz response:" + self.ELMver)
self.send_command("ate0") # echo off
debug_display(self._notify_window, 2, "ate0 response:" + self.get_result())
self.send_command("AT SP 6") # telling the program to use Ford's 'ISO 15765-4 CAN' protocol
debug_display(self._notify_window, 2, "atsp response:" + self.get_result())
self.send_command("0100")
ready = self.get_result()

Quelle:http://www.cowfishstudios.com/blog/obd-pi-raspberry-pi-displaying-car-diagnostics-obd-ii-data-on-an-aftermarket-head-unit
Nachdem ich diese Sachen auf mein Auto abgestimmt habe, und es nochmal mit dem teureren OBD-Adapter probiert habe, konnte ich nun endlich erfolgreich pyObd nutzen.
Gruß
Timo