Accessing I2C devices via EVOK API
-
Hi,
Is there possibility to get access to data from sensors connected to I2C via EVOK API?Let's say I've connected BH1750 (luminosity sensor) via RJ11 I2C interface with UniPi 1.1
pi@raspberry:/mnt/ $ i2cdetect -y 1 0 1 2 3 4 5 6 7 8 9 a b c d e f 00: -- -- -- -- -- -- -- -- -- -- -- -- -- 10: -- -- -- -- -- -- -- -- 18 -- -- -- -- -- -- -- 20: 20 -- -- 23 -- -- -- -- -- -- -- -- -- -- -- -- 30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 50: 50 -- -- -- -- -- -- 57 -- -- -- -- -- -- -- -- 60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- UUI can see it is detected (address 23), but i don't know how i can pass measurement from it via EVOK API.
There is Python code, which allowed me to get measurement from BH1750 sensor: http://www.pibits.net/code/raspberry-pi-bh1750-light-sensor.php
How i can ask/request measurement from this sensor via EVOK API?
Regards,
Mateusz Głowiński -
Hello @mglowinski,
unfortunately, there is no fully-generic way to access I2C devices (e.g. sensor) from Evok.
-
ok, so another question.
I know UniPi 1.1 is using I2C for controlling peripheral devices.
Will I not break/block anything within EVOK functionality, If I use smbus library (https://github.com/pimoroni/py-smbus) in python script?In other words, I've connected BH1750 sensor to I2C RJ11 on UniPi 1.1. Now I want to prepare python script, which will handle communication with this sensor. Can I simply use code on http://www.pibits.net/code/raspberry-pi-bh1750-light-sensor.php without having impact on EVOK?
-
Hello @mglowinski,
there should not be any problem. I2C devices on the same bus can be accessed from multiple processes (apps or kernel modules).
-
@martin_triska,
thx for a tip. Indeed it worked quite well:)
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login