Motor Shield V2 AFMS.Begin problem

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
dagardner
 
Posts: 9
Joined: Sat Feb 08, 2014 9:32 pm

Motor Shield V2 AFMS.Begin problem

Post by dagardner »

To whom this may concern,

I am not sure what is going on with the frequency of this board but I am having a mental break down trying to figure it out. On top you see connections for pots, to read the control of the robot motors it is hooked too. However, In the code listed below it gets held up in finding a frequency for the board. I was wondering if you could take a look at the board I have pictured and the code and see if anything i have done is wrong? It will work sometimes, and other times it won't!

best regards,

James

Code: Select all

#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_DCMotor *Motor1 = AFMS.getMotor(2);
int val0 = 0;   // variable to store the Arm sensor

void input()// this is the subroutine that waits for the user to enter 1 for moving on or 2 for reading
  {
  int incomingByte = 0;	// for incoming serial data
  Motor1->setSpeed(0);     // stop the motor
  Serial.println("Hit return for next motion"); 
  val0 = analogRead (0);
  Serial.println(val0);
  while (incomingByte != 49)  // 13 is the ASCII code for "enter"
    {
	if (Serial.available() > 0) 
         {   
		// read the incoming byte:
		incomingByte = Serial.read();

		// say what you got:
		Serial.print("I received: ");
		Serial.println(incomingByte, DEC);
	 }
     }
  }
 void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Adafruit Motorshield v2 - DC Motor test!");
  Serial.println("Starting up controller!");
    AFMS.begin();  // create with the default frequency 1.6KHz
  //AFMS.begin(1000);  // OR with a different frequency, say 1KHz
  Serial.println("Controller has succsessfully !");
  // Set the speed to start, from 0 (off) to 255 (max speed)
  Motor1->setSpeed(150);

}

void loop() 
{
 Start: // come back to the beginning from the end
  Serial.println ("Press Enter to start the Process:");
 input(); // wait for user to hit enter
  Serial.println("Starting");
 val0 = analogRead (0);
  Serial.print("val0 is ");
  Serial.println(val0);
  delay(100);
Serial.println("Forward");  
if (val0 > 400)
{
  while (val0 >400)
  {
    val0 = analogRead (0);
    Serial.print ("value = ");
    Serial.println (val0);
    Motor1->setSpeed(100);
    Motor1->run(FORWARD);
    delay(5);
  }
}
input(); // Wait for an enter to move the other direction.
Serial.println("Backward");
if (val0 < 637) 
{
  while(val0<637)
  { 
    val0 = analogRead (0);
    Serial.print ("value = ");
    Serial.println (val0);
    Motor1->setSpeed(100);
    Motor1->run(BACKWARD);
    delay(5);
  }
}
    
goto Start;
}
Last edited by dagardner on Sat Apr 12, 2014 1:09 am, edited 1 time in total.

dagardner
 
Posts: 9
Joined: Sat Feb 08, 2014 9:32 pm

Re: Motor Shield V2 AFMS.Begin problem

Post by dagardner »

Pictures
Attachments
phpWXmMt1PM.jpg
phpWXmMt1PM.jpg (45.24 KiB) Viewed 642 times
phpBSZo4EPM.jpg
phpBSZo4EPM.jpg (60.05 KiB) Viewed 642 times
phpJ8ToRyPM.jpg
phpJ8ToRyPM.jpg (45.61 KiB) Viewed 642 times

dagardner
 
Posts: 9
Joined: Sat Feb 08, 2014 9:32 pm

Re: Motor Shield V2 AFMS.Begin problem

Post by dagardner »

More.
Attachments
And some times it doesn't even get that far.
And some times it doesn't even get that far.
Capture2.PNG (35.65 KiB) Viewed 642 times
Some times it hangs up here.
Some times it hangs up here.
Capture.PNG (43.56 KiB) Viewed 642 times
phpQgOv4bPM.jpg
phpQgOv4bPM.jpg (48.89 KiB) Viewed 642 times

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

Re: Motor Shield V2 AFMS.Begin problem

Post by adafruit_support_bill »

Looks like maybe an i2c communication problem with the board. Can you post some larger photos? 800x600 is a good size.

dagardner
 
Posts: 9
Joined: Sat Feb 08, 2014 9:32 pm

Re: Motor Shield V2 AFMS.Begin problem

Post by dagardner »

I want to thank you for the quick reply. Here a some pictures that are resized. Regards, James
Attachments
phpa4UvwoAM.jpg
phpa4UvwoAM.jpg (107.13 KiB) Viewed 618 times
phpOLKS0kAM.jpg
phpOLKS0kAM.jpg (109.64 KiB) Viewed 618 times

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

Re: Motor Shield V2 AFMS.Begin problem

Post by adafruit_support_bill »

Your new photos don't show any of your soldering. We especially need to see the soldering on the SDA & SCL pins, as well as the power/ground and analog pin headers.

dagardner
 
Posts: 9
Joined: Sat Feb 08, 2014 9:32 pm

Re: Motor Shield V2 AFMS.Begin problem

Post by dagardner »

Sorry about that.
Attachments
phpwGv8iYAM.jpg
phpwGv8iYAM.jpg (74.05 KiB) Viewed 613 times
phpdwZKQuAM.jpg
phpdwZKQuAM.jpg (73.59 KiB) Viewed 613 times

dagardner
 
Posts: 9
Joined: Sat Feb 08, 2014 9:32 pm

Re: Motor Shield V2 AFMS.Begin problem

Post by dagardner »

more
Attachments
phpCqtMxVAM.jpg
phpCqtMxVAM.jpg (74.53 KiB) Viewed 612 times
phppQQbbJAM.jpg
phppQQbbJAM.jpg (63.45 KiB) Viewed 612 times

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

Re: Motor Shield V2 AFMS.Begin problem

Post by adafruit_support_bill »

Your motor terminal soldering looks good. But many of your header pins appear to have too little solder. From what I can see, A4 has no solder at all. Please read through this guide and re-touch those header joints.

http://learn.adafruit.com/adafruit-guid ... n-problems

dagardner
 
Posts: 9
Joined: Sat Feb 08, 2014 9:32 pm

Re: Motor Shield V2 AFMS.Begin problem

Post by dagardner »

Alright, thank you Bill, I will keep in contact you after I finished this process. It might not be today because I won't be home but maybe tomorrow.

regards,

James

dagardner
 
Posts: 9
Joined: Sat Feb 08, 2014 9:32 pm

Re: Motor Shield V2 AFMS.Begin problem

Post by dagardner »

Bill,

I am still having the same problem. I have post pictures below to show you the update!
Attachments
phpPpdZaTPM.jpg
phpPpdZaTPM.jpg (91.07 KiB) Viewed 572 times
phpseSTOxPM.jpg
phpseSTOxPM.jpg (97.03 KiB) Viewed 572 times
phpH3SROPPM.jpg
phpH3SROPPM.jpg (77.16 KiB) Viewed 572 times

dagardner
 
Posts: 9
Joined: Sat Feb 08, 2014 9:32 pm

Re: Motor Shield V2 AFMS.Begin problem

Post by dagardner »

Bill,

I am sorry if I am bothering you so much about the same problem, however, I was looking at the board to find anything and found that there was a little flux left on the board. I cleaned it the best of my ability using alcohol and q-tips. Now I only have one motor hooked up (M2) and the last three test I have done have been successful for for controller start up! I just wanted to give you this update and see what you thought about flux.

best regards,

James

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

Re: Motor Shield V2 AFMS.Begin problem

Post by adafruit_support_bill »

Burnt flux can be somewhat conductive and can cause problems.

On this shield, the important pins are: +5v, GND, A4 and A5. Note that A4 and A5 are cross-connected to SDA and SCL. Any problems with these pins could cause difficulty communicating with the board.

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

Return to “Arduino Shields from Adafruit”