0

I am relatively new to Arduino and microchips, but I am good at electronics. I want to connect MPU6050 accelerometer+gyroscope module to Arduino. I searched on the internet and everywhere it is said to connect the SCL and SDA pins to two analog pins of the Arduino. As far as I know, the MPU6050 is a digital sensor, so why 2 analog pins are required for the sensor?

Also, is there any way to connect the sensor with only digital pins? because I need the analog pins for some other purpose.

0

1 Answer 1

2

The MPU6050 communicates over I2C. I2C uses clock line SCL and data line SDA. I2C pins on Uno are pins A4 and A5. This is because the ATmega328p MCU used on Uno has the I2C peripheral on the same pins. It has nothing to do with the DAC function of the pins.

Alternatively MPU6050 can communicate over SPI. This are pins 11, 12, 13 on Uno and one more pin for CS. Pin 10 must be output while ATmega328p is SPI master so it is recommended to use it as CS for the SPI slave device. EDIT Sorry, only MPU6000 has SPI.

12
  • I have noticed that there are separate SCL and SDA pins on the Arduino UNO. Can I use those?
    – Puspam
    Commented Nov 30, 2019 at 12:03
  • @PuspamAdak, see the schematics. those are the same pins of the ATmega
    – Juraj
    Commented Nov 30, 2019 at 12:03
  • @PuspamAdak, I enhanced the answer with information about SPI
    – Juraj
    Commented Nov 30, 2019 at 12:12
  • Juraj, A0 and A1 and SCL and SDA are connected to the same pins on the ATmega processor? I would think that would cause confusion, since if you try to use I2C then A0 and A1 won't work as expected. What other pins are duplicates on the UNO? And what about the Mega 2560?
    – Duncan C
    Commented Nov 30, 2019 at 12:33
  • @DuncanC, A4 and A5, not A0/A1. yes it causes confusion. Mega has SDA SCL labels next to labels 20 and 21
    – Juraj
    Commented Nov 30, 2019 at 13:49

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.