Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use multiple readers? #5

Open
KHungs opened this issue Nov 29, 2023 · 3 comments
Open

Is it possible to use multiple readers? #5

KHungs opened this issue Nov 29, 2023 · 3 comments

Comments

@KHungs
Copy link

KHungs commented Nov 29, 2023

Hello,
first of all: thanks for your work! It works really well with one reader. I'm wondering if it would work with a second reader on different GPIOs? Will it create problems if two card readings happen at the same time? Can I prevent those problems somehow?

@gkovacs81
Copy link
Contributor

Hi, Sorry for the late reply!
I've never tried, but you can define the GPIO pins for the reader and can create multiple readers.
Based on that it should be possible to read multiple keypads.

wr1 = WiegandReader(1, 2)
wr2 = WiegandReader(11,12)

wr1.read()
wr2.read()

I think this should work without any conflict.

@KHungs
Copy link
Author

KHungs commented Dec 31, 2023

I actually tried. In theory it worked. But for whatever reason I always had some random pending bits on reader 2 if I scanned the transponder on reader 1 and vice versa. I was able to just throw those bits away in the script but also my pi's cpu usage was always between 100% and 150% when I instanciated two instances of the WiegandReader object. I figured that could not be healthy for the pi and since I have no clue about the cpp side of your code I just got second pi for a second door.

@gkovacs81
Copy link
Contributor

I tried to execute 3 readers but without any Wiegand device on a Raspberry Zero W 2 today (I don't have a real environment with multiple keypads).

from time import sleep
from pywiegand import WiegandReader

wr1 = WiegandReader(1,2)
wr2 = WiegandReader(3,4)
wr3 = WiegandReader(5,6)

for _ in range(30):
a = wr1.read()
b = wr2.read()
c = wr3.read()
print(f"a:{a} b:{b} c:{c}")
sleep(1)

I don't see any change on the CPU load. I went through the cpp code but I can't spot anything that is related.
For my home security system I use only one keypad. May be later when I have multiple keypads and the problem
happens I can fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants