michalrus / pms5003

PMS5003 air quality sensor data grabbing in C, to JSON, on Linux, with averaging over time
Apache License 2.0
11 stars 5 forks source link

No data frames transferring. #2

Open shapeshifterincontext opened 3 years ago

shapeshifterincontext commented 3 years ago

Hello, I've hit upon a problem.

Initially I had it plugged in through a USB hub, so I changed that to directly into the tower, trying both a USB3 & USB2 ports. All giving the same result.

$ ./pms5003 /dev/ttyUSB0 ^C

$ time ./pms5003 /dev/ttyUSB0 10 warning: no data frames collected in the given time span.

real 0m10.003s user 0m0.003s sys 0m0.000s

michalrus commented 3 years ago

Hmmm, interesting, it still works for me.

Are you sure it’s really ttyUSB0? I would run dmesg -w hit a few enters, and then connect the device to see which /dev/* file it’ll be assigned.

If it’s really ttyUSB0, then… do other solutions for PMS5003 work for you, just not this one?

Also maybe you don’t have permissions to read from ttyUSB0? Can you show me the output of stat /dev/ttyUSB0?

Cheers and good luck!

shapeshifterincontext commented 3 years ago

I have no idea where I am going wrong. After you noting that permission may be the issue, I did some digging, and it appears to be an extremely common thing. I have tried all sorts of solutions but nothing has worked.

stat /dev/ttyUSB0 File: /dev/ttyUSB0 Size: 0 Blocks: 0 IO Block: 4096 character special file Device: 6h/6d Inode: 45635 Links: 1 Device type: bc,0 Access: (0666/crw-rw-rw-) Uid: ( 0/ root) Gid: ( 20/ dialout) Access: 2021-02-02 23:45:03.952766838 +1100 Modify: 2021-02-02 23:45:03.952766838 +1100 Change: 2021-02-02 23:45:03.952766838 +1100 Birth: -

michalrus commented 3 years ago

Okay, 0666 looks OK.

How are you making sure it’s really /dev/ttyUSB0? Do you have other devices?

Like I wrote:

Are you sure it’s really ttyUSB0? I would run dmesg -w hit a few enters, and then connect the device to see which /dev/* file it’ll be assigned.

Rekihyt commented 2 years ago

Check that you have terminal over serial disabled but serial enabled with raspi-config