0
\$\begingroup\$
#include <basicMPU6050.h>
basicMPU6050<> imu;
void setup() {
  imu.setup();
  imu.setBias();
}
void loop() {
  imu.updateBias();
  if (imu.gy() > 0.1) { //DoSomething}
  else if (imu.gy() < -0.1) { //DoSomethingElse}
}

Well... I have absolutely no idea, which pins to connect to the MPU6050, except for the VCC and GND of course. I've tried to connect it to I2C SDA and I2C SCL pins but didn't get any output.

Edit2: The picture about the Nucleo board is not an STM32F303, I do have an STM32F303, it's only there, to show the pinout. Pic of the Nucleo-32 Pic of the MPU6050

Edit: Pic of the board configuration in Arduino IDE:

Ardunio IDE config

\$\endgroup\$
5
  • \$\begingroup\$ OK. So what have you tried? Since this is mostly about Arduino, have you read Arduino documentation about the subject? Or tried asking on the Arduino Stack Exchange? \$\endgroup\$
    – Justme
    Commented Mar 14, 2022 at 18:41
  • \$\begingroup\$ You both are and aren't right. STM32 is Arduino compatible but isn't Arduino. The wiring can be different sometimes, for example, this boy has a lot of i2c-s and tx/rx-s \$\endgroup\$ Commented Mar 14, 2022 at 18:54
  • \$\begingroup\$ If you run Arduino framework on it, it's an Arduino and you must know how the Arduino framework works on this particular hardware platform, therefore it will be mentioned in Arduino documentation. And it likely depends on which of the interfaces the MPU6050 driver module uses. Look at the Arduino or module source code to find it out. \$\endgroup\$
    – Justme
    Commented Mar 14, 2022 at 19:05
  • \$\begingroup\$ Do you have an oscilloscope or logic analyzer? If you do, you can probe the pins to see what they are doing. \$\endgroup\$
    – rdtsc
    Commented Mar 14, 2022 at 19:07
  • \$\begingroup\$ It looks like the mpu6050 module has pullup resistors but you’d want to confirm this. I2C won’t work without pull-ups. You might want to check what is the default pins for I2C. This might require looking at the wire library in the stm32 core code. If you use platformIO rather than the Arduino IDE this is relatively easy. \$\endgroup\$
    – Kartman
    Commented Mar 14, 2022 at 21:00

1 Answer 1

1
\$\begingroup\$

Regarding the pinout, you need to check the datasheet of the board: https://www.st.com/resource/en/user_manual/dm00231744-stm32-nucleo32-boards-mb1180-stmicroelectronics.pdf

As written on page 25, you have to connect A5 and A4 pins of the board since they are I2C clock and data lines. The communication between the board and the imu sensor happens through the I2C protocol

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.