I have an MPU-6050 breakout board connected to an Arduino Nano in a simple breadboard setup. Running either the short or the longer MPU6050 sample sketch from the MPU6050 page on this site, both return zero values for the accelerometer and the gyro. It returns a constant value for the temperature (36.1C), so it appears that the I2C connection is working correctly. The green LED on the MPU6050 board in on constantly.
Does anyone have any suggestions?
P.S. I may have fried the MPU6050 sensors due to a bad connection on a prototype board I was testing before I set it up in the breadboard (wrong sequence, I should have tried the breadboard setup first - overly confident in my soldering abilities.) Are the sensors on the MPU6050 susceptible to 'frying'?
Wawa:
Which one. There are many.
With and without 3.3volt regulator.
With and without I2C level shifter.
Post a link to the one you have.
How is the Nano powered.
Leo..
I2c is powered by the 3.3V side of the MPU-6050 breakout no level shifter is needed unless you add additional i2c devices that require 5V. The Arduino trips high when 3.3v is reached and the pull up resistors do their job nicely the Arduino never provides 5V to the i2c pins it just shorts the 3.3V pull up to ground when sending signals.
if you have an mpu-6050 breakout without the 3.3v regulator, 5Volts will destroy the mpu-6050.
Z
Update: I got a replacement MPU-6050 breakout board (Aukru - chinese clone) and it works fine in both my breadboard test setup and in the prototype board (once the bad connection was fixed.) It is running on +5V and doesn't seem to mind. According to the board specs it will accept voltages from 3.3V to 5V, so I guess it has the voltage level shifter circuitry described above. It also runs fine without pull-up resistors on the I2C lines, which many say are a requirement for I2C comms according to what I have been reading. Maybe the Arduino Nano has built-in pull-ups. I haven't been able to find a clear answer on that one.
Cheddy:
It is running on +5V and doesn't seem to mind. According to the board specs it will accept voltages from 3.3V to 5V, so I guess it has the voltage level shifter circuitry described above.
It also runs fine without pull-up resistors on the I2C lines, which many say are a requirement for I2C comms according to what I have been reading. Maybe the Arduino Nano has built-in pull-ups.
So it has a voltage regulator for the power.
That doesn't mean it also has level shifters for the I2C lines.
The MPU-6050 might survive the (software only) pull up of the Nano.
Might be a different story if you connect another I2C device to the I2C bus, with hardware pull up.
Leo..
Wawa:
So it has a voltage regulator for the power.
That doesn't mean it also has level shifters for the I2C lines.
The MPU-6050 might survive the (software only) pull up of the Nano.
Might be a different story if you connect another I2C device to the I2C bus, with hardware pull up.
Leo..
The i2c's are pulled up on the 3.3V side of the breakout R4 and R5 so you don't need resistors just make sure you don't turn the i2c pins high. the i2c only pulls the pins low and lets the pull-up resistors dictate the top voltage
zhomeslice:
so you don't need resistors just make sure you don't turn the i2c pins high.
The internal pull up resistors to 5volt on an Uno/Nano are AFAIK activated with the wire.begin call.
You could try to disable that in the wire library.
A Mega has hardware pull up (10k resistorsto 5volt).
Not sure if also the internal pull up resistors are activated.
Other devices connected to the bus might have pull up resistors to 5volt.
Leo..
Wawa:
The internal pull up resistors to 5volt on an Uno/Nano are AFAIK activated with the wire.begin call.
You could try to disable that in the wire library.
A Mega has hardware pull up (10k resistorsto 5volt).
Not sure if also the internal pull up resistors are activated.
Other devices connected to the bus might have pull up resistors to 5volt.
Leo..
Wawa:
The internal pull up resistors to 5volt on an Uno/Nano are AFAIK activated with the wire.begin call.
You could try to disable that in the wire library.
A Mega has hardware pull up (10k resistorsto 5volt).
Not sure if also the internal pull up resistors are activated.
Other devices connected to the bus might have pull up resistors to 5volt.
Leo..
yes the internal pull-up resistors are triggered with the twi_init() call
Wire.cpp
void TwoWire::begin(void)
{
rxBufferIndex = 0;
rxBufferLength = 0;
txBufferIndex = 0;
txBufferLength = 0;
twi_init();
}
and
twi.cpp
void twi_init(void)
{
// initialize state
twi_state = TWI_READY;
twi_sendStop = true; // default value
twi_inRepStart = false;
// activate internal pullups for twi. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
digitalWrite(SDA, 1);
digitalWrite(SCL, 1);
// initialize twi prescaler and bit rate
cbi(TWSR, TWPS0);
cbi(TWSR, TWPS1);
TWBR = ((F_CPU / TWI_FREQ) - 16) / 2;
/* twi bit rate formula from atmega128 manual pg 204
SCL Frequency = CPU Clock Frequency / (16 + (2 * TWBR))
note: TWBR should be 10 or higher for master mode
It is 72 for a 16mhz Wiring board with 100kHz TWI */
// enable twi module, acks, and twi interrupt
TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA);
}
But the pull-up resistor value is 20kOhm-50kOhm, per the datasheet See page 366
So the 4.7k ohm will have the most influence on the line and keep the voltage near the required 3.3v
as for the Arduino mega, the onboard fixed 10K ohm pull-ups are a concern as they are attached to the 5V line and
I haven't used a mega with the mpu6050 yet.
be aware of all the devices with pull-up resistors and what they are attached to. modifications may be needed to remove extra pull-up resistors to keep the i2c bus working at the correct voltage you really should only have or need 1 pullup resister for data and 1 for clock.
Z