micropython-imu / micropython-mpu9x50 Goto Github PK
View Code? Open in Web Editor NEWDrivers for InvenSense inertial measurement units MPU9250, MPU9150, MPU6050
License: MIT License
Drivers for InvenSense inertial measurement units MPU9250, MPU9150, MPU6050
License: MIT License
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...
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
Hi
I have done the Lopy porting on my fork but i see acceleration at zero values all the time
any suggestion ?
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
Traceback (most recent call last):
File "", line 22, in
File "mpu9250.py", line 19, in init
File "imu.py", line 174, in init
TypeError: can't convert str to int
Hi!
the link to drotek for the breakout board is down..
Is this the correct breakout board for your driver?
https://www.amazon.com/Mpu-9250-Nine-axis-Attitude-Acceleration-Magnetic/dp/B00OPNUO9U/ref=sr_1_1?ie=UTF8&qid=1490347200&sr=8-1&keywords=mpu9250
thanks!
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
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 ?
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.
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?
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.
if using DPM, derectory read quaternion numbers.
will it be supported?
missing pyb import when run test code.
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?
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.
I am using MPU-9250/6500 and managed to get the filtered pitch and roll data just fine. But when I tried to calculate the yaw using the below yaw calculation at https://engineering.stackexchange.com/questions/3348/calculating-pitch-yaw-and-roll-from-mag-acc-and-gyro-data
yaw = 180 * atan (accelerationZ/sqrt(accelerationX*accelerationX + accelerationZ*accelerationZ))/M_PI;
The returned value seemed to be a bit random? Any idea?
Hello,
I found a Arduino library which can read from the onboard DMP. Could anyone who has the knowledge to convert it to mycropython?
https://github.com/jrowberg/i2cdevlib
thx
Excuse me,have you test whether it would work on MPU9255 or not?sry4my poor English...
How can I get over this error?
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.