Notifications
Clear all

MPU6050 on a Nano

5 Posts
4 Users
2 Likes
423 Views
(@olditguy)
Member
Joined: 4 years ago
Posts: 3
Topic starter  

Arduino IDE 2.0.4  Trying to implement the MPU6050_DMP6.ino sketch on a Nano rather than an UNO.

Able to compile and upload, after solving an issue with the MPU6050.h library but getting "MPU6050 connection failed" message after "Testing device connections..." from serial monitor. My device is the Hi-Letgo GY521 version of the MPU6050.  Tried both 0x68 and 0x69 as an address for the device.

If I send a character to initialize the "programming and demo:" I receive an "Initializing DMP..." message followed by a "DMP Initialization failed (code 1)" message.

Not sure if higher clock rate of Nano may be causing timing issues.

 

This topic was modified 1 year ago by OldITGuy

   
Quote
Inq
 Inq
(@inq)
Member
Joined: 2 years ago
Posts: 1900
 

Posted by: @olditguy

Arduino IDE 2.0.4  Trying to implement the MPU6050_DMP6.ino sketch on a Nano rather than an UNO.

Able to compile and upload, after solving an issue with the MPU6050.h library but getting "MPU6050 connection failed" message after "Testing device connections..." from serial monitor. My device is the Hi-Letgo GY521 version of the MPU6050.  Tried both 0x68 and 0x69 as an address for the device.

If I send a character to initialize the "programming and demo:" I receive an "Initializing DMP..." message followed by a "DMP Initialization failed (code 1)" message.

Not sure if higher clock rate of Nano may be causing timing issues.

 

I don't use Arduinos any more... ESP8266 (80 and 160 MHz), ESP32 (up to 240 MHz), so CPU clock rate isn't the issue.  Clock rate of the 8060 is defined by the library and is independent and/or configurable by software.

My guess is that you're using the wrong pins.  There are tons of libraries for the 6050, so you example sketch isn't something I can readily find.  It might help if you identify which library and/or supply the sketch code.  AND let us know are you using SPI or I2C interface.  If I2C, use an I2C scanner https://gist.github.com/walidamriou/1e759043d66340f9c76c7d13b6abf55ehttps://gist.github.com/walidamriou/1e759043d66340f9c76c7d13b6abf55e .  That sketch will scan all pins and tell you what you have connected and what addresses are seen.  If it doesn't see them, then your wiring isn't valid.

 

3 lines of code = InqPortal = Complete IoT, App, Web Server w/ GUI Admin Client, WiFi Manager, Drag & Drop File Manager, OTA, Performance Metrics, Web Socket Comms, Easy App API, All running on ESP8266...
Even usable on ESP-01S - Quickest Start Guide


   
DaveE reacted
ReplyQuote
Will
 Will
(@will)
Member
Joined: 3 years ago
Posts: 2528
 

@olditguy

Some strange things in your post. 

First, you suggest that you tried this on an UNO before the NANO. Did that work ?

It's unlikely to be a timing issue since most NANOs and UNOs both use 16MHz xtals.

It seems odd that you say you fixed a problem with the library but now your module doesn't work. It could be that your fix didn't actually fix the problem. Could you please expand a bit on what you did to the library ?

We'll need to see your list of all the connections between the NANO and the MPU6050 including any pull-up resistors you may be using on the I2C lines (and any other devices connected to the NANO). At least, I'm assuming that you're using I2C since you mention addresses 0x68 and 0x69.

A wiring diagram would also be very helpful in analyzing the problem.

Anything seems possible when you don't know what you're talking about.


   
Lee G reacted
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6964
 

@olditguy @inq @will I just did a compile for UNO and NANO and get pages of errors. Some appear to be C++ types and some are shift operations that overflow the target variable

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PL/I and PL1, Pascal, Basic, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
(@olditguy)
Member
Joined: 4 years ago
Posts: 3
Topic starter  

@inq:  Wanted the Nano as opposed to any of my ESPs due to smaller footprint.  Had difficulties on library using install from .zip but a helpful friend steered me around that.

Additionally:  Using IC2, no pullups, changed interrupt from (02) to (05) on Nano and all is now working on the MPU6050_DMP6.ino sketch built into the library examples.

Thanks to all! First time on Forum...have a lot to learn, obviously.


   
ReplyQuote