Go Down

Topic: Arduino Uno not being abel to operate a motor. (Read 4375 times) previous topic - next topic

Fradaren

Hello Forum!

I have been trying to operate a bipolar stepper motor with a arduino uno, oddly the arduino only sends a signal of 2.5V (which i meassured with a voltagemeter over the arduinos digital pins and ground) when i should send 5V (according to arduinos website and code)

I have been using follow schematic:


and the following code on this page
http://arduino.cc/en/Tutorial/MotorKnob

Also i have been using this motor:
http://www.electrokit.com/productFile/download/2680


I have for a couple of weeks been searching for errors but haven´t been able to find any except the one the voltage problem with the arduino.
I would like some suggestions on what i may have overlooked to why it won´t run the motor or why the signal from the arduino only is 2.5V.

All help i appreciated greatly!  :)

Robin2

You haven't said how you are providing power for the motor and I wonder if you are expecting it to come from the Arduino?

An Arduino can't provide enough power for any motor. You need to have a separate power supply connected to the "motor supply" pin of the h-bridge. And the ground for that power supply must be connected with the Arduino ground so there is a common point of reference.

If you already have a suitable power supply then you need to tell us what Arduino pin is showing 2.5 volts and why you think it should be 5v. Bear in mind that if the Arduino is sending a rapid train of on-off pulses your meter will be reading the average voltage.

A h-bridge is far from an ideal device for driving a stepper motor. Much better (and easier) to use a proper stepper motor driver such as the Pololu A4988. I haven't checked your motor spec. so I am not claiming it is suitable in your case, but it will give you the right idea.

...R
Two or three hours spent thinking and reading documentation solves most programming problems.

johnwasser

Are you connecting to Arduino pins 8,9,10,&11 as specified in the sketch or pins 1,2,3,&4 as shown in the diagram?
Send Bitcoin tips to: 1G2qoGwMRXx8az71DVP1E81jShxtbSh5Hp

MarkT

If you are running the Arduino at 5V and driving a pin HIGH, and its reading 2.5V, then
you are overloading the pin and could be damaging it.  Its actually more likely that
the pin is configured as an INPUT and the SN764410 input stage is holding it at 2.5V
(this chip is TTL and TTL inputs source current upto about that voltage)
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Fradaren


You haven't said how you are providing power for the motor and I wonder if you are expecting it to come from the Arduino?

An Arduino can't provide enough power for any motor. You need to have a separate power supply connected to the "motor supply" pin of the h-bridge. And the ground for that power supply must be connected with the Arduino ground so there is a common point of reference.

If you already have a suitable power supply then you need to tell us what Arduino pin is showing 2.5 volts and why you think it should be 5v. Bear in mind that if the Arduino is sending a rapid train of on-off pulses your meter will be reading the average voltage.

A h-bridge is far from an ideal device for driving a stepper motor. Much better (and easier) to use a proper stepper motor driver such as the Pololu A4988. I haven't checked your motor spec. so I am not claiming it is suitable in your case, but it will give you the right idea.

...R


We get power to the motor through a "power cube". I'm not sure what it is called though. But we can change the output current and we have been able to move the motor with the cube through switching which ends we power. We also connected the ground of the cube to the ground of the circuit and the Arduino.

It's very probable that the voltage meter is not fast enough. We have gotten a new Arduino as the last one dissapeared.

Fradaren


Are you connecting to Arduino pins 8,9,10,&11 as specified in the sketch or pins 1,2,3,&4 as shown in the diagram?


We're connecting them to 8, 9, 10 and 11 as specified in the sketch.

Fradaren


If you are running the Arduino at 5V and driving a pin HIGH, and its reading 2.5V, then
you are overloading the pin and could be damaging it.  Its actually more likely that
the pin is configured as an INPUT and the SN764410 input stage is holding it at 2.5V
(this chip is TTL and TTL inputs source current upto about that voltage)


We're just using this code. A slight modification of the example.

Code: [Select]
#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 200

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepper(STEPS, 8, 9, 10, 11);

void setup()
{
  // set the speed of the motor to 30 RPMs
  stepper.setSpeed(30);
}

void loop()
{
  // move a number of steps equal to the change in the
  // sensor reading
  stepper.step(10);
}



Robin2

#7
Jan 09, 2014, 08:26 pm Last Edit: Jan 09, 2014, 09:07 pm by Robin2 Reason: 1
From the various problems people seem to have with stepper motors I can't help feeling that beginners would be better off writing their own code rather than using the various stepper libraries which, while trying to simplify things don't in fact do so.

The normal Servo library, in contrast, works very well - but that is probably because a servo just needs a single connection so there is nothing to confuse.

When you know how to drive your stepper with your code you will be well equipped to use the stepper libraries if they offer advantages.

If it's any help the following code will drive a stepper motor through a Pololu A4988 stepper driver board (and presumably any board that just requires step and direction signals). It is easy to change the number of steps and the number of miiliseconds between steps to vary the speed.

I have used the wiring arrangements on this Pololu page http://www.pololu.com/product/1182

Code: [Select]
// testing a stepper motor with a Pololu A4988 driver board
// on an Uno the onboard led will flash with each step

byte directionPin = 9;
byte stepPin = 8;
int numberOfSteps = 50;
byte ledPin = 13;
int pulseWidthMicros = 50;  // microseconds
int millisbetweenSteps = 50; // milliseconds

void setup()
{

  Serial.begin(9600);
  Serial.println("Starting StepperTest");
  digitalWrite(ledPin, LOW);
 
  delay(2000);

  pinMode(directionPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
 

  digitalWrite(directionPin, HIGH);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(pulseWidthMicros);
    digitalWrite(stepPin, LOW);
   
    delay(millisbetweenSteps);
   
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
 
  delay(3000);
 

  digitalWrite(directionPin, LOW);
  for(int n = 0; n < numberOfSteps; n++) {
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(pulseWidthMicros);
    digitalWrite(stepPin, LOW);
   
    delay(millisbetweenSteps);
   
    digitalWrite(ledPin, !digitalRead(ledPin));
  }
 
}

void loop()
{

}


...R
Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up