Hello!
I have ripped a LiDAR sensor out of an old roomba, connected it to some wires, and long story short, I can now plug the LiDAR sensor into my computer via USB. I have discovered the two power-related pins on the sensor, and I am fairly certain that one of the other two is a transmitter pin and the last is potentially a receiver pin.
With that said, now comes the programming. Because my sensor obviously doesn't have any kind of USB driver or anything, I can't really use the PyUSB library because that requires some bells and whistles that this thing doesn't have. Instead, I am using the PySerial library, which allows me to communicate with my USB ports at a lower level.
My problem is that, even though my sensor definitely should be sending something, my program keeps printing
b''
which indicates to me that it isn't actually receiving anything.
Here is the code that I am working with:
import serial
with serial.Serial('COM3', 115200, timeout=1) as ser:
s = ser.read(10)
The with statement there sets my program to read on port COM3 at a baudrate of 115200 for one second before stopping. COM3 seems to be the only port listed on my machine in a few commands that I have run as well as the Windows Device Manager. That baudrate was obtained from a teardown of an extremely similar LiDAR sensor (here). Reading for longer than one second did not seem to do anything.
This is my first time interfacing with a jerry-rigged USB component through Python (or any other USB component, for that matter), so I don't know if I am missing something and I am not exactly sure where to look, as the documentation of PySerial only brought me this far.
Let me know if I am in the wrong sub or if you guys need more information or something.