• Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Accessing I2C devices via EVOK API

    Official EVOK API
    2
    5
    60
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      mglowinski last edited by

      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 -- -- -- -- -- -- UU 
      
      

      I 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

      1 Reply Last reply Reply Quote 0
      • M
        martin_triska administrators last edited by

        Hello @mglowinski,

        unfortunately, there is no fully-generic way to access I2C devices (e.g. sensor) from Evok.

        1 Reply Last reply Reply Quote 0
        • M
          mglowinski last edited by

          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?

          1 Reply Last reply Reply Quote 0
          • M
            martin_triska administrators last edited by

            Hello @mglowinski,

            there should not be any problem. I2C devices on the same bus can be accessed from multiple processes (apps or kernel modules).

            1 Reply Last reply Reply Quote 0
            • M
              mglowinski last edited by

              @martin_triska,
              thx for a tip. Indeed it worked quite well:)

              1 Reply Last reply Reply Quote 0
              • First post
                Last post