Hot answers tagged

3

You can implement a software I2C bus on any pair of spare GPIO. You will need to add resistor pull-ups to 3V3 on any spare GPIO you use. For reference pins 3 and 5 have 1k8 pull-ups to 3V3. You create the software bus by adding a configuration entry in /boot/config.txt. For details see i2c-gpio in /boot/overlays/README. Name: i2c-gpio Info: Adds ...


3

Brick's answer is already very comprehensive, but I would like to add a couple of things: time.sleep is a blocking function, which implies that, at each loop, before you perform a new calculation in your thread to adjust the robot's position, you need to wait the specified amount of time in your sleep function. Besides, sleep only guarantees precision up to ...


3

We don't know anything about your robot's size or shape, and that could matter. Some shapes are easier to balance, for example, and therefore probably less sensitive to control timing delays. Balance is often time-sensitive, however, so I'm working under that assumption for what follows. You have several potential issues here. Depending on your situation,...


3

The code is written in Python which is an interpreted language. It will be somewhat slower than a compiled language such as C. You have many print statements in the code. That will slow the main loop considerably.


2

The only reason for an intermittent connection is a loose connection. I suggest you check that each wire is securely soldered in place. It is safer to power from 3V3 rather than 5V if the module will work at 3V3.


2

You should not need to use sudo with i2cdetect. The most likely problem is not connecting ADO to either ground or 3V3.


1

A lot of stuff about MPU 9250 in https://learn.sparkfun.com/tutorials/mpu-9250-hookup-guide (i2c, pull up, datasheet, ...). For the power and the address selection : VDD Power supply +2.4V to +3.6V AD0/SDO Address selection I2C Slave Address LSB (AD0): Low: 0b1101000 ➫ 0x68 ...


1

I had a very similar-looking problem a few years ago, and posted a question in Electronics SE. @BrianDrummond figured it out and posted this answer: Errors look like +/-256 +/- expected drift. This suggests some kind of synchronising error - such as reading the LSByte of one sample and the MSByte of the next or vice versa. How does your gyro handle ...


1

I don't have a MPU6050 so I can't really test this. However I suggest you look at this ADXL345 example and try similar code to read registers X, Y, Z as a block. import sys if sys.version > '3': buffer = memoryview # removed code # 0x32 = X LSB, 0x33 = X MSB # 0x34 = Y LSB, 0x35 = Y MSB # 0x36 = Z LSB, 0x37 = Z MSB # < = little ...


1

What do you mean by at once? You can buy two TCA9548A I2C multiplexors which will allow you to connect 16 MPU6050 on the same bus (at the same bus address). However only one MPU6050 may be addressed at any one instant in time.


1

This snippet will provide angle after manipulating the values from MPU-6050 MPU-6050-kalman-filter-python . Reading gyroscope and accelerometer values from MPU-6050 is just reading the data from an address of the module. But to fetch some useful information from the same requires some noise filtering and data-fusion algorithm. The above module or snippet ...


1

I had the same problem. The board is not faulty, the problem is caused by the MPU6050. Add these lines to the MPU6050 initialization process: self.bus.write_byte_data(self.address, 0x37, 0x02) self.bus.write_byte_data(self.address, 0x6A, 0x00) so the whole MPU6050's initialization process is something like this: self.bus = smbus.SMBus(1) // or 0, depends ...


1

I ran in to the same problem during a project week at Uni, so have started developing a library to allow easy interfacing with a MPU6050 via the I2C Bus. The library is written in C++ and assumes some basic knowledge of C++ to be able to implement it. As of 11/04/2019 the library is still under development, but if you experience problems with it please let ...


1

The MPU may be voltage sensitive, but most break out boards I have seen are ok at 5V. I2C itself is a current sync protocol, meaning it will generally work at any voltage, having a signal pulled to vcc and then switched to ground is what is important, not what the voltage is. In fact you only need to level shift if you have other devices on the i2c line ...


1

According to the MPU-6050 datasheet it accepts voltages in the range 2.375V-3.46V. Supplying one of the pins with 5V could indeed have damaged the sensor.


1

Some breakouts need a 5V supply and include a 3.3V regulator for the MPU6050 itself. If that's what you have, then you need5V for Vcc. You will need to set the ADD to either 0v or 3.3V to chooses between the i2c addresses 0x68 or 0x69. You can leave XDA, XCL and INT unconnected - XDA / XCL provide a master i2c interface for adding (say) a ...


Only top voted, non community-wiki answers of a minimum length are eligible