Search code examples
i2cnodemcumicropython

I2C scan with Micropython and NodeMCU 12E returns empty list


I'm trying to hook up a MPU6050 with my NodeMCU board with Micropython flashed in it.

My current wiring is the following:

MPU6050      Board
Vcc          3.3v
Gnd          Gnd
SDA          D6
SCL          D7

Through the command line, I've tried the following commands:

>>> from machine import Pin, I2C
>>> i2c = I2C(sda=Pin(12),scl=Pin(13))
>>> i2c.scan()
[]
>>>

12 and 13 were the GPIO values that I took from this pinout and I've also tried with the D1 and D2 pins as many people online do.

Although I plan to use a premade module for reading the MPU6050 values, I would have liked to see this by myself (the pre-made modules seem too overwhelming, so I wanted to see if I could do something by myself).

I'm getting quite crazy because everything seems fine to me (according to other people's wiring seen online too).

As always, thanks in advance!


Solution

  • Turns out the code was right and the cause was a faulty contact in the breadboard.