0

Data Logger Shield Stops Mega 2560
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Data Logger Shield Stops Mega 2560

by eburdick on Wed Mar 10, 2021 1:16 am

I have a working robot car working with Arduino Mega 2560 and an Adafruit motor shield. I added the data logger shield (new version) to the stack and the Arduino seems to have completely stopped running the program. There is a delay, then all of my leds turn on. Print statements in setup() and loop() send nothing to the serial monitor. When I remove the data logger from the stack, everything starts working again. I have done nothing but solder on the stacking headers (clean solder joints) and add it to the stack. Am I missing something?

eburdick
 
Posts: 6
Joined: Wed Mar 10, 2021 1:00 am

Re: Data Logger Shield Stops Mega 2560

by dastels on Wed Mar 10, 2021 10:25 am

The RTC on the logger shield is at I2C address 0x68 by default and the motor shield defaults to 0x60, so addresses should be ok as long as you haven't fiddled with the address jumpers (specifically bridging just A3).

Can you use the logger shield on it's own successfully?

Dave

dastels
 
Posts: 6872
Joined: Tue Oct 20, 2015 3:22 pm

Re: Data Logger Shield Stops Mega 2560

by eburdick on Wed Mar 10, 2021 12:15 pm

OK, I have made some progress. I forgot to mention that I also have a MPU-6050 in this system. The Arduino seems to be crashing on the begin function for that, using the default I2C address. When I comment that code out, it does not crash. Any suggestion on a safe address to use for this? I will have to try a different address. In addition, there seems to be a conflict on digital pin 52, which I use to read a switch. With the new shield installed, that pin seems to be low all the time, so the code thinks the switch is closed, which puts my code into test mode. Changing the code to use pin 40 instead solves that problem. Why pin 52? that seems to be outside of the range covered by this shield. Thanks.

eburdick
 
Posts: 6
Joined: Wed Mar 10, 2021 1:00 am

Re: Data Logger Shield Stops Mega 2560

by dastels on Wed Mar 10, 2021 12:54 pm

That's kind of relevant. The MPU6050 uses I2C address 0x68 by default, as does the RTC on the logging shield. Bridge the AD0 jumper on the bottom of the IMU board to have it use 0x69.

Dave

dastels
 
Posts: 6872
Joined: Tue Oct 20, 2015 3:22 pm

Re: Data Logger Shield Stops Mega 2560

by eburdick on Wed Mar 10, 2021 5:34 pm

OK, thanks. I have wired the MPU to be at address 0x69 and I2C scanner finds it. How do I tell the software? I have seen examples that use a different library and include the address in the constructor, but with the Adafruit library, this causes a compilation error because there apparently is no such constructor. What is the magic to keep the MPU object from accessing the wrong address?

eburdick
 
Posts: 6
Joined: Wed Mar 10, 2021 1:00 am

Re: Data Logger Shield Stops Mega 2560

by eburdick on Wed Mar 10, 2021 6:01 pm

OK, I found it. It looks like the Adafruit version takes an address argument in the mpu.begin() method, so I can call mpu.begin(0x69) to start it. Seems to be working now, at least until the next problem I find. Thanks for the help.

eburdick
 
Posts: 6
Joined: Wed Mar 10, 2021 1:00 am

Re: Data Logger Shield Stops Mega 2560

by eburdick on Wed Mar 10, 2021 6:13 pm

A suggestion...

Add a comment to your MPU-6050 example programs...

// For I2C address 0x69, replace the following line with
//if (!mpu.begin(0x69)) {
if (!mpu.begin()) {
Serial.println("Failed to find MPU6050 chip");
while (1) {
delay(10);
}
}

eburdick
 
Posts: 6
Joined: Wed Mar 10, 2021 1:00 am

Re: Data Logger Shield Stops Mega 2560

by dastels on Wed Mar 10, 2021 9:01 pm

The Adafruit libraries quite often (I won't say always because I'm not 100% sure) take the I2C address as an optional argument to begin().

Dave

dastels
 
Posts: 6872
Joined: Tue Oct 20, 2015 3:22 pm

Re: Data Logger Shield Stops Mega 2560

by eburdick on Fri Mar 12, 2021 10:28 pm

Note on my original post on this...I mentioned that there was some kind of conflict on pin 52, where I had a switch connected. I learned with some reading what any real expert on this stuff likely knows, that the ICSP pins on the mega2650 are connected to pins 50-53 for SPI communication, so those pins are off limits for sensors, LEDs, etc.

eburdick
 
Posts: 6
Joined: Wed Mar 10, 2021 1:00 am

Please be positive and constructive with your questions and comments.


cron