I connected a 16-pin OBD to the micro-usb in my Raspberry Pi Zero-W. When I use minicom to open /dev/ttyS0, I do not see any data. Do you know what port I should use? The OBD has 16 pins and definitely is providing data.
/dev/ttyS0 is normally the serial console port.
I would expect the USB port to create a /dev/ttyUSBx where x is a digit - normally 0
You can check by running
before and after plugging the device in or looking at the end of /var/log/messages possibly with
tail as you plug it in.
Note: See the official documentation here for details on ttyS0 and ttyAMA0 swapping around...
I connected a 16-pin OBD to the micro-usb
I'm assuming you mean via a USB OBD-II connector—I hope you didn't pick a few wires in the OBD-II connector and hook them directly up to the USB data lines :).
OBD-II primarily uses CAN. CAN usually isn't exposed as a serial device, as that's not what CAN is. If your adapter does expose itself as a serial device (which some apparently do), you'll see it if you run
ls -l /dev/serial/by-id (or you'll get a file-not-found error if it doesn't). If it does appear like that, you still may not be able to just read data from it—you may need to ask it for data first. Try python-can, which claims to support CAN over serial.
Otherwise, you'll need to use Linux's Socket-CAN. If Linux detects your adapter as a CAN bus driver, you'll see something like
can0 in the output of the following commands:
# You may not need the next 2 commands sudo modprobe can sudo modprobe can-raw ip link
If that worked, you can use something like python-can to interact with it, or run
sudo apt install can-utils and
sudo ip link set can0 up type can bitrate 1000000 (replace
can0 with what showed up if different). Run
sudo candump any to show all CAN messages.
Otherwise, try running
sudo dmesg -w while plugging in the device. See if it mentions any filenames or any errors. If you still can't figure it out, post the logs that appear when plugging the device in.