DS3231 or adafruit motor shield alternatve setup

As part of a project I am using a DS3231 rtc module and an adafruit NEMA 17 stepper motor (with adafruit motor shield v2.3) however they both seem to need access to the SDA and SCL pins. Is there any other way to connect them such that they don't both require SDA and SCL?
I used this website for the code for the clock: https://lastminuteengineers.com/ds3231-rtc-arduino-tutorial/

20200428_125218[1].jpg

20200428_125156[1].jpg

20200428_125117[1].jpg

I2C is a bus. it is set up so that multiple deviices connect to the same 2 pins. Each device has a unique addtess to identify it on the bus.

groundFungus:
I2C is a bus. it is set up so that multiple deviices connect to the same 2 pins. Each device has a unique addtess to identify it on the bus.

I’ve connected the motor shield and clock up as shown in the picture attached, the clock works but the motor isn’t doing anything when its supposed to. I’m not sure if its my code or the connections.

Here’s my code:

#include <Wire.h>
#include "RTClib.h"
#include <Adafruit_MotorShield.h>

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield(); 
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61); 

// Connect a stepper motor with 200 steps per revolution (1.8 degree)
// to motor port #2 (M3 and M4)
Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);

RTC_DS3231 rtc;

char daysOfTheWeek[7][12] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

void setup () 
{
  AFMS.begin();
  Serial.begin(9600);
  delay(3000); // wait for console opening

  if (! rtc.begin()) {
    Serial.println("Couldn't find RTC");
    while (1);
  }

  if (rtc.lostPower()) {
    Serial.println("RTC lost power, lets set the time!");
  
  // Comment out below lines once you set the date & time.
    // Following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
  
    // Following line sets the RTC with an explicit date & time
    // for example to set January 27 2017 at 12:56 you would call:
    //rtc.adjust(DateTime(2020, 4, 27, 12, 19, 0));
  }
}

void loop () 
{
    DateTime now = rtc.now();
    
    Serial.println("Current Date & Time: ");
    Serial.print(now.year(), DEC);
    Serial.print('/');
    Serial.print(now.month(), DEC);
    Serial.print('/');
    Serial.print(now.day(), DEC);
    Serial.print(" (");
    Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
    Serial.print(") ");
    Serial.print(now.hour(), DEC);
    Serial.print(':');
    Serial.print(now.minute(), DEC);
    Serial.print(':');
    Serial.print(now.second(), DEC);
    Serial.println();
    
    Serial.println("Unix Time: ");
    Serial.print("elapsed ");
    Serial.print(now.unixtime());
    Serial.print(" seconds/");
    Serial.print(now.unixtime() / 86400L);
    Serial.println(" days since 1/1/1970");
    
    // calculate a date which is 7 days & 30 seconds into the future
    DateTime future (now + TimeSpan(7,0,0,30));
    
    Serial.println("Future Date & Time (Now + 7days & 30s): ");
    Serial.print(future.year(), DEC);
    Serial.print('/');
    Serial.print(future.month(), DEC);
    Serial.print('/');
    Serial.print(future.day(), DEC);
    Serial.print(' ');
    Serial.print(future.hour(), DEC);
    Serial.print(':');
    Serial.print(future.minute(), DEC);
    Serial.print(':');
    Serial.print(future.second(), DEC);
    Serial.println();
    
    Serial.println();
    delay(1000);
    myMotor->setSpeed(10);
    myMotor->step(10, FORWARD, SINGLE);
}

20200429_131352[1].jpg

Does that code compile?

Plasterboard:
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);

Looks rather unpromising.

Nick_Pyner:
Does that code compile?Looks rather unpromising.

Yes, the code compiles and the clock works fine but the motor doesn’t do anything.

If you connect the motor shield by itself and run example code from the Adafruit_MotorShield library does the motor work?

Does an I2C scanner find the motor shield.

groundFungus:
If you connect the motor shield by itself and run example code from the Adafruit_MotorShield library does the motor work?

Does an I2C scanner find the motor shield.

The motor works fine on its own, I'm not sure where to find an I2C scanner though.

Nick Gammon has an I2C scanner sketch here

http://www.gammon.com.au/i2c

about 2/3 of the way down the page.

I had a similar problem. I seem to recall It was that they both need exclusive use of the same internal timer. I think I either found an alternative library or a different method altogether.

blewtobits:
I had a similar problem. I seem to recall It was that they both need exclusive use of the same internal timer. I think I either found an alternative library or a different method altogether.

Can you remember if it was an alternative library for the rtc or the motor shield?

CrossRoads:
Nick Gammon has an I2C scanner sketch here

Gammon Forum : Electronics : Microprocessors : I2C - Two-Wire Peripheral Interface - for Arduino

about 2/3 of the way down the page.

It is detecting both of the devices so I suppose they're both connected correctly, I guess blewtobits could be right then.