function removed from LIS2HH12.py library module



  • 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?



  • @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



  • @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).



  • 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?



  • @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



Pycom on Twitter