Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.0

by LAser on Wed Oct 30, 2013 3:21 pm

Hello,

I have a problem and maybe you can help me. To my Project:
I am using an Arduino Uno Board to control an actuator. For the controlling I use a "Adafruit Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.0". My Motor sends an encoder signal and for reading this signal I wrote an interrupt which counts the position. in the interrupt I am comparing the actuator position with the set point. I tried to set the speed in the interrupt to zero but this doesn't work (perhaps you know who to do it). in the moment I check in the loop if the set point is reached but this needs to much time. So I need a very fast solution to stop the motor.

Code: Select all | TOGGLE FULL SIZE
 
 void loop() { 

    if(sw_setpoint == 0){
       myMotor->setSpeed(0);
        sw_setpoint = 1;}

// Code...

}


// The interrupt
SIGNAL(INT0_vect)
    {
      //Port D pin 2 is high since this is a rising interrupt
      if (PIND & 0x10)    //if pin 4 and pin2 is high
        encoder0Pos++;    //encoder is moving forward position is increasing
      else
        encoder0Pos--;    //encoder is moving backward position is decreasing
       if(encoder0Pos == pos_setpoint){
        sw_setpoint = 0;
      //myMotor->setSpeed(0); Why is this not possible? Is it maybe possible to do it in an other way ?
        }
       
       
    }
\


Thank you very much. If you can help me I would be very happy :)
LAser
 
Posts: 47
Joined: Tue Sep 10, 2013 3:07 pm

Re: Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.0

by adafruit_support_bill on Wed Oct 30, 2013 3:59 pm

What kind of motor is it? Post your whole code.
User avatar
adafruit_support_bill
 
Posts: 28872
Joined: Sat Feb 07, 2009 9:11 am

Re: Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.0

by LAser on Thu Oct 31, 2013 12:33 pm

It is a DC servo motor. The code is just a view If statement and a serial interface, so I think I already posted the important code and situation. The problem is that I want to stop the motor as fast as possible. Maybe you can help me.
LAser
 
Posts: 47
Joined: Tue Sep 10, 2013 3:07 pm

Re: Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.0

by adafruit_support_bill on Thu Oct 31, 2013 12:51 pm

DC motors do not stop on a dime. When you set the speed to zero, they coast to a stop. You need to gradually reduce the speed as you approach the setpoint so that you don't overshoot by too much. Most servo implementations use some variation on PID control.
User avatar
adafruit_support_bill
 
Posts: 28872
Joined: Sat Feb 07, 2009 9:11 am

Re: Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.0

by LAser on Mon Nov 04, 2013 9:53 am

is it possible to use a goto in the interrupt?
LAser
 
Posts: 47
Joined: Tue Sep 10, 2013 3:07 pm

Re: Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.0

by adafruit_support_bill on Mon Nov 04, 2013 10:31 am

Where do you want to goto? You need to keep your interrupt service routine as short as possible. Interrupts are disabled while you are in there and if you take too long you will miss interrupts.
User avatar
adafruit_support_bill
 
Posts: 28872
Joined: Sat Feb 07, 2009 9:11 am

Re: Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.0

by elmimiliano on Sat Nov 09, 2013 7:30 pm

Hello,

I have a problem and maybe you can help me. To my Project:
I am using an Arduino Uno Board to control an actuator. For the controlling I use a "Adafruit Motor/Stepper/Servo Shield: i have this motor (http://www.nmbtc.com/pdf/motors/PM42S-048-HHC8.pdf). So, how you can see...this motor need 24v to works...i'm right??? (iḿ new, jeje). So, can i move my motor without external supṕlied energy, or i need to connect it to my Adafruit shield??? Thanks
elmimiliano
 
Posts: 2
Joined: Fri Nov 08, 2013 3:19 pm

Re: Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.0

by adafruit_support_mike on Sat Nov 09, 2013 11:33 pm

Please don't post the same question in more than one thread.

In direct answer to your question, the Motor Shield v2 can't drive a 24v motor. The highest voltage it can control is 15v, and it prefers to stay at 12v or below.
When you void a product warranty, you give up your right to sue the manufacturer if something goes wrong and accept full responsibility for whatever happens next. And then you truly own the product.
User avatar
adafruit_support_mike
 
Posts: 9000
Joined: Thu Feb 11, 2010 1:51 pm

Re: Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.0

by arek3city on Thu Nov 14, 2013 4:14 pm

Hello
I need to use two stepper motors at the same time, with the other parameters
Is it possible?
I have Motor Shield v.1 and he did not support.
in version 1 his work in sequence, firs work stepper one, and when is stop, start work stepper two.
I need to use two stepper motors at the one time (stepper one work and stepper two work - independently)
I try use timers but is not work with Motor shield v1
Dit it work with Motor shield v2?

Sorry for my english ;)
arek3city
 
Posts: 1
Joined: Thu Nov 14, 2013 3:45 pm

Re: Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.0

by adafruit_support_bill on Thu Nov 14, 2013 4:40 pm

You can do this with both old and new versions of the shield. You can either use AccelStepper or manage the step timing yourself and call oneStep().
User avatar
adafruit_support_bill
 
Posts: 28872
Joined: Sat Feb 07, 2009 9:11 am

Re: Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.0

by LAser on Thu Nov 21, 2013 9:22 am

Is it possbile to controll a dc motor with the three connections of the stepper motor which are on top of the shield?
LAser
 
Posts: 47
Joined: Tue Sep 10, 2013 3:07 pm

Re: Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.0

by adafruit_support_bill on Thu Nov 21, 2013 9:42 am

Is it possbile to controll a dc motor with the three connections of the stepper motor which are on top of the shield?

Not sure what you mean. Most steppers require 4 or 5 connections and use H-bridge channels of the controller. DC motors need only 2 connections and use just 1 H-bridge channel. You can connect up to 4 DC motors to each shield.
User avatar
adafruit_support_bill
 
Posts: 28872
Joined: Sat Feb 07, 2009 9:11 am

Re: Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.0

by LAser on Thu Nov 21, 2013 9:54 am

i am sorry I mean the RC servo PINs. So is it possible to control a dc motor with this three pins?
LAser
 
Posts: 47
Joined: Tue Sep 10, 2013 3:07 pm

Re: Motor/Stepper/Servo Shield for Arduino v2 Kit - v2.0

by adafruit_support_bill on Thu Nov 21, 2013 10:18 am

No, not a regular DC motor.
User avatar
adafruit_support_bill
 
Posts: 28872
Joined: Sat Feb 07, 2009 9:11 am