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

    function removed from LIS2HH12.py library module

    Scheduled Pinned Locked Moved Discussion
    pytracklibrarylis2hh12 accele
    5 Posts 3 Posters 1.3k Views 3 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.
    • M Offline
      mrainone
      last edited by

      I'm Marco Rainone, collaborator of the Wireless laboratory of the Institute of Theoretical Physics of Trieste.
      In October I created a micropython program for a sensor project that uses the lopy with the pytrack board.
      For the management of the accelerometer I used the LIS2HH12.py library module that I downloaded on September 29th.
      Yesterday I made some changes to the software I had developed, and on the occasion from your site on github I downloaded the latest versions of pytrack library modules (including LIS2HH12.py) and updated the firmware on the lopy and on the pytrack.

      I realized that my program crashed with an error generated by this situation:
      comparing the version of the LIS2HH12.py module dated September 27th with the most recent version of February 20th, I verified that the yaw function (rotation calc)
      was removed in the LIS2HH12 class
      def yaw (self):
      div = math.sqrt (math.pow (self.x [0], 2) + math.pow (self.z [0], 2))
      if div == 0:
      div = 0.01
      return (180 / 3.14154) * math.atan (self.y [0] / div)

      Why the jaw function has been removed from the latest versions of the LIS2HH12.py library module?
      Can the version of LIS2HH12.py of September 27th (with the jaw function) still be used if the pytrack or pysense cards are updated with the latest firmware?

      sebS 1 Reply Last reply Reply Quote 0
      • sebS Offline
        seb @mrainone
        last edited by

        @mrainone

        The reason the yaw function was removed is due to the fact that it is not possible to measure yaw with just an accelerometer. The accelerometer measures the force of gravity to determine orientation but when rotating the accelerometer in the yaw access, the force of gravity does not change because the direction of gravity is in the same axis as the yaw axis

        1 Reply Last reply Reply Quote 0
        • M Offline
          mrainone
          last edited by

          thanks for the quick reply.
          Fortunately, my application is limited to perform the yaw log, without further processing.
          In case I had to update my sensor with lopy and pytrack to acquire a reliable value of the yaw parameter, I could process the data of the pytrack accelerometer together with those of a magnetometer connected externally to the lopy.
          Is it a viable solution?

          If the solution is correct, can you recommend a low cost magnetometer to connect to the lopy through the pytrack and where can I connect on the board by reducing the interface hw?

          sebS L 2 Replies Last reply Reply Quote 0
          • sebS Offline
            seb @mrainone
            last edited by

            @mrainone

            In the past I have been successful in connecting a magnetometer (https://www.sparkfun.com/products/13762) to a pytrack to get yaw measurements. I used this library: https://github.com/micropython-IMU/micropython-mpu9x50 and connected the board to the the Pytrack via the external IO header (SDA='P8'=Pin 10 of the external header, 'SCL=P4'=Pin 9 of the external header).

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

              @mrainone said in function removed from LIS2HH12.py library module:

              can you recommend a low cost magnetometer to connect to the lopy

              I use simple GY-271 (HMC5883L)
              It working fine for me and is cheap

              think about people first, then computers

              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