-
Notifications
You must be signed in to change notification settings - Fork 159
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
Do not poll PCF8574/5, just use pin 13 (INT) #294
Comments
Hmmm, even reading 1 RPi GPIO port is done by polling AFAICS, according to the CPU power that is used :-( Richard. |
Another thing: the bits are inverted for a PCF8574, according to the datasheet:
sets bit7 at pin 12. R. |
I put an INT version for Raspberry Pi 3B here: https://xaq.nl/read-pcf/index.html Just my 2 cts, R. |
Interrupt for pcf8574/5 is supported by mqtt-io. Use a GPIO of the Raspberry (native support for interrupts) and connect it to the INT line of the PCF. Since the Raspberry's GPIO supports interrupts, it polls all your PCF's Inputs after detecting a change. Needs special configuratio of the Raspberry GPIO input: https://mqtt-io.app/2.2.9-gamma/#/config/reference/digital_inputs/?id=digital_inputs-star-interrupt_for |
I have always found this a very very particular and amazing issue on the internet concerning the I/O expanders PCF8574 and PCF8575: nobody, but really nobody uses the interrupt lines (pin 13) of the PCF I/O expander. The INT is an open collector interrupt line (use a pull-up resistor). When serializing devices (up to 16 devices using the P and AP versions), just put all pin 13 outputs together and wait until INT goes down. When this happens, one or more of the chips detected a change on one or more of its inputs!
Then, start to read the first PCF, the second etc until the INT goes up again, then you have read all new states, the rest is not necessary as there has been no change on these devices (INT isn't pulled down anymore).
I justed installed mqtt-io and I saw python3 consuming up to 5% of CPU power for just nothing. Polling a PCF8574 and PCF8575 24 hours a day is just stupid.
I have no experience in writing python scripts, so I won't be a great contributor, but if anyone can help in realizing this that would be nice!
Richard.
The text was updated successfully, but these errors were encountered: