0

I have an OBD simulator connected to serial port of my raspberry pi. So I am just trying to read any response from the device. The commands are a bit different than the standard OBD commands. So I write a basic code like this:

import serial

ser=serial.Serial('/dev/ttyS0', 115200, timeout = 1)
ser.write(b"SI\r")

while True:
        response = ser.readline()
        print ("read data:", response)

But the only output is an empty bit data : b' '

I am also not sure that ttyS0 is the correct port or not. There is also ttyAMA0 port but the output is still b' '.

Any advice is appreciated.

  • Should the `ser.write(b"SI\r")` also be in the loop, along with a delay so you don't overload the simulator? – quamrana Mar 06 '20 at 11:05
  • Tried but still no data. I believe that there is a problem with the writing process cause otherwise I would be able to read an error message. – Esat İnce Mar 06 '20 at 11:14
  • How do you physically connect your simulator to your raspberry pi? You should be able to list all serial ports. Just try them all! – quamrana Mar 06 '20 at 11:32
  • I am using an OBD cable, the board I use has an OBD header. There is only two serial ports on pi and I already used them both and cannot read any data. – Esat İnce Mar 07 '20 at 07:45
  • Are there any other devices you can connect your rpi to in order to test that the rpi can both send and receive? (I assume you have the wiring correct and the same baud rates) – quamrana Mar 07 '20 at 09:03

0 Answers0