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

Set GPIO shutdown pin dynamically based on detecting a photo module. #194

Open
dadr opened this issue Jun 12, 2021 · 2 comments
Open

Set GPIO shutdown pin dynamically based on detecting a photo module. #194

dadr opened this issue Jun 12, 2021 · 2 comments

Comments

@dadr
Copy link
Contributor

dadr commented Jun 12, 2021

Photoframe had pin 37 (GPIO 26) used for shutdown, but then the default was changed to pin 5 (GPIO 3) because that one can also restart a halted system. But, pin 3 conflicts with the color module i2c bus. As I was updating the readme to explain this, it occurred to me that it should be possible to try to detect the photo module first, and then default the shutdown to GPIO 3 or 26 accordingly.

@mrworf
Copy link
Owner

mrworf commented Aug 6, 2021

The issue is that it will make it less deterministic. However, it seems that development of Rasbian has added some cool stuff, including multiple i2c buses :) See https://www.instructables.com/Raspberry-PI-Multiple-I2c-Devices/ so it might be doable to use another i2c bus and free up GPIO3 to be used for on/off and not having to pick one or the other. Have yet to try it myself though

@dadr
Copy link
Contributor Author

dadr commented Aug 6, 2021

That's a very interesting link. Given this capability really works, I think it makes sense to use GPIO3 (pin 5) for on/off. I've been planning to use GPIO18 (pin 12) for PWM to change brightness on LCD inverters. (Just haven't gotten around to doing that yet ;-) So maybe use GPIO 17 for SDA and 27 for SCL (Pins 13 & 15) for the photo module, and make that bus 3. We could also set up GPIO 23 for SDA and 24 for SCL on a bus 4 to potentially support some additional device with duplicate address (or not). I had also intended to try adding a temperature and humidity module, but I think that it can share the bus with the photo module. Lastly, for completeness, I enable i2C-2 in order to talk to monitors that can adjust brightness and color temp. It does not interfere with the above, but the bus does get exposed to the OS - where the default is not.

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