0

Run stepper on button press stop working
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Re: Run stepper on button press stop working

by Techguy817 on Thu Oct 22, 2020 6:21 pm

BoardSolder2.jpg
BoardSolder2.jpg (637.43 KiB) Viewed 36 times
BoardSolder1.jpg
BoardSolder1.jpg (719.72 KiB) Viewed 36 times


Here are some photos. The continuity seems fine. Again I can work with switches and LEDs all day long no problem. Just an issue controlling stepper motors where the board locks up.

Techguy817
 
Posts: 17
Joined: Fri Oct 16, 2020 11:44 pm

Re: Run stepper on button press stop working

by adafruit_support_bill on Thu Oct 22, 2020 6:57 pm

Hard to see in the photos. But some of those solder joints look a bit suspect - including the i2c bus pins.
This guide has some tips on identifying and fixing common soldering problems: https://learn.adafruit.com/adafruit-gui ... n-problems

adafruit_support_bill
 
Posts: 81528
Joined: Sat Feb 07, 2009 10:11 am

Re: Run stepper on button press stop working

by Techguy817 on Thu Oct 22, 2020 7:45 pm

solder pins2.jpg
solder pins2.jpg (949.09 KiB) Viewed 35 times
solder pins1.jpg
solder pins1.jpg (758.14 KiB) Viewed 35 times


Ok so I cleaned up my soldering a little bit but still the same issue. Here is my latest code and some photos. Do I still need to further cleanup the soldering and if so on which pins?

Code: Select all | TOGGLE FULL SIZE
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include <Servo.h>


Adafruit_MotorShield AFMS = Adafruit_MotorShield();
Adafruit_StepperMotor *myMotor = AFMS.getStepper(200, 2);

int buttonState = 0;        // initialize button to 0

void setup() {
  Serial.begin(9600);                       // open serial port at 9600 bps;
  pinMode(2, INPUT_PULLUP);                 // input pin for button
 
  AFMS.begin();                             // intialize motor shield
  myMotor->setSpeed(100);                   // set RPM
 
  pinMode(LED_BUILTIN, OUTPUT);             // built-in LED
}

void loop() {
    digitalWrite(LED_BUILTIN, LOW);             // turn built-in LED off
    Serial.println(buttonState);
   
    while(digitalRead(2) == LOW) //button pressed
    {
      Serial.println(buttonState);
      digitalWrite(LED_BUILTIN, HIGH);   // turn the built-in LED on
   
    // turn motor
    myMotor->step (30, FORWARD, DOUBLE);
    }
    Serial.println(buttonState);
}

Techguy817
 
Posts: 17
Joined: Fri Oct 16, 2020 11:44 pm

Re: Run stepper on button press stop working

by adafruit_support_bill on Thu Oct 22, 2020 8:14 pm

The i2c pins (SDA and SCL) look OK. But the 5v and GND pins on the "POWER" section of the headers do not appear to have flowed well onto the solder pad. The i2c bus needs solid connections on GND, 5v, SDA and SCL to function reliably. The most common cause of the processor hanging during i2c communication is a marginal connection on the i2c bus.

adafruit_support_bill
 
Posts: 81528
Joined: Sat Feb 07, 2009 10:11 am

Re: Run stepper on button press stop working

by Techguy817 on Fri Oct 23, 2020 2:15 pm

resolder2.jpg
resolder2.jpg (527.25 KiB) Viewed 34 times
resolder1.jpg
resolder1.jpg (413.84 KiB) Viewed 34 times


I've reworked the soldering job again but still the same issue.

Does the soldering look better now?

I'd gladly purchase a version of the motor shield with stackable headers already soldered on if that's an option.

Can you confirm if my code should work as expected?

Thanks.

Techguy817
 
Posts: 17
Joined: Fri Oct 16, 2020 11:44 pm

Re: Run stepper on button press stop working

by adafruit_support_bill on Fri Oct 23, 2020 3:29 pm

The soldering looks good and I don't see any problems in the code. We can try replacing the shield. Please contact support@adafruit.com with a link to this thread.

adafruit_support_bill
 
Posts: 81528
Joined: Sat Feb 07, 2009 10:11 am

Re: Run stepper on button press stop working

by Techguy817 on Fri Oct 23, 2020 4:38 pm

I have an additional brand new motor shield on-hand as my plan was to stack these once I got things working. I just soldered on the headers to that one and am experiencing the exact same issue. :(

newboardsolder2.jpg
newboardsolder2.jpg (636.78 KiB) Viewed 33 times


newboardsolder1.jpg
newboardsolder1.jpg (840.12 KiB) Viewed 33 times

Techguy817
 
Posts: 17
Joined: Fri Oct 16, 2020 11:44 pm

Re: Run stepper on button press stop working

by franklin97355 on Fri Oct 23, 2020 5:17 pm

Some of the pins look solder starved. Take a look at the Soldering Guide and see if you agree. Post back if there is a change (or if there isn't)

franklin97355
 
Posts: 21949
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: Run stepper on button press stop working

by Techguy817 on Fri Oct 23, 2020 6:48 pm

Ok so I just tried hooking things up to an Uno board and it seems to work fine there. I guess this Leonardo board is either defective or can't handle these kinds of programs. Probably more defective if I'd have to guess. Thank you all for your assistance.

Techguy817
 
Posts: 17
Joined: Fri Oct 16, 2020 11:44 pm

Re: Run stepper on button press stop working

by adafruit_support_bill on Sat Oct 24, 2020 3:25 pm

The shield is compatible with the Leonardo - assuming it is an R3 or later model. From your photos, that appears to be the case. It has dedicated SDA and SCL pins near the reset button.

adafruit_support_bill
 
Posts: 81528
Joined: Sat Feb 07, 2009 10:11 am

Please be positive and constructive with your questions and comments.