USB Error reading: [Errno 13] Access denied (insufficient permissions)
I am unfortunately inexperienced with lx and python usb so might be something obvious to others.
When starting the HY1361 is discovered as "That mysterious volume meter darksider did buy sound meter detected (Vendor 0x1a86, Product 0x7523)" (autodetected) but then I get this error:
USB Error reading: [Errno 13] Access denied (insufficient permissions)
on the Raspi5 (on Bookworm, meter connected to Bus 003 Device 002: ID 1a86:7523 QinHeng Electronics CH340 serial converter.
Any hints how to get it working?
(also tried the docker setup with similar error - I assume the error is system related)
Regards, Adi
Hi @adibu did you find a solution in the end yourself? I'm experiencing the same error. Python is able to open the serial port and is in the dialout group, but nevertheless the permission error persists.
2025-05-30 19:54:44,465 - INFO - Detected specified device: That mysterious volume meter darksider did buy (Vendor 0x1a86, Product 0x7523) 2025-05-30 19:54:44,466 - INFO - Starting Noise Monitoring on USB device. 2025-05-30 19:54:44,471 - INFO - Detected specified device: That mysterious volume meter darksider did buy (Vendor 0x1a86, Product 0x7523) 2025-05-30 19:54:44,472 - INFO - Noise monitoring on USB device. 2025-05-30 19:54:44,473 - ERROR - USB Error reading: [Errno 13] Access denied (insufficient permissions) 2025-05-30 19:54:44,475 - INFO - Detected specified device: That mysterious volume meter darksider did buy (Vendor 0x1a86, Product 0x7523) 2025-05-30 19:54:44,476 - INFO - Reconnected to USB device. 2025-05-30 19:54:44,578 - ERROR - USB Error reading: [Errno 13] Access denied (insufficient permissions) 2025-05-30 19:54:44,579 - INFO - Detected specified device: That mysterious volume meter darksider did buy (Vendor 0x1a86, Product 0x7523) 2025-05-30 19:54:44,581 - INFO - Reconnected to USB device.
After adding a UDEV rule (SUBSYSTEM=="usb", ATTR{idVendor}=="1a86", ATTR{idProduct}=="7523", MODE="0666", GROUP="plugdev") to
sudo nano /etc/udev/rules.d/50-ch340-libusb.rules
sudo udevadm control --reload-rules
sudo udevadm trigger
And replugging the device, it shows
2025-05-30 22:32:09,873 - INFO - Detected specified device: That mysterious volume meter darksider did buy (Vendor 0x1a86, Product 0x7523) 2025-05-30 22:32:09,874 - INFO - Reconnected to USB device. 2025-05-30 22:32:09,976 - ERROR - USB Error reading: [Errno 32] Pipe error
Just for debugging purposes, I was able to get readings with this (simple) code.
import serial
import time
import struct
class HY1361:
def __init__(self, port='/dev/ttyUSB0'):
try:
self.ser = serial.Serial(
port=port,
baudrate=115200,
bytesize=8,
parity='N',
stopbits=1,
timeout=1
)
print(f"Connected to HY1361 on {port}")
except serial.SerialException as e:
print("Serial connection error:", e)
exit(1)
def read_packet(self):
while True:
byte = self.ser.read(1)
if byte == b'\x55': # Start byte
frame = byte + self.ser.read(5)
if len(frame) == 6 and frame[5] == 0xAA:
value = struct.unpack('<H', frame[2:4])[0]
return value / 10.0
else:
print(f"Invalid packet: {frame.hex()}")
else:
continue
if __name__ == "__main__":
meter = HY1361()
try:
while True:
spl = meter.read_packet()
print(f"Sound Level: {spl:.1f} dB")
time.sleep(0.2)
except KeyboardInterrupt:
print("Exiting...")
Output:
pi@pi3b:~ $ sudo python hy1361.py
Connected to HY1361 on /dev/ttyUSB0
Sound Level: 37.9 dB
Sound Level: 41.5 dB
Sound Level: 41.5 dB
Sound Level: 41.5 dB
Sound Level: 44.0 dB