Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    I2C interface

    Scheduled Pinned Locked Moved LoPy
    lopy connectioni2cd6f-phdiff pressure
    5 Posts 2 Posters 2.1k Views 2 Watching
    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.
    • E Offline
      epage Pybytes Beta
      last edited by

      I'm currently use the differential pressure sensor D6F-PH from OMRON with my LOPY. Unfortunatly It seems there's no driver for this sensor. And the data sheet seems indistinct for this purpose.
      any help ?

      L 1 Reply Last reply Reply Quote 0
      • L Offline
        livius @epage
        last edited by livius

        @epage said in I2C interface:

        D6F-PH

        it is i2c based and because of that it is simple to use
        https://www.omron.com/ecb/products/sensor/special/mems/pdf/AN-D6F-PH-01EN_r1.pdf
        look into this thread

        https://forum.arduino.cc/index.php?topic=285116.0
        you must only convert code to micropython which is also quite simple
        https://docs.pycom.io/pycom_esp32/library/machine.I2C.html

        and real sample
        https://docs.pycom.io/pycom_esp32/pycom_esp32/tutorial/includes/i2c.html

        think about people first, then computers

        1 Reply Last reply Reply Quote 0
        • E Offline
          epage Pybytes Beta
          last edited by

          Thanks a lot ... but
          my initialization code for instance based on ARDUINO example :

          def initialize ():

          #INITIALIZATION AFTER POWER UP
          i2c = I2C(0, I2C.MASTER)             # create and init as a master
          #i2c.init(I2C.MASTER)
          # configure the I2C bus
          i2c.init(I2C.MASTER, baudrate=400000) # init as a master
          i2c.writeto(0x6C, 0x0B) 
          i2c.writeto(0x6C, 0x00)
          print ("Initialization done: ")
          

          give me :
          TypeError: object with buffer protocol required for this line :
          i2c.writeto(0x6C, 0x0B)
          I don't understand.. what's the correct instruction ?
          Thanks for help

          L 1 Reply Last reply Reply Quote 0
          • L Offline
            livius @epage
            last edited by livius

            @epage
            you must pass bytes

            i2c.writeto(0x6C, bytes([0x0B]))
            

            think about people first, then computers

            1 Reply Last reply Reply Quote 0
            • E Offline
              epage Pybytes Beta
              last edited by

              Thanks a lot !
              Now I must translate ARDUINO code

              1 Reply Last reply Reply Quote 0

              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
              • 1 / 1
              • First post
                Last post

              Pycom on Twitter

              Pycom