Pin conflict between Ultimate GPS Logger and Arduino Motor S

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
TryChick
 
Posts: 47
Joined: Wed Apr 30, 2014 3:44 pm

Pin conflict between Ultimate GPS Logger and Arduino Motor S

Post by TryChick »

I'm using the Adafruit Ultimate GPS logger shield with the Arduino motor shield stacked on top with an Arduino Mega as my controller and have discovered I have some pin conflicts. This motor shield uses 3 pins (11, 12, 13) which the GPS shield also uses to read/write to the SD card which logs the GPS data. Any way to resolve this conflict or do I need to get a different shield which uses different pins to control the motors? I tried connecting the motors to different pins on the shield (instead of pin 11==>used pin 5, instead of pin 12==> used pin 4, instead of pin 13==> used pin 7) but the only thing that still works is the one pin I didn't change...pin 3 which controls the PWM of one side. so that motor works going forward and that is it.

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Pin conflict between Ultimate GPS Logger and Arduino Mot

Post by adafruit_support_bill »

I don't know the Arduino motor shield that well, but it would likely require substantial modifications to both the shield and the library to make it work.

Our V2 motor shield uses only the i2c bus for communication. The bus can be shared with other i2c devices and all other pins are free,

User avatar
TryChick
 
Posts: 47
Joined: Wed Apr 30, 2014 3:44 pm

Re: Pin conflict between Ultimate GPS Logger and Arduino Mot

Post by TryChick »

I was looking at your motor shield to see if it would work with the GPS Logger shield or not, but am still new at this and couldn't determine if it would solve my problem or not. So it sounds like the V2 will resolve this conflict? After doing more research on another forum, someone also suggested a "Go-Between" shield, which sits between two shields that have pin conflicts and allows you to reassign pins by soldering jumpers and then modifying pin assignments in the code. Do you have something like that?

User avatar
Franklin97355
 
Posts: 23910
Joined: Mon Apr 21, 2008 2:33 pm

Re: Pin conflict between Ultimate GPS Logger and Arduino Mot

Post by Franklin97355 »

The problem with the go-between is the problem is not so much the pin assignments rather that both shields want to use the "Hardware SPI" pins (11, 12, 13) There are "Software SPI" libraries out there but you would need to read up on how to use them. If you plan to go that route use the software version on the device that needs less attention because software is not as fast as hardware.

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Pin conflict between Ultimate GPS Logger and Arduino Mot

Post by adafruit_support_bill »

There are no conflicts between the V2 motor shield and the GPS shield. You can use them together with no changes to hardware or software.

User avatar
TryChick
 
Posts: 47
Joined: Wed Apr 30, 2014 3:44 pm

Re: Pin conflict between Ultimate GPS Logger and Arduino Mot

Post by TryChick »

Thanks

User avatar
TryChick
 
Posts: 47
Joined: Wed Apr 30, 2014 3:44 pm

Re: Pin conflict between Ultimate GPS Logger and Arduino Mot

Post by TryChick »

I went to the Arduino website and looked at the Mega 2560 info and saw this info.
That says the SPI pins are:

SPI: 50 (MISO), 51 (MOSI), 52 (SCK), 53 (SS).

So, I don't understand why there would be a problem with the go between. I would think I wouldn't need to mess with a Software SPI Library. I'm confused.

Oops. I'm actually using a Mega ADK but the description of the pins is the same in regards to the SPI.
Except it does say not to use digital pin 7, so I would have to use a different pin in its place.
Attachments
adkpins.PNG
adkpins.PNG (44.58 KiB) Viewed 335 times

User avatar
TryChick
 
Posts: 47
Joined: Wed Apr 30, 2014 3:44 pm

Re: Pin conflict between Ultimate GPS Logger and Arduino Mot

Post by TryChick »

OK, I decided to just bite the bullet and purchase the V2 motor shield since I know zero about modifying SPI libraries. Pin conflicts are no longer an issue (yeah!). I am currently working creating a program with functions to have the bot move forward/backward/left/right. My forward and backward functions work fine, but when I tried to create a function to make a right turn, I hear a click from the motors but nothing else. Not sure why this won't work as I had the bot turning left and right when I used the Arduino motor shield using the same logic. Here are my functions to go backwards and left. The rover_Speed function sets the speed for all 4 motors.

I'm not sure if I should post this in a different forum or not...

Code: Select all

//Function to move backward at designated speed
 //requires integer 0-255 (stopped - max speed) 
  void rover_Backward(int mSpeed){
  
    rover_Speed(mSpeed);  //set rover speed
  
    motor1->run(BACKWARD); //rotate all motors backward
    motor2->run(BACKWARD);
    motor3->run(BACKWARD);
    motor4->run(BACKWARD);
    }
    
//Function to turn left at designated speed
 //requires integer 0-255 (stopped - max speed) 
  void rover_Left(int mSpeed){
  
    rover_Speed(mSpeed);  //set rover speed
  
    motor1->run(BACKWARD); //rotate left side motors backward
    motor2->run(BACKWARD);
    motor3->run(FORWARD); //rotate right side motors forward
    motor4->run(FORWARD);
    }
Here is my loop. It works fine until it gets to the rover_Left function

Code: Select all

void loop() {

 rover_Forward(255);
 delay(2000);
 
  rover_Release();
 delay(1000);
 
 rover_Backward(100);
 delay(2000);
 
 rover_Release();
 delay(2000);
 
 rover_Left(150);
 rover_Release();
 delay(2000);
}
Last edited by adafruit_support_bill on Thu Aug 28, 2014 5:16 pm, edited 1 time in total.
Reason: fixed the code tags

User avatar
adafruit_support_bill
 
Posts: 88088
Joined: Sat Feb 07, 2009 10:11 am

Re: Pin conflict between Ultimate GPS Logger and Arduino Mot

Post by adafruit_support_bill »

Code: Select all

 rover_Left(150);
 rover_Release();
 delay(2000);[code]
[/code]
You do a release immediately after rover_left(), so it only goes left for a microsecond or two.

User avatar
TryChick
 
Posts: 47
Joined: Wed Apr 30, 2014 3:44 pm

Re: Pin conflict between Ultimate GPS Logger and Arduino Mot

Post by TryChick »

Ok. Duh. Thanks.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”