I am doing a project for school that involves reading data from an ELM327 using a raspberry pi. I have never coded python before and have very limited knowledge of raspberry pi computers. I am using a raspberry pi 4B 4GB and the ELM327 device i am using runs on ELM327 v1.5.
['/dev/rfcomm0']
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/rfcomm0']
[obd.obd] Attempting to use port: /dev/rfcomm0
[obd.elm327] Initializing ELM327: PORT=/dev/rfcomm0 BAUD=38400 PROTOCOL=6
[obd.elm327] write: 'ATZ\r'
[obd.elm327] wait: 1 seconds
[obd.elm327] read: b'ATZ\r\r\rELM327 v1.5\r\r>'
[obd.elm327] write: 'ATE0\r'
[obd.elm327] read: b'ATE0\rOK\r\r>'
[obd.elm327] write: 'ATH1\r'
[obd.elm327] read: b'OK\r\r>'
[obd.elm327] write: 'ATL0\r'
[obd.elm327] read: b'OK\r\r>'
[obd.elm327] write: 'AT RV\r'
[obd.elm327] read: b'14.5V\r\r>'
[obd.elm327] %s is not a valid protocol. Please use "1" through "A"
[obd.elm327] Adapter connected, but the ignition is off
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
Traceback (most recent call last):
File "Test.py", line 32, in
for i in commands_list:
NameError: name 'commands_list' is not defined
pi@raspberrypi:~/Project $ python Test.py
['/dev/rfcomm0']
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/rfcomm0']
[obd.obd] Attempting to use port: /dev/rfcomm0
[obd.elm327] Initializing ELM327: PORT=/dev/rfcomm0 BAUD=38400 PROTOCOL=auto
[obd.elm327] write: 'ATZ\r'
[obd.elm327] wait: 1 seconds
[obd.elm327] read: b'\r\rELM327 v1.5\r\r>'
[obd.elm327] write: 'ATE0\r'
[obd.elm327] read: b'ATE0\rOK\r\r>'
[obd.elm327] write: 'ATH1\r'
[obd.elm327] read: b'OK'
[obd.elm327] write: 'ATL0\r'
[obd.elm327] read: b'\r\r>'
[obd.elm327] closing port
[obd.elm327] write: 'ATZ\r'
[obd.elm327] ATL0 did not return 'OK'
[obd.obd] Closing connection
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
Traceback (most recent call last):
File "Test.py", line 32, in
for i in commands_list:
NameError: name 'commands_list' is not defined
pi@raspberrypi:~/Project $ python Test.py /dev/rfcomm0
['/dev/rfcomm0']
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/rfcomm0']
[obd.obd] Attempting to use port: /dev/rfcomm0
[obd.elm327] Initializing ELM327: PORT=/dev/rfcomm0 BAUD=38400 PROTOCOL=auto
[obd.elm327] write: 'ATZ\r'
[obd.elm327] wait: 1 seconds
[obd.elm327] read: b'\r\rELM327 v1.5\r\r>'
[obd.elm327] write: 'ATE0\r'
[obd.elm327] read: b'ATE0\rOK\r\r>'
[obd.elm327] write: 'ATH1\r'
[obd.elm327] read: b'OK\r\r>'
[obd.elm327] write: 'ATL0\r'
[obd.elm327] read: b'OK\r\r'
[obd.elm327] write: 'AT RV\r'
[obd.elm327] read: b'>'
[obd.elm327] closing port
[obd.elm327] write: 'ATZ\r'
[obd.elm327] No answer from 'AT RV'
[obd.obd] Closing connection
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
Traceback (most recent call last):
File "Test.py", line 32, in
for i in commands_list:
NameError: name 'commands_list' is not defined
pi@raspberrypi:~/Project $ python3 Test.py /dev/rfcomm0
['/dev/rfcomm0']
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/rfcomm0']
[obd.obd] Attempting to use port: /dev/rfcomm0
[obd.elm327] Initializing ELM327: PORT=/dev/rfcomm0 BAUD=38400 PROTOCOL=auto
[obd.elm327] write: b'ATZ\r'
[obd.elm327] wait: 1 seconds
[obd.elm327] read: b'\r\rELM327 v1.5\r\r>'
[obd.elm327] write: b'ATE0\r'
[obd.elm327] read: b'ATE0\rOK\r\r>'
[obd.elm327] write: b'ATH1\r'
[obd.elm327] read: b'OK\r\r>'
[obd.elm327] write: b'ATL0\r'
[obd.elm327] read: b'OK\r\r>'
[obd.elm327] write: b'AT RV\r'
[obd.elm327] read: b'14.5V\r\r>'
[obd.elm327] write: b'ATSP0\r'
[obd.elm327] read: b'OK\r'
[obd.elm327] write: b'0100\r'
[obd.elm327] read: b'\r>'
[obd.elm327] write: b'ATDPN\r'
[obd.elm327] read: b'SEARCHING...\r7E8 06 41 00 BE 3D A8 13 \r\r>'
[obd.elm327] Failed to retrieve current protocol
[obd.elm327] Adapter connected, but the ignition is off
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
Traceback (most recent call last):
File "Test.py", line 32, in
for i in commands_list:
NameError: name 'commands_list' is not defined
pi@raspberrypi:~/Project $ python Test.py
Traceback (most recent call last):
File "Test.py", line 10, in
connection=obd.OBD(sys.argv[1])
IndexError: list index out of range
pi@raspberrypi:~/Project $ python Test.py
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Explicit port defined
[obd.elm327] Initializing ELM327: PORT=Test.py BAUD=auto PROTOCOL=auto
[obd.elm327] Could not configure port: (25, 'Inappropriate ioctl for device')
[obd.obd] Closing connection
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
Not Connected
[obd.obd] Query failed, no connection available
None
['/dev/rfcomm0']
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/rfcomm0']
[obd.obd] Attempting to use port: /dev/rfcomm0
[obd.elm327] Initializing ELM327: PORT=/dev/rfcomm0 BAUD=38400 PROTOCOL=auto
[obd.elm327] write: 'ATZ\r'
[obd.elm327] wait: 1 seconds
[obd.elm327] read: b'\r\rELM327 v1.5\r\r>'
[obd.elm327] write: 'ATE0\r'
[obd.elm327] read: b'ATE0\rOK\r\r>'
[obd.elm327] write: 'ATH1\r'
[obd.elm327] read: b'OK\r\r>'
[obd.elm327] write: 'ATL0\r'
[obd.elm327] read: b'OK\r\r>'
[obd.elm327] write: 'AT RV\r'
[obd.elm327] read: b'14.4V\r\r>'
[obd.elm327] write: 'ATSP0\r'
[obd.elm327] read: b'OK\r\r'
[obd.elm327] write: '0100\r'
[obd.elm327] read: b'>'
[obd.elm327] write: 'ATDPN\r'
[obd.elm327] read: b'SEARCHING...\r7E8 06 41 00 BE 3D A8 13 \r\r>'
[obd.elm327] Failed to retrieve current protocol
[obd.elm327] Adapter connected, but the ignition is off
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
Traceback (most recent call last):
File "Test.py", line 32, in
for i in commands_list:
NameError: name 'commands_list' is not defined
I am doing a project for school that involves reading data from an ELM327 using a raspberry pi. I have never coded python before and have very limited knowledge of raspberry pi computers. I am using a raspberry pi 4B 4GB and the ELM327 device i am using runs on ELM327 v1.5.
Here is the code i am using: `import obd, time
Show Ports
ports=obd.scan_serial() print (ports)
Debugging
obd.logger.setLevel(obd.logging.DEBUG)
Setting Connection
connection=obd.OBD(baudrate=38400,fast=False,timeout=10,check_voltage=True)
Checking Connection
from obd import OBDStatus connection.status()==OBDStatus.CAR_CONNECTED
Checking For Data
while True: for i in commands_list: cmd1=obd.commands.RPM response1=connection.query(cmd1) print(response1.value)
`
Here is what the program returns:
['/dev/rfcomm0'] [obd.obd] ======================= python-OBD (v0.7.1) ======================= [obd.obd] Using scan_serial to select port [obd.obd] Available ports: ['/dev/rfcomm0'] [obd.obd] Attempting to use port: /dev/rfcomm0 [obd.elm327] Initializing ELM327: PORT=/dev/rfcomm0 BAUD=38400 PROTOCOL=6 [obd.elm327] write: 'ATZ\r' [obd.elm327] wait: 1 seconds [obd.elm327] read: b'ATZ\r\r\rELM327 v1.5\r\r>' [obd.elm327] write: 'ATE0\r' [obd.elm327] read: b'ATE0\rOK\r\r>' [obd.elm327] write: 'ATH1\r' [obd.elm327] read: b'OK\r\r>' [obd.elm327] write: 'ATL0\r' [obd.elm327] read: b'OK\r\r>' [obd.elm327] write: 'AT RV\r' [obd.elm327] read: b'14.5V\r\r>' [obd.elm327] %s is not a valid protocol. Please use "1" through "A" [obd.elm327] Adapter connected, but the ignition is off [obd.obd] Cannot load commands: No connection to car [obd.obd] =================================================================== Traceback (most recent call last): File "Test.py", line 32, in
for i in commands_list:
NameError: name 'commands_list' is not defined
pi@raspberrypi:~/Project $ python Test.py
['/dev/rfcomm0']
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/rfcomm0']
[obd.obd] Attempting to use port: /dev/rfcomm0
[obd.elm327] Initializing ELM327: PORT=/dev/rfcomm0 BAUD=38400 PROTOCOL=auto
[obd.elm327] write: 'ATZ\r'
[obd.elm327] wait: 1 seconds
[obd.elm327] read: b'\r\rELM327 v1.5\r\r>'
[obd.elm327] write: 'ATE0\r'
[obd.elm327] read: b'ATE0\rOK\r\r>'
[obd.elm327] write: 'ATH1\r'
[obd.elm327] read: b'OK'
[obd.elm327] write: 'ATL0\r'
[obd.elm327] read: b'\r\r>'
[obd.elm327] closing port
[obd.elm327] write: 'ATZ\r'
[obd.elm327] ATL0 did not return 'OK'
[obd.obd] Closing connection
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
Traceback (most recent call last):
File "Test.py", line 32, in
for i in commands_list:
NameError: name 'commands_list' is not defined
pi@raspberrypi:~/Project $ python Test.py /dev/rfcomm0
['/dev/rfcomm0']
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/rfcomm0']
[obd.obd] Attempting to use port: /dev/rfcomm0
[obd.elm327] Initializing ELM327: PORT=/dev/rfcomm0 BAUD=38400 PROTOCOL=auto
[obd.elm327] write: 'ATZ\r'
[obd.elm327] wait: 1 seconds
[obd.elm327] read: b'\r\rELM327 v1.5\r\r>'
[obd.elm327] write: 'ATE0\r'
[obd.elm327] read: b'ATE0\rOK\r\r>'
[obd.elm327] write: 'ATH1\r'
[obd.elm327] read: b'OK\r\r>'
[obd.elm327] write: 'ATL0\r'
[obd.elm327] read: b'OK\r\r'
[obd.elm327] write: 'AT RV\r'
[obd.elm327] read: b'>'
[obd.elm327] closing port
[obd.elm327] write: 'ATZ\r'
[obd.elm327] No answer from 'AT RV'
[obd.obd] Closing connection
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
Traceback (most recent call last):
File "Test.py", line 32, in
for i in commands_list:
NameError: name 'commands_list' is not defined
pi@raspberrypi:~/Project $ python3 Test.py /dev/rfcomm0
['/dev/rfcomm0']
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/rfcomm0']
[obd.obd] Attempting to use port: /dev/rfcomm0
[obd.elm327] Initializing ELM327: PORT=/dev/rfcomm0 BAUD=38400 PROTOCOL=auto
[obd.elm327] write: b'ATZ\r'
[obd.elm327] wait: 1 seconds
[obd.elm327] read: b'\r\rELM327 v1.5\r\r>'
[obd.elm327] write: b'ATE0\r'
[obd.elm327] read: b'ATE0\rOK\r\r>'
[obd.elm327] write: b'ATH1\r'
[obd.elm327] read: b'OK\r\r>'
[obd.elm327] write: b'ATL0\r'
[obd.elm327] read: b'OK\r\r>'
[obd.elm327] write: b'AT RV\r'
[obd.elm327] read: b'14.5V\r\r>'
[obd.elm327] write: b'ATSP0\r'
[obd.elm327] read: b'OK\r'
[obd.elm327] write: b'0100\r'
[obd.elm327] read: b'\r>'
[obd.elm327] write: b'ATDPN\r'
[obd.elm327] read: b'SEARCHING...\r7E8 06 41 00 BE 3D A8 13 \r\r>'
[obd.elm327] Failed to retrieve current protocol
[obd.elm327] Adapter connected, but the ignition is off
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
Traceback (most recent call last):
File "Test.py", line 32, in
for i in commands_list:
NameError: name 'commands_list' is not defined
pi@raspberrypi:~/Project $ python Test.py
Traceback (most recent call last):
File "Test.py", line 10, in
connection=obd.OBD(sys.argv[1])
IndexError: list index out of range
pi@raspberrypi:~/Project $ python Test.py
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Explicit port defined
[obd.elm327] Initializing ELM327: PORT=Test.py BAUD=auto PROTOCOL=auto
[obd.elm327] Could not configure port: (25, 'Inappropriate ioctl for device')
[obd.obd] Closing connection
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
Not Connected
[obd.obd] Query failed, no connection available
None
['/dev/rfcomm0']
[obd.obd] ======================= python-OBD (v0.7.1) =======================
[obd.obd] Using scan_serial to select port
[obd.obd] Available ports: ['/dev/rfcomm0']
[obd.obd] Attempting to use port: /dev/rfcomm0
[obd.elm327] Initializing ELM327: PORT=/dev/rfcomm0 BAUD=38400 PROTOCOL=auto
[obd.elm327] write: 'ATZ\r'
[obd.elm327] wait: 1 seconds
[obd.elm327] read: b'\r\rELM327 v1.5\r\r>'
[obd.elm327] write: 'ATE0\r'
[obd.elm327] read: b'ATE0\rOK\r\r>'
[obd.elm327] write: 'ATH1\r'
[obd.elm327] read: b'OK\r\r>'
[obd.elm327] write: 'ATL0\r'
[obd.elm327] read: b'OK\r\r>'
[obd.elm327] write: 'AT RV\r'
[obd.elm327] read: b'14.4V\r\r>'
[obd.elm327] write: 'ATSP0\r'
[obd.elm327] read: b'OK\r\r'
[obd.elm327] write: '0100\r'
[obd.elm327] read: b'>'
[obd.elm327] write: 'ATDPN\r'
[obd.elm327] read: b'SEARCHING...\r7E8 06 41 00 BE 3D A8 13 \r\r>'
[obd.elm327] Failed to retrieve current protocol
[obd.elm327] Adapter connected, but the ignition is off
[obd.obd] Cannot load commands: No connection to car
[obd.obd] ===================================================================
Traceback (most recent call last):
File "Test.py", line 32, in
for i in commands_list:
NameError: name 'commands_list' is not defined