Problems with Stepper Motor and DCPump

Hello everyone,

After getting to work with arduinos in university, I got quite interested and wanted to make a project myself.
And since my plants allways die of dehydration i choose to engineer an arduino that waters plants for me.

In hindsight there are probably better ways to do this but I wanted to use a steppermotor with a spindle to move a hose from pot to pot. And a simple pump to push the water into the pots. It’s controlled by an uno combined with an ancient adafruit v1clone. (Therefore I’m using the old library)

The code itself was pretty easy and quickly done. The problem just arised as i was trying my system on a test build.

If I power the system via usb(PC) the pump barely has enough power to lift the water 3cm, the stepper is silent and doing its job of moving the hose good.
But if I power it via 9v 1A the Stepper Motor is absurdly loud and stuttering sometimes, while the pump is shooting water.
Both ways I power the arduino (not the motor shield) directly if this makes a difference please let me know.

I got an arduino mega and adafruit v2.3 motor shield from university. I allready tried to fit my parts on this combination but it was the same outcome.

I guess in one scenario I’m underpowering both parts and in the other one I’m overpowering them.

The dc pump is pretty cheap and I don’t really care if it dies someday, the stepper is the Quimat nema 17 qd04, bipolar, 200steps/rotation, phase of 2A.

Now to my question:
Is there a way to keep the stepper silent while using 9v1a?
i allready tried all the Stepper settings (Single Double...) it doesnt help at all ^^
Maybe by cutting the maximum voltage/current if yes is this possible in programming or do I need other parts ?

Thank you in advance

#include <AFMotor.h>
#include <ArduinoSTL.h>
using namespace std;

vector<int> Potwatertime {200, 2, 2, 2, 2, 2};
int place;
int check;
int waterio;

AF_DCMotor MotorPump1(1, MOTOR12_64KHZ);
AF_DCMotor MotorPump2(2, MOTOR12_64KHZ);
AF_Stepper MotorStepper(200, 2);

void setup() {
  // put your setup code here, to run once:
  MotorPump1.setSpeed(200);
  MotorPump2.run(RELEASE);
  MotorPump2.setSpeed(200);
  MotorPump2.run(RELEASE);
  MotorStepper.setSpeed(20);
  pinMode(2, INPUT_PULLUP);
  pinMode(13, OUTPUT);
  place = 0;
  check = 1;
}

void loop() {
  if (digitalRead(2) == LOW) {

    while (place<=4){
      water(Potwatertime[place]);
      if (place==5){
        break;
      }
      nextPosition();
    }
    backtostart();      
  }
}

void water(int timetowater) {
  MotorPump1.run(FORWARD);
  MotorPump2.run(FORWARD);
  
  while (timetowater >= 1) {
    delay(1000);
    timetowater = timetowater - 1;
  }
  MotorPump1.run(RELEASE);
  MotorPump2.run(RELEASE);
}

void backtostart() {
  while (place >= 1) {
    MotorStepper.step(4750, FORWARD, SINGLE);
    place = place - 1;
  }
}

void nextPosition() {
  if (place <= 5) {
    MotorStepper.step(4750, BACKWARD, SINGLE);
    place = place + 1;
  }
}

How is all this connected and powered? Neither the pump nor the stepper should be getting power from the Arduino.

I got an Adafruit Motor shield v1, which is backpacked(? i dont know the technical term ^^) by the uno.
should i power the shield seperately ?
The project i did in uni worked pretty well with just the usb powered arduino and backpacking a Motor shield.

Motor shields generally have a place to plug in external power for the motors. Is that what you're using?

Just be aware that the AF_Stepper library appears to be a blocking library. That is once you call step( ) nothing else will happen until that call returns.
Might be fine for your application, but if you ever want to say respond to user commands while the stepper is running then you should move to the AccelStepper library and check out my tutorial on Multi-tasking in Arduino which has a complete stepper example controlled by user input and a temperature sensor.

Can you provide a link to the stepper motor data? If it has a phase current of 2A, it needs a current driver. Neither the V1 nor the V2.3 shield from Adafruit is suitable for such a stepper.

Then you need at least a DRV8825 driver set to 1.5A. A motor shield is useless for a low-impedance stepper like this, you must use a current-controlling stepper driver.

Steppers are power hungry and you'll probably want a 12V / 18V / 24V supply to power the stepper driver.

Don't attempt to power any motor from Arduino 5V.

Stepper noise can be greatly reduced by using microstepping, but steppers are always noisy by their nature.

Thank you all for the answers :slight_smile:

Blockquote
Motor shields generally have a place to plug in external power for the motors. Is that what you're using?

The v1 just has 2 screwconnections where you can connect the power, if its not necessary i wouldnt want to cut a power cable...
L293D-Motor-Driver-Shield-Power-Supply-Terminals

Blockquote
Just be aware that the AF_Stepper library appears to be a blocking library. That is once you call step( ) nothing else will happen until that call returns.

Yeah im fine with that.

Blockquote
Can you provide a link to the stepper motor data? If it has a phase current of 2A, it needs a current driver. Neither the V1 nor the V2.3 shield from Adafruit is suitable for such a stepper.

Im afraid thats all i got. ordered it from amazon and i couldnt find any further links.

I just dont get why it works smoothly when i power the arduino via usb and it literally sounds like its trying to eat itself when i plug it into the wall...

All I really need to fix my problem is to limit the voltage/current for the stepper to usb-like levels, while keeping the power for the pump high.
Is this possible with the adafruit motorshield v1 ? Maybe even a software solution?

Blockquote
Then you need at least a DRV8825 driver set to 1.5A. A motor shield is useless for a low-impedance stepper like this, you must use a current-controlling stepper driver.

well in this case i Should be downgrading my stepper, I guess. whats a stepper that works fine with this shield?

Blockquote
Don't attempt to power any motor from Arduino 5V.

far too late for that ^^
still all parts working though (as far as i can test)

Blockquote
Stepper noise can be greatly reduced by using microstepping, but steppers are always noisy by their nature.

well i could maybe live with the noise if the stepper wouldnt stutter ^^

That motor will never work properly without enough current, so you absolutely need a separate power supply. If you don't want to take our advice you don't have to, but the laws of physics won't change for your convenience!

Well i got it working properly (maybe not like its intended to operate, but fitting for my workcase) with usb powered arduino 5V.
maybe it doesnt have all the power but it just has to move a small hose...

But I got the message, get a better driver and a second power line. will try as soon as i can order parts.

At this point im just corious:
why does it "work"(yeah its probably not the right way but it still gets the work done) with the small voltage/currents the arduino can provide?
and why does it get loud and stutterign if i plug the arduino into the wall?

To operate a stepper correctly, you must know its electrical data. It does not make sense to buy a stepper and not knowing its data. The data in your link is inconsistent. Amazon says 12V/0,4A. But if you look for the Part Number on the photos you get this data:

That's completely different. What is printed on the label of your motor?

I am also new to stepper motor, and I am just curious have you ever tried different motor speed? I guess the acoustic / resonating properties of the motor may be different under different load and speed. The motor spec may also suggest something which should be your best reference. A quick try on some other motor speed may give us some hints, too. :grinning:

If noise from a stepper motor seems to be a problem, spend some time and effort on mounting the motor so it does not transmit the vibration to it's surroundings.
Paul

Thats a lesson learned.

17HS19-2004S1 I allready found some datasheets with this code, but none really state the operating voltage.

I tried all 4 Modes (SINGLE DOUBLE INTERLEAVE MICROSTEP) and at least 3 different motor speeds. all were loud and stuttering.
The volume is bad, but the stuttering and therefore loosing the possibility to track the position is the real problem.

Hi,
@murk089



Tom.. :smiley: :+1: :coffee: :australia:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.