Giter Club home page Giter Club logo

micropython-mpu9x50's People

Contributors

jonathanfoster avatar peterhinch avatar turbinenreiter avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

micropython-mpu9x50's Issues

MPU exception during startup with RPi Pico

Hardware: Raspberry Pi Pico, MPU-6050

Error message:
Traceback (most recent call last):
File "", line 33, in
File "imu.py", line 105, in init
File "imu.py", line 159, in chip_id
MPUException: I2C failure when communicating with IMU

Suspected bug is in _read() class function. Why try cell is not used in chip_id, following error message is recorded:
Traceback (most recent call last):
File "", line 33, in
File "imu.py", line 105, in init
File "imu.py", line 157, in chip_id
File "imu.py", line 117, in _read
OSError: [Errno 5] EIO

Not sure if issue is with hardware or code

Lopy Migration

Hi
I have done the Lopy porting on my fork but i see acceleration at zero values all the time
any suggestion ?

Random KeyboardInterrupt and ASCII disco

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "main.py", line 43, in run
  File "/lib/uasyncio/core.py", line 155, in run_forever
  File "/lib/uasyncio/core.py", line 110, in run_forever
  File "main.py", line 33, in send_data
  File "main.py", line 24, in get_data
  File "vector3d.py", line 103, in xyz
  File "imu.py", line 395, in _accel_callback
  File "imu.py", line 312, in accel_range
KeyboardInterrupt: 
>>> KK3K3K<lKlKlKKK3K3K<lKlKlKK<3K3K3K3lK<KK<KK3K3K<lKxKlKKK3K3K<lKlKlKK<,K3K3K3KlK<KK<KK3K3K<lKKHKK3KK<lKlKlKK<,K3K3K3KlK<KK<KK3K3K<lKlKlKK3K3K<lKlK

So this is a fun little thing. I'm running on an ESP32 and have a fast loop calling all sensor values of the MPU9265 (which is yet another version of the chip). Every once in a while, execution stops with above Traceback.

Anyone ever seen anything like this?

The line in the code where this happens is:

@property
def accel_range(self):
 """
Accelerometer range
Value:              0   1   2   3
for range +/-:      2   4   8   16  g
 """
    try:
        self._read(self.buf1, 0x1C, self.mpu_addr)
        ari = self.buf1[0] // 8 # this line throws up
    except OSError:
        raise MPUException(self._I2Cerror)

    return ari

I think this is gonna be a fun one.

/edit: It actually happens at random parts in the code.

INT pin?

ANy suggestions how to use this library utilising INT pin on MPU 9250?
I would like to use Motion Detection notifications - how can I receive them?
image

Adding support for FIFO buffer

The MPU family has a built-in 1024 FIFO which can be set up to read in data from the thermometer, gyroscopes, and accelerometer.

I've been working on building support for that feature, but don't know the ins and outs of memory management or this module yet, so I'd figured I'd mention the project here in case anyone wants to help.

Working branch here.

imu.py: Cant convert str to int

Hello,

I try to use the MP6050 with the Pico so I use the file "imu.py", which i renamend to "mpu6050.py" on my pico.
When I create a new object with: "mpu = MPU6050('x')" I get the error "cant convert str to int" on the 83th line.
When I the use thsi command: "mpu = MPU6050(1)". So I replace the sring with an int, I get the error: "Invalid I2C instance"
What value do I have to enter there?

i can't use mpu6050 by ur module as the demo.

ๅ›พ็‰‡
i had tested the the code:
`from imu import MPU6050

imu = MPU6050('Y')
print(imu.accel.xyz)
print(imu.gyro.xyz)
print(imu.temperature)
print(imu.accel.z)`
i connnected "X9" and "X10" for "SCL" and ""SDA".
but always :MPUException: I2C failure when communicating with IMU.
Thank you for help!

is DMP support?

if using DPM, derectory read quaternion numbers.
will it be supported?

Porting to ESP32 anyone?

Hi
I was about to write my own implementation for the mpu6050 and 9250, when I came across this nice library :)

As the title says, anyone working on a port to the esp32. Maybe a port to esp8266? Guess that would work on the esp32 too.

Side note. Anyone tested this on the mpu6050 for the accelerometer / gyro ?

Filter for magnetometer

I am trying to do some distance calculations for this project using the magnetometer.

But i always get a stale magnetic interference when the sensor is stationary.
I have tried several moving average algorithms. They improved the overall signal quite a bit.

But its still nowhere near what the project requires.

I have tried several magnets. Neodymium, speaker magnets, varying from little to high intensity and i am getting similar results..

Can you advise me on how can I implement a filter?

MPU9255 support?

Excuse me,have you test whether it would work on MPU9255 or not?sry4my poor English...

Tilt Angle Question

Is there any easy way to quickly obtain the tilt angle of the sensor? Or just lots of manual calculations?

I'm a little new to this stuff, so apologies if this is a dumb question...

How fast we can read data from the sensor

A lot of example that i saw always using the sleep function on each reading, is it possible to not using the sleep function?, and if it is necessary to use, what is the shortest time to sleep?.

BTW, I am using mp6050 with class MPU6050 in imu.py file

Bad chip ID retrieved with MPU-9250/6500

I'm using an MPU-9250/6500 and I get a "Bad chip ID retrieved: MPU communication failure" ValueError after initialization. My sensors chip ID is 0x73, but the MPU9250 class chip ID is set to 0x71.

I was able to work around the issue by simply setting the class chip ID before initialization.

MPU9250._chip_id = 0x73
imu = MPU9250(i2c)

The MPU-9250 register map does in fact list 0x71 as the default value for WHOAMI (see page 44), but there appears to be another variant of the sensor, the MPU-9255, that return 0x73 instead (page 44 of the MPU-9255 register map).

The real problem is I've got a MPU-9255 that's stamped as MPU-9250/6500. It appears others have run into the same issue as well (see miniben-90/mpu9250#13 and kriswiner/MPU9250#47).

It would be easy to make chip ID an init parameter, create a MPU9255 class, or just remove the exception from being thrown all together. I'm happy to submit a PR if either approach would work.

Magnetometer wrong values and freezes esp32

HI. I'm back :-)

I've started testing with the mpu9250. Both the standard 9DOF and the newer 10DOF.

The x and z values for the mag vector is frozen. They might very rarely make a blip, but then right back to the frozen value.

i2c = I2C(-1, scl, sda, freq=400000)

imu = MPU9250(i2c)

sens = imu.sensors
while True:
     print(sens[2].xyz)
     print("mag_stale_count: {}".format(imu.mag_stale_count))
     utime.sleep_ms(200)

yields this result when I'm constantly moving the sensors around

(-0.1869141, -14.58692, 0.2244141)
mag_stale_count: 0
(-0.1869141, -14.58692, 0.2244141)
mag_stale_count: 1
(-0.1869141, -7.405664, 0.2244141)
mag_stale_count: 0
(-0.1869141, -3.815039, 0.2244141)
mag_stale_count: 0
(-0.1869141, -3.815039, 0.2244141)
mag_stale_count: 1
(-0.1869141, -14.58692, 0.2244141)
mag_stale_count: 0
(-0.1869141, -46.90254, 0.2244141)
mag_stale_count: 0
(-0.1869141, -7.405664, 0.2244141)
mag_stale_count: 0
(-0.1869141, -7.405664, 0.2244141)
mag_stale_count: 0
(-0.1869141, -29.39824, 0.2244141)
mag_stale_count: 0
(-0.1869141, -7.405664, 0.2244141)
mag_stale_count: 0
(-0.1869141, -3.815039, 0.2244141)
mag_stale_count: 0
(-0.1869141, -3.815039, 0.2244141)
mag_stale_count: 0

The newer mpu9250 10DOF freezes randomly for a few seconds every 30 - 60 seconds or something like that.

Manually calling the

imu.mag.xyz

over and over again, yields the same result.

Have it running in C on an Arduino uno, and have no problems, so both sensors seems okay.

What am I doing wrong here?

Error while using imu.py on Pi Pico

Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "mpu6050.py", line 84, in __init__
TypeError: can't convert str to int

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.