Society of Robots - Robot Forum

Software => Software => Topic started by: coolnerd on April 24, 2013, 10:04:37 AM

Title: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: coolnerd on April 24, 2013, 10:04:37 AM
Hello my fellow robot builders,
am doing a project and ive connected my arduino to the motors but when i compile the C code, my stepper motor vibrates but doesnt do nothing, i ve used the code code from the arduino library and edited but i still cant manage to make it move forward.
Please please Help!!! :(((
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: jkerns on April 24, 2013, 10:16:44 AM
A lot more information is needed.

How are the motors connected? What kind of driver are you using? What kind of motor?

Include a copy of your software.

Now, have you read the data sheet for the motor driver? Is it connected correctly? How fast are you sending pulses? What does the motor data sheet say about starting it up?
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: coolnerd on April 24, 2013, 11:31:36 AM
We are using stepper motors, first we had to build a motor circuit using the schematic that was provided via lecture notes, the motors work well when connected to the motor circuit. but when wen we connected the direction wire and clock wire  from the motor circuit into the arduino pins thats when it vibrates, we are using C programming.
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: newInRobotics on April 24, 2013, 02:44:19 PM
[...] first we had to build a motor circuit using the schematic that was provided via lecture notes [...]
Can You post circuit diagram? Now we have no idea what You're talking about.

[...] the motors work well when connected to the motor circuit.
Again, circuit diagram would help a lot.

but when wen we connected the direction wire and clock wire  from the motor circuit into the arduino pins thats when it vibrates
If driver circuit works without Arduino, how come You need to connect it to Arduino, or are these different circuits You are talking about?

[...] we are using C programming.
Posting source code would get You answers much faster.
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: coolnerd on April 25, 2013, 06:19:07 PM

#define stepPin 4
#define dirPin 5

void setup() {
  Serial.begin(9600);
  Serial.println("Starting stepper exerciser.");

  pinMode(stepPin, OUTPUT);
  pinMode(dirPin, OUTPUT);

  digitalWrite(dirPin, HIGH);
  digitalWrite(stepPin, LOW);
}

void loop() {
      digitalWrite(stepPin, HIGH);
      delayMicroseconds(50000);
      digitalWrite(stepPin, LOW);
      delayMicroseconds(50000);

    delay(5);

  }
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: coolnerd on April 25, 2013, 06:40:05 PM
Here are a few pics to show the robot...i just need a code in C programming that will make it move forward or backward or even make a 90degree turn
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: coolnerd on April 25, 2013, 06:45:00 PM
Here is the motor circuit i was talking about but we managed to fix it but i just thought i shud upload a picture for u to know what i was talking about.
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: jwatte on April 25, 2013, 07:29:02 PM
If a stepper motor is just vibrating, and not moving smoothly in one direction, then some of the wires are hooked up wrong, or you're driving the wires in the wrong order, which ends up being equivalent.
The simple thing to do is to permute your wiring, until you get a working hook-up, and then write that down as the proper connections. This is assuming that your driver itself is outputting a proper cadence. (+A, +B, -A, -B, repeat, for example.)

Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: Pogertt on April 26, 2013, 07:47:48 AM
Try changing:

delay(5)

to:

delay(500)

and see what happens.

Pogertt
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: coolnerd on April 27, 2013, 05:29:26 AM
hi ya...@ Jwatte, we have connected the wires correctly and also tried to make changes to the code but sometimes it jst stops working:(((((
@ Pogertt...we have changed the delays but it still vibrates
Any one who can PLEASE be able to send me a new code in C programming i can try out. I'll be greatful.
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: newInRobotics on April 27, 2013, 05:59:50 AM
Any one who can PLEASE be able to send me a new code in C programming i can try out. I'll be greatful.
You did not send us stepper motor driver circuit diagram, so how possibly we can come up with the code for it?
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: Pogertt on April 27, 2013, 10:11:17 AM
We are using stepper motors, first we had to build a motor circuit using the schematic that was provided via lecture notes, the motors work well when connected to the motor circuit. but when wen we connected the direction wire and clock wire  from the motor circuit into the arduino pins thats when it vibrates, we are using C programming.


Sounds like you were able to get the motors to rotate before connecting to  your arduino.
Is that correct?

If so, how did you make them move? 
By grounding the step and direction pins, or by putting them to positive voltage?


Can you find a simple program in the arduino library that will toggle an output on and off slowly?
Use that program to toggle your step wire, while direction if held to positive and then ground.



Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: jwatte on April 27, 2013, 12:31:46 PM
Other possibilities:

- not connecting the grounds between the Arduino, the controller, and motor power

- overcurrent causing controller to shut down motor

- overcurrent causing undervoltage resetting Arduino

All of these depend on the actual circuit/wiring, so a full system circuit diagram would be needed to debug further.
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: coolnerd on April 27, 2013, 02:04:05 PM
that is right the motors rotate well when connected to motor ciruit but when connected to the arduino , its doesnt rotate..it vibrates instead.

@ Jwatte below is circuit diagram....
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: newInRobotics on April 27, 2013, 02:55:00 PM
that is right the motors rotate well when connected to motor ciruit but when connected to the arduino , its doesnt rotate..it vibrates instead.
What is input CLOCK frequency when circuit is NOT connected to Arduino?
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: coolnerd on April 27, 2013, 04:18:58 PM
that is right the motors rotate well when connected to motor ciruit but when connected to the arduino , its doesnt rotate..it vibrates instead.
What is input CLOCK frequency when circuit is NOT connected to Arduino?

the clock frequency is at 10khz...
we played arnd with different frequencies but the 10kHz was the appropriate frequency.
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: jkerns on April 27, 2013, 07:15:39 PM
According to your diagram, you have teh clock connected to the direction port and the direction connected to the clock port.

What did you have it hooked to before you used the Arduino?
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: coolnerd on April 27, 2013, 07:25:37 PM
i have uploaded both the schematic of the motor circuit and the motor circuit that we wired up o the board based on the schematic. this works VERY well when we tested the motors. the question is why wont the stepper motors rotate when the clock and direction pins of the motor are connected on to the arduino...I hope am making sensing??
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: jwatte on April 27, 2013, 07:59:56 PM
You did not show the Arduino in the circuit diagram, hence the diagram is NOT COMPLETE.

So, let's go back to the questions I already asked:

- Are you taking 5V from a power supply, or from the Arduino board?
- Are you taking 12V from the same power supply as supplies the Arduino?
- Are you using a common ground between the driver and the Arduino?
- What is the capacity of the power supply or power supplies you're using, in amperes and watts?

My guess is that you either don't use a common ground, or you are somehow overloading your power supply such that the Arduino browns out.

Btw: Driving a unipolar stepper motor directly from an Arduino can be very simple. You can do it with four digital pins and four N-channel MOSFETs directly from an Arduino; no controller needed. I did this for an egg painting robot a while back. Using simple 500 mA BS170 MOSFETs actually worked great with 12V/250 mA motors.

I also see no current limiting resistors going into the L297, or the D2003. Make sure there's no excessive heating (and thus power draw) going on in those chips.
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: coolnerd on April 27, 2013, 08:21:01 PM
The micromouse competition is on monday...any suggestion of programming my robot so it moves forward, even if it moves an Inch, that would be an accomplishment, I have given up on the Arduino.  :'( :'( :'( :( >:(
Title: Re: Motors vibrates but it doesnt do anything(doesnt move forward nor left or right)
Post by: paulstreats on May 03, 2013, 05:45:17 PM
As said above, that diagram shows that you are connecting your direction from the arduino to the clock pin of the L297 and the direction pin to the clock pin. Just try switching them over and see what happens