I'm trying to connect a barcode reader on the UART of the GPIO pins of the Raspberry Pi 3B+. I've installed minicom to read the serialport and have allready added the user pi to the groups tty and dialout. I try to communicate to the barcode reader using the following command:

minicom -b 9600 -D /dev/ttyS0

The output is:

minicom: cannot open /dev/ttyS0: Permission denied

When adding sudo to the command, I can access the barcode reader, but the output doesn't seem right. When scanning the barcode 604797026269, I get the following output: Minicom output As you can see there is a lot of unknown characters and newlines which shouldn't be here. I'm sure the baud rate is right.

I also tried running the following command before starting minicom:

sudo chmod 666 /dev/ttyS0

Minicom can start now and read the barcode reader for a few minutes, before denying the access again. When scanning a barcode I get the same output as shown above.

I've also tried to connect the barcode reader to a USB port using a TTL-to-USB converter, which works fine.

Please let me know if you got some ideas to fix this problem.

  • You shouldn't change permissions on device files, here /dev/serial0. This may have unwanted side effects and may confuse the user and group management. User pi should be member of group dialout. Check with groups. – Ingo Jun 27 at 16:51
  • @Ingo, thanks for your reply. I'm sorry, I meant /dev/ttyS0 instead of /dev/serial0. User pi is member of the group dialout, so that shouldn't be the problem. – Raoul Jun 28 at 7:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.