Hello guys!
I just received my feather M0 and I wanted to test it with my MPU9250.
The MPU9250 is an IMU that communicates Via I2C with the microcontroller. My Problem is, that if I use the MPU with my Arduino Uno I can read Data with the exsample sketches from the library, but if I use it with my M0 i just receive static values.
Do I have to change something in the library or in the code? or is it just impossible to use this Sensor with this board?
I hope somebody can help me.
The M0 is a 3V3 The Uno is a 5V device. What measures have you taken to address this?
Also line 23 of your code looks wrong and I don’t like that ground wire in your schematic.
Grumpy_Mike:
The M0 is a 3V3 The Uno is a 5V device.
Why does it matter if it is a 3.3V or 5V device? The IMU I am using works with 3.3V and if i power it with the Arduino I use the 3.3V output, so this should not make any difference, or am I wrong?
I tested te accelerometer of the IMU by applying 1g on each axis and it worked totally fine. On the M0 there are just random static values.
Here is the example code I am using
#include <Wire.h>// include MPU9255 library
#include <MPU9255.h>// include MPU9255 library
MPU9255 mpu;
void setup() {
Wire.begin();//initialize I2C interface
Serial.begin(115200);// initialize Serial port
mpu.init();// Initialize MPU9255 chip
}
void loop() {
mpu.read_acc();// read data from accelerometer
mpu.read_gyro();// get data from gyroscope
mpu.read_mag();// get data from the magnetometer
// print all data in serial monitor
Serial.print("AX: ");
Serial.print(mpu.ax);
Serial.print(" AY: ");
Serial.print(mpu.ay);
Serial.print(" AZ: ");
Serial.print(mpu.az);// accelerometer data
Serial.print(" GX: ");
Serial.print(mpu.gx);
Serial.print(" GY: ");
Serial.print(mpu.gy);
Serial.print(" GZ: ");
Serial.print(mpu.gz);// gyroscope data
Serial.print(" MX: ");
Serial.print(mpu.mx);
Serial.print(" MY: ");
Serial.print(mpu.my);
Serial.print(" MZ: ");
Serial.println(mpu.mz);// gyroscope data
delay(100);
delay(100);
}
Why does it matter if it is a 3.3V or 5V device?
Because the signals from an I2C lines are pulled up to 5V by the Uno, this is too much for the inputs of the 3V3 device.
What measures have you taken to address this?
So I'll take that as a none then.
Try this change for the Uno code:
void setup() {
Wire.begin();//initialize I2C interface
digitalWrite (SCL, HIGH); // turns off internal pullup to 5V
digitalWrite (SDA, HIGH); // turns off internal pullup to 5V
Serial.begin(115200);// initialize Serial port
mpu.init();// Initialize MPU9255 chip
}
Then add external 3.3K pullup resistors to 3.3V
Grumpy_Mike:
What measures have you taken to address this?
I dont get what you mean?!
CrossRoads:
Try this change for the Uno code:
Thank you for the input, but i don´t have issues with the Arduino. On the Arduino it works fine, but on the feather it wont.
I dont get what you mean?!
You will not have any issue with the Arduino, that is putting out a 5V signal. This is being fed into your 3V3 system the feather M0. This signal could be enough to fry the feather M0, and looking at the fact that it does not work it looks like it already has.
Cross Roads showed you one way to stop your Arduino sending a too high voltage into the M0, that would be considered as a measure to combat the voltage incompatibility. Another measure would be to put some level translators between the two. Like this one 4-channel I2C-safe Bi-directional Logic Level Converter [BSS138] : ID 757 : $3.95 : Adafruit Industries, Unique & fun DIY electronics and kits
Here is the example code I am using
On what? The Arduino or the M0?
And have you actually got a MPU9255 chip? I can't see it on your schematic.
Thank you for all your answers, the reason it did not work properly was just a bad soldering point.
eismeister:
Thank you for all your answers, the reason it did not work properly was just a bad soldering point.
So you are content to continue to abuse your components until they die are you.
Why bother asking for advice if you are so sure you know better?