Can't wire my stepper motor to make it work!

Hello i am very novice with arduino and need to get a stepper motor working for a project im working on.

So far i have soldered 4 pins into place, but im not sure how to finish it… i’ve tried a couple of ways and the leds flash and the motor murrrss and sounds a bit sick!

if someone could let me know where i need to put the pins to finish it properly i would be very grateful! thanks :slight_smile:

please see the attached photo for what i have so far…

also im wondering if i need to add a battery to power it? or can my computer power it?

You bought that in ebay, didn’t you?
I found the schematic for the correct conection. I recomend you not to use the pins 0 and 1 of the Arduino, because they are for communication purpouse (yes, they may be used as digital output but I do not recommend).

That motor needs 5[V] so the 5V output from the Arduino should be fine. I guess the USB suplpy should be enough. Connect VCC to 5[V] (white wire?) and GND to the arduino GND (black wire?).

If the trouble keeps on, maybe the problem is the code. Go to examples, and use the Stepper library and try the examples.

Regards.

Hello i am very novice with arduino and .......

I can't be bothered to read the how to use this forum sticky post so I don't know to size pictures so that they are usable by others.

I also don't know anything about posting schematics and code to help people help me find out what I am doing wrong. Which I might have learned about if I had read the aforementioned sticky post.

Grumpy_Mike:

Hello i am very novice with arduino and .......

I can't be bothered to read the how to use this forum sticky post so I don't know to size pictures so that they are usable by others.

I also don't know anything about posting schematics and code to help people help me find out what I am doing wrong. Which I might have learned about if I had read the aforementioned sticky post.

wow, someone is in a bad mood :).

Lucy is a newbie, she obviously doens't know anything about posting code, schematic and so on. She'll learn eventually give her a time.

Thanks for your help Mart! (and for sticking up for me!) ... didn't realise you got bullies on arduino forums :P !

Yeah i did get it from ebay. ive put the pins into 2,3,4,5 of the arduino and tried the black wire (which is soldered to -ve on the motor board) in 5v and the white +ve in arduino grnd -- in this instance the little orange light and green light on arduino just fade out

and i tried the -ve wire in arduino grnd and +ve wire in 5v and then the leds on the motor board flash red like crazy and the motor wurrs a bit

so i dont think either is ok??

thanks again and sorry i dont know any of the language!

I can easily understand @GrumpyMike's comments.

Computer programming requires attention to detail and the ability to do research. Reading the stickies is evidence of those traits and of the value of the free assistance you are hoping to get.

You can't power a stepper from the Arduino 5v - it will draw too much current and cause all sorts of strange effects. Motors and servos used with Arduinos need their own power supply.

...R

Lucy: Thanks for your help Mart! (and for sticking up for me!) ... didn't realise you got bullies on arduino forums :P !

Yeah i did get it from ebay. ive put the pins into 2,3,4,5 of the arduino and tried the black wire (which is soldered to -ve on the motor board) in 5v and the white +ve in arduino grnd -- in this instance the little orange light and green light on arduino just fade out

and i tried the -ve wire in arduino grnd and +ve wire in 5v and then the leds on the motor board flash red like crazy and the motor wurrs a bit

so i dont think either is ok??

thanks again and sorry i dont know any of the language!

Please show us the code you uploaded to Arduino.

wow i wish i had never posted on here you are all being so rude. i do not wish to become some arduino geek i simply need to get a motor working to use in a design project.

sorry to bother any of you. i suggest in future if you dont have anything nice to say don't say it at all

i am using the arduino example code for stepper motor and only changing the pin numbers from 8-11 to 2-5

/*
Stepper Motor Control - one revolution

This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 11 of the Arduino.

The motor should revolve one revolution in one direction, then
one revolution in the other direction.

Created 11 Mar. 2007
Modified 30 Nov. 2009
by Tom Igoe

*/

#include <Stepper.h>

const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 8,9,10,11);

void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}

void loop() {
// step one revolution in one direction:
Serial.println(“clockwise”);
myStepper.step(stepsPerRevolution);
delay(500);

// step one revolution in the other direction:
Serial.println(“counterclockwise”);
myStepper.step(-stepsPerRevolution);
delay(500);
}

thanks again mart !!

The code you have posted uses pins 8-11 whereas your comment seems to say you are using pins 2-5. That makes me wonder if you have shown us the example code, or your own actual code. There can be “many a slip twixt cup and lip” so it is important to show your actual code.

Also it would be very useful if you make a clear pencil drawing of how everything is actually connected and post a photo of the drawing.

…R

Thank for your help Robin :slight_smile: here is exactly what i tried to play …

/*
Stepper Motor Control - one revolution

This program drives a unipolar or bipolar stepper motor.
The motor is attached to digital pins 8 - 11 of the Arduino.

The motor should revolve one revolution in one direction, then
one revolution in the other direction.

Created 11 Mar. 2007
Modified 30 Nov. 2009
by Tom Igoe

*/

#include <Stepper.h>

const int stepsPerRevolution = 200; // change this to fit the number of steps per revolution
// for your motor

// initialize the stepper library on pins 8 through 11:
Stepper myStepper(stepsPerRevolution, 2,3,4,5);

void setup() {
// set the speed at 60 rpm:
myStepper.setSpeed(60);
// initialize the serial port:
Serial.begin(9600);
}

void loop() {
// step one revolution in one direction:
Serial.println(“clockwise”);
myStepper.step(stepsPerRevolution);
delay(500);

// step one revolution in the other direction:
Serial.println(“counterclockwise”);
myStepper.step(-stepsPerRevolution);
delay(500);
}

i have done a quick drawing… not like the real ones though! it is a bit small if you cant read it easy i will do a bigger /clearer one

cheers

Take the black wire and attache it to the arduino ground. Then attach the white wire to the positive of a power supply giving anything between 5 to 12 Volts. Attach the negative wire of power supply to the arduino ground.

That diagram does not match up with your photograph, the photograph shows you using pin 1.

it is a bit small

Click on that picture and maybe you will revise that statement.

even grumpy mike has cheered up :slight_smile: thanks for your help.

i changed from using pin 1,2,3,4 to using 2,3,4,5 when mart said best not use 0 and 1

here is a picture of what i tried attaching it to a battery… but the leds still flash red like something is wrong, maybe that battery isnt strong enough? (this is without even trying to run the arduino code) it is just from plugging it in

(my actual drawing was a bit small but it came out ok in photo)

Hi, do all the LEDs flash, if so then the output of thre driver chip is working, that is pulsing the relevant wires to the stepper motor. Does the motor appear to buzz or move at all, the LEDs I think you will find are red LEDs. Can I make a suggestion, you use pins 8 to 11 as per the sketch originally and see if it works.

Tom....... :)

thanks tom,

just tried it with the pins in 8-11... the LEDs dont flash when i have them in these pins (when they are flashing the motor is wurring slightly too) and when i try to run the code it says this at the bottom...

Binary sketch size: 3,440 bytes (of a 32,256 byte maximum) avrdude: stk500_recv(): programmer is not responding

Thank tom!

tried the pins in 8-11 and the leds dont flash. and when i try to play the example code it says this at the bottom...

Binary sketch size: 3,440 bytes (of a 32,256 byte maximum) avrdude: stk500_recv(): programmer is not responding

tried playing the code again with it plugged in to 2,3,4,5 (while the leds are flashing) but it says the same thing :/

Have you tried unplugging the Arduino from the PC and closing the Arduino IDE?

Can you upload a different sketch?

And you are still posting huge picture files. Reduce them to 640x480 pixels before posting so we can open them quickly.

...R

I think its nearly working now, restarted the software and tried the different examples, all of them make the leds flash to some extent and the motor buzzes slightly, but it just doesnt give any movement? maybe its dodgy

Hi, i have found that I have the same board and stepper, so I set it up, it did work, but there was no direction change. Try this sketch, that I found ages ago and moded so that it runs without a speed pot. Used pins 2,3,4,5 and see what happens, this stepper is 5V and I am able to run it off the arduino 5V.

/* 
 Stepper Motor Control - speed control

 This program drives a unipolar or bipolar stepper motor. 
 The motor is attached to digital pins 2 - 5 of the Arduino.
 A potentiometer is connected to analog input 0.

 The motor will rotate in a clockwise direction. The higher the potentiometer value,
 the faster the motor speed. Because setSpeed() sets the delay between steps.

 */


int IP1;
int IP2;
int IP3;
int IP4;
int val;
int ddelay;
int dddelay;

void setup() {
  // nothing to do inside the setup
  IP1=2;
  IP2=3;
  IP3=4;
  IP4=5;
  Serial.begin(9600);
  pinMode(IP1,OUTPUT);
  pinMode(IP2,OUTPUT);
  pinMode(IP3,OUTPUT);
  pinMode(IP4,OUTPUT);
}

void loop() {
//  val = analogRead(0);
val=1000;   //   Sets speed 0 to 1000
  ddelay = map(val, 0, 1006, 500, 3);
  dddelay =constrain(ddelay,3,500);
    Serial.print(dddelay);
    Serial.print("  ");
    Serial.println(val);

  digitalWrite(IP1, HIGH);
  digitalWrite(IP2, HIGH);
  digitalWrite(IP3, LOW);
  digitalWrite(IP4, LOW);
  delay(dddelay);
//   val = analogRead(0);
  ddelay = map(val, 0, 1006, 500, 3);
  dddelay =constrain(ddelay,3,500);
    Serial.print(dddelay);
    Serial.print("  ");
    Serial.println(val);
  digitalWrite(IP1, LOW);
  digitalWrite(IP2, HIGH);
  digitalWrite(IP3, LOW);
  digitalWrite(IP4, LOW);
  delay(dddelay);
//   val = analogRead(0);
  ddelay = map(val, 0, 1006, 500, 3);
dddelay =constrain(ddelay,3,500);
    Serial.print(dddelay);
    Serial.print("  ");
    Serial.println(val);
  digitalWrite(IP1, LOW);
  digitalWrite(IP2, HIGH);
  digitalWrite(IP3, HIGH);
  digitalWrite(IP4, LOW);
  delay(dddelay);
 //  val = analogRead(0);
  ddelay = map(val, 0, 1006, 500, 3);
  dddelay =constrain(ddelay,3,500);
    Serial.print(dddelay);
    Serial.print("  ");
    Serial.println(val);
  digitalWrite(IP1, LOW);
  digitalWrite(IP2, LOW);
  digitalWrite(IP3, HIGH);
  digitalWrite(IP4, LOW);
  delay(dddelay);
//   val = analogRead(0);
  ddelay = map(val, 0, 1006, 500, 3);
  dddelay=constrain(dddelay,3,500);
    Serial.print(ddelay);
    Serial.print("  ");
    Serial.println(val);
  digitalWrite(IP1, LOW);
  digitalWrite(IP2, LOW);
  digitalWrite(IP3, HIGH);
  digitalWrite(IP4, HIGH);
  delay(dddelay);
//   val = analogRead(0);
  ddelay = map(val, 0, 1006, 500, 3);
  dddelay=constrain(ddelay,3,500);
    Serial.print(dddelay);
    Serial.print("  ");
    Serial.println(val);
  digitalWrite(IP1, LOW);
  digitalWrite(IP2, LOW);
  digitalWrite(IP3, LOW);
  digitalWrite(IP4, HIGH);
  delay(dddelay);
//   val = analogRead(0);
  ddelay = map(val, 0, 1006, 500, 3);
  dddelay=constrain(ddelay,3,500);
    Serial.print(dddelay);
    Serial.print("  ");
    Serial.println(val);
  digitalWrite(IP1, HIGH);
  digitalWrite(IP2, LOW);
  digitalWrite(IP3, LOW);
  digitalWrite(IP4, HIGH);
  delay(dddelay);
//   val = analogRead(0);
  ddelay = map(val, 0, 1006, 500, 3);
  dddelay=constrain(ddelay,3,500);
    Serial.print(dddelay);
    Serial.print("  ");
    Serial.println(val);
  digitalWrite(IP1, HIGH);
  digitalWrite(IP2, LOW);
  digitalWrite(IP3, LOW);
  digitalWrite(IP4, LOW);
  delay(dddelay);
}

val is set to 1000, the lower the value the slower the speed, so you can see the stepper control strobe.

Hope it helps.

Tom... :)