MPU6050 with Raspberry Pi using python in easiest way | Accelerometer | Gyroscope | Temperature
ฝัง
- เผยแพร่เมื่อ 19 ก.พ. 2020
- In this video I will show you to access MPU6050 with Raspberry Pi using python to get temperature, accelerometer and gyroscope data in the easiest way.
For code and commands:
github.com/Arijit1080/mpu6050...
For future updates follow us on facebook: / sparklers2018 - วิทยาศาสตร์และเทคโนโลยี
Hi,
Can you change the sampling rate? what is the sampling rate in your video and can I go 100Hz?
hey I want to ask you please what is the software or website did you use for making the picture that shows the raspberry pi connected to the IMU ?
I want to convert acceleration series into speed series from MPU6050, what should I do? Thank you.
does it measure negative g as well? imagine driving your car an then braking.. there should be negative g.
thanks a lot bro, this was really helpful.
Excellent work 👍
Helpful 👍
What is unit of the gyroscope's output?
many thanks
If you add 5V the output , you get will be 5V data which will damage the GPIO pins of raspberry pi , better try using logic level shifter or 3.3V as source to the mpu6050
MPU6050 also works on 3.3V. To get 3.3V, there is a linear regulator on the MPU6050 PCB.
Overall, even if you are connecting 5V to MPU6050 board, the I2C signals are safe to be connected to Rpi.
Good
Thanks brother
Thanks, I was getting an error because I didn't know about i2c
Can I get the same result using an Orange pi?
Hi, the code doesn't run even tho I downloaded everything you said and ran i2c but it says ModuleNotFoundError: No module named 'mpu6050' and I don't know what to do
Use i2cdetect - y 1 and before this you must enable i2c from raspi-config
@@SPARKLERSWeAreTheMakers Okay I successfully added the library but the measurements are all wrong, it gives a constant value of 0.0622 in Z and 0 in X and Y so what do you think is wrong?
Getting below error after following all the steps shown in video:
Traceback (most recent call last):
File "mpu6050.py", line 1, in
from mpu6050 import mpu6050
File "/home/pi/mpu6050.py", line 1, in
from mpu6050 import mpu6050
ImportError: cannot import name 'mpu6050' from 'mpu6050' (/home/pi/mpu6050.py)
Can any one please help to resolve.
Try python2 mpu_6050.py
i am getting an error called "os error............ No specific info on this error"................Plzzzz help me to rectify this problem ............I need this for my final year project..............so kindly help me out .
When I enter the command i2cdetect -y 1 in the terminal I get the table off but it is not empty.
does anyone know if this is a problem ?
When I run the script I also get no values ?
My output looks like this.
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: 08 09 0a 0b 0c 0d 0e 0f
10: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f
20: 20 21 22 23 24 25 26 27 28 29 2a 2b 2c 2d 2e 2f
30: 30 31 32 33 34 35 36 37 38 39 3a 3b 3c 3d 3e 3f
40: 40 41 42 43 44 45 46 47 48 49 4a 4b 4c 4d 4e 4f
50: 50 51 52 53 54 55 56 57 58 59 5a 5b 5c 5d 5e 5f
60: 60 61 62 63 64 65 66 67 68 69 6a 6b 6c 6d 6e 6f
70: 70 71 72 73 74 75 76 77
Traceback (most recent call last): File "mpu6050.py"line 1, in from mpu6050 import mpu6050 ModuleNotFoundError : No module named ''mpu6050' Why should I got this kind of error. I did all the steps correctly.
I'm having the same problem, did you figure it out?
Maybe the file you downloaded via the terminal had been installed in the python2's folder. Try python2 mpu_6050.py instead. My problem got fixed anyway.
@@petersu8254 yay! This solved my problem, it was in python2. Thank you good sir!
Same error for me. I had to type "pip3 install mpu6050-raspberrypi" and then it worked in my editor (Thonny). When I followed the directions exactly, it only worked in my terminal window, but not my editor. Love it though. Now, to figure out how to interpret all this movement data. :)
@@whitneydesignlabs8738 Did you found how to interpret the gyroscope movements? How to classified them? Thx!
where do you click to save the code?
'x' and 'n'
Hi, my device unable to detect the sensor though green light is on. How to resolve this ?
This issue is solved by direct connecting wires from raspberry to the sensor pins. Using breadboard was creating problem.
Hi i do what u show..... works great....but... why i have 44 degrees in my livingroom ??? i am sure thats around 20....
i have pi zero w...
@@astridbreitbarth4937 It's the temperature of the chip on the sensor module, not your living room.
you do not explain how to calibrate the mpu, your statistical data is false which prevents its use. how to calibrate in raspberry/python config ? thanks
in minute 6:53 ,the step is not clear...how to run and save the code
The command broken down is: Python3 mpu_6050.py tells the terminal that it needs to run the file called mpu_6060.py using Python3. This is the same as running up your Python IDE, opening the file mpu_6060.py, then running it... but it is done here in the terminal.
I was wondering the same.
Press Ctrl+S to save, then open a new code terminal and type python3 mpu_6050.py and press the Enter key and it should execute.
If you get a "Traceback" error, check that your wires have good connection on the sensor.
Hope this helps someone!
Response seems awfully slow to me
Here's how to plot the data in real time for those interested
stackoverflow.com/questions/64092499/python-real-time-sensor-data-graphing