Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Steppers... Am I doing it right??

Status
Not open for further replies.
Hello everybody. It has been a long time I haven't post here, but years ago I got a lot of help to which I am always grateful.
I am hoping I can get some help this time too :)

Anyway, this time I am working on controlling a stepping motor.(unipolar)
I have done the circuit already using a SLA7024M. It is similar to page 4 of :

www.futurebots.com/7024.pdf (I change some values in the voltage divider due to the specs of my 24V 0.7A motor)

I have also wrote several programs , to control it with Wave drive, and 2-phase full step. I am not sure if the full step is working or not but the wave drive seems to be working well. The motor rotates 180 degrees on one direction then on the other direction. I have attached some oscilloscope to the inputs (the connections going from the PIC microcontroller to the SLA7024M) and the outputs (the one from the SLA7024M to the motor)

My question is: am I doing it right? :angelic:

Please see the below pics.

This is the signal from the microcontroller (wave drive)

4_000.png

As you can see, the signals seem to be ok and in the right sequence

Now this is the signals that are going to the motor coils:
4_001.png

I don't know. Something seems fishy:confused:...
As you can see: for example when I activate B (A, ~A, and ~B=0) I got the following
Output:
A: 21.8V~25V (almost just 24V)
~A: 22V~26V (almost just 24V)
B: Huge changes(flickering) between 2.4V to 34.2V
~B: Huge changes (flickering) between 13.2V and 50.8V

Questions:

1) What are the supposed correct values that the output should have. I mean they are just transistors right? (see again schematic on page 4 of the datasheet)
2) that flickering signal. Is that because of the PWM the SLA7024M produce?
3) is 50V (or more) being applied to the coils? is that safe for a motor ranked 5.8V and to be used with 24V??


I would appreciate very much any comment, advice, or any help you could give me. Thanks in advance
 
My question is: am I doing it right? :angelic:
Yes, if you're following the datasheet. What is your Vref? It should be <2V


As you can see: for example when I activate B (A, ~A, and ~B=0) I got the following
Output:
A: 21.8V~25V (almost just 24V)
~A: 22V~26V (almost just 24V)
B: Huge changes(flickering) between 2.4V to 34.2V
~B: Huge changes (flickering) between 13.2V and 50.8V
When you activate B, the B output will switch between Vref and open circuit. The B and ~B are magnetically coupled (like a transformer), and that's why you see the negative of the B output at the ~B output (shifted by the 24V that they're both connected to). During this time the A and ~A outputs are not being driven.

1) What are the supposed correct values that the output should have. I mean they are just transistors right? (see again schematic on page 4 of the datasheet)
2) that flickering signal. Is that because of the PWM the SLA7024M produce?
3) is 50V (or more) being applied to the coils? is that safe for a motor ranked 5.8V and to be used with 24V??
1) What you're getting looks alright, except your Vref may be too high (it should be <2V). The outputs are transistors, but there is a switch-mode controller regulating the average current through each output (you can think of it as PWM, if you find that helpful).
2) The 'flickering' is due to the 'PWM' drive signal.
3) You are applying 24V to the coils. The 48V you see on ~B when B is activated is because of the magnetic coupling between the two coils but it has no current flowing. The IC you are using can have up to 100V on its outputs, so you are well within its limits (even the peak 61.8V reported by the DSO is well within the allowed limit).

So it all looks good to me, but check your Vref and sense resistor (it may just be that the DSO display timescale not zoomed in enough).
 
Thank you very much for your reply. I will check the Vref as you indicated, today.

After I wrote the post, I tried with full stepping in which not only A or B are activated but say AB or A~B. The results were not good at all. There was no correlation between the inputs and outputs, and sometimes the outputs were different for the same input. The motion of the motor was not consistent.

I will let a graph speak for itself:

5_000.png
You can see that A and ~A are almost always activated. Also B(violet) gets activated sometimes and ~B never. I noticed that in any case only one coil seems to be getting activated... I am lost at what could be the possible causes of this behavior...
 
How have you wired it up? Which pin is your A input, ~A input, B input, ~B input? The IC you are using has two distinct halves; you cannot just treat the IC as four unique drivers.
 
My schematics are the same as indicated in the datasheet
schemeit-Controller.png


for C5 I used a huge 1000μF 50V. I changed R2 from 100 to 82 to limit the current to 0.7A.
I never understood what for the RC circuit is for. (I understand voltage dividers so I could modify the values of R2 but since I dont understand RC I just used what it was written) For the sensing resistors I used 1 ohm.


side question: Can a bad soldering be also a possible cause??
 
You have shown an output that would correspond to a repeated sequence of {B, ~A, A}.
upload_2015-6-3_13-1-50.png


Are you feeding the correct signals into the driver IC? Have you connected all pins of the IC (including both GND, etc.) to something? The two halves of the IC should be independent, according to the datasheet, so if you set A and B inputs to high, the A and B outputs should activate simultaneously. Note that setting e.g. A and ~A high will result in no output.

You mention the RC circuit; there are two per driver. In the case of the one on the delay pin, it sets the amount of time that the output will remain off, even after the output current has dropped below the lower threshold. The other RC made up of the 2k4 resistor and 2n2 capacitor form a low-pass filter of the output current, which will slow the response, but will also reduce false triggering caused by high-frequency noise.

Re your soldering: if you have dry joints, you may have high resistance/impedance connections that will not handle moderate currents properly. Also, if your routing and grounding methods are extremely poor, then you may get other issues with the input signals (you'd probably have to try to wire it badly though). If you decrease the output current to 50mA or so, you may be able to see the waveforms that you're after. If this is the case, you have bad routing or solder joints. If not, then perhaps your signals are incorrect.

What do you see on your DSO when you set A and B inputs high, and others low (you could do this manually, without the microcontroller)? Repeat for ~A and B. Repeat for ~A and ~B.
 
Thank you very much for your reply.
I have indeed check the inputs from the IC with a oscilloscope. They seem to be ok
6_000.png
Thank you very much also for your explanation of the RC circuit. I finally understood what it is for
When you talk about decreasing the current you mean with the voltage divider right?
When I set A and B high manually I could see that only one of them gets activated. Say when I apply
AB A wins
~AB ~A wins
A~B A wins
~A~B ~A wins
but if say I am applying AB (A winning) and suddenly disconnect A, then B recovers immediately,

I have a confession to make. I have made almost all the circuitry of 5V (RC, voltage divider, IC) on a breadboard and then connect it with cables to a soldered perfboard with the SLA7024M and the 24V power in it. Somewhere (dont remember where) I read that the sensor circuit and stuff should be made very close to the SAL7024M. Can this be a possible reason??

Right now I am building a soldered board with almost all circuitry (maybe I ll leave the PIC to a breadboard) soldered to the perfboard and employing a SLA7026M. I am hoping I can get better results with it.
 
I have to report what it seems to be good news :) The motor started moving nicely.

I suspect then the problem was that I was doing the circuitry on a breadboard and connect it to the board with the SLA7024.
This time I used a SLA7026M with the sensor, reference and time delay circuitry soldered to the board. The only thing I left out was:
-> The outputs: connected with a cable to the motors
-> The power: connected with cables to the 5V and 24V power.
-> The inputs: connected with a cable to a breadboard with only the PIC 18F2550 in it.(and a resistor and capacitor to make the PIC work)

Now can someone (maybe you dougy83 :rolleyes:) please check my results?

The inputs coming from the PIC:
7_000.png
The outputs coming from the SLA7026M and going to the coils
7_001.png

What do you guys think? Am I doing it right? (Full step)

Next I am going to try half step to see if it works and then maybe solder the PIC to the board as well.
Thanks again!
 
Well, it sounds like you found the cause of the problem and when you removed the breadboard. The inputs from the PIC look good to me. The output is not very clear to me - perhaps you could change the scale (alternately, if you replace each motor coil with a 10k resistor, you'll see a clean waveform at the outputs, which should simply be the inverted signal of the input).
 
alternately, if you replace each motor coil with a 10k resistor,

Good trick. I used it when implanting a new brain to a hacked printer, first to check sequence consistency and, also very important, to avoid possible errors with limits in the printing head translation, still in place.
 
I ve noticed that the Motor gets a little hot. Is this normal or am I applying too much current?
(Osciloscope pics follow)

Wave drive:

An000.png

Full Step (2-Phase)

An002.png

Half-Step(2-1-2)
An005.png

Another thing I noticed was that half step is slower than full step and wave drive..! (I thought the angle was the one that was going to vary but no, it was the speed)
 
Last edited:
Hello to Kyoto,

If the clock rate is the same then half stepping will take twice as long to complete one revolution. That's just because it takes two times as many clocks to get all the way around.

The film, "Lost In Translation", was filmed partly in Kyoto.
 
Yes, it's normal for the stepper motors to run warm.

You will find that half step will have twice the angular resolution (each step is half the angle) of the full step and half the speed (if comparing both with the same state-update frequency)
 
Hello!

Recommended by the manufacturer, I am now implementing stepper motor control with a SLA7083M.

Now I would appreciate your help.
Check the datasheet
https://www.semicon.sanken-ele.co.jp/sk_content/sla7081mpr_ds_en.pdf

Page11 equation (2) and also take a look at page 12.
It says
Io is calculate by the following formulas

Vref=R1/(R2+R2) *VDD

This is wrong right?:wideyed: I mean this is just a voltage divider and the correct would be
Vref=R2/(R1+R2) *VDD

right??

I dont know either why do they put those values to R1 and R2....

any help appreciated
 
Yes, it looks like a typo. Voltage divider equation should be as you have stated it
 
Thank you very much for your reply.

I already build a board for the SLA7082 and connect it to a 24V stepper and to my STM32 nucleo microcontroller.
I also programmed a wave drive program and test it. It works well :happy: Next I am gonna try full step and half step.

I would like to ask you guys a question about stepping motor basics

Controlling a stepper is giving the motor a sequence of activation. For example with four inputs A, ~A, B and ~B

Wave drive is A->B->~A->~B and repeat. For the opposite direction change -> with <-
For full step the sequence is of two inputs at the same time and for half step is a combination of both.

So far so good. Right now I have something like
Code:
void wave_drive(void)
{ int count=0;
    //GO
    for(count=0;count<=50;count++)
    {
        stepMotor=0x0200;  wait_ms(50);  //A
        stepMotor=0x0800;  wait_ms(50);  //B
        stepMotor=0x0400;  wait_ms(50);  //~A
        stepMotor=0x1000;  wait_ms(50);  //~B
     }
     //STOP
     stepMotor=0x0000;  wait_ms(1000);  //Stop
   //BACK
    for(count=0;count<=50;count++)
    {
       stepMotor=0x0200;  wait_ms(50);  //A
       stepMotor=0x1000;  wait_ms(50);  //~B
       stepMotor=0x0400;  wait_ms(50);  //~A
       stepMotor=0x0800;  wait_ms(50);  //B
             
     }
       //STOP
    stepMotor=0x0000;  wait_ms(1000);  //Stop
   
}

The thing is that for wave drive and full step it is a repetition of 4 (four) steps. (For half step it is more).
My question is , let's say I want to stop the motor (for example if I touch a button or in my case from a LCD or whatever signal you can imagine ) in other words I want the motor to be responsive to a user input. How do you do that???

I mean yes, to stop the motor you just do stepMotor=0x0 I know, but what I mean is do I have to put a
Code:
if(not_stop) stepMotor=0x.....; wait_ms(50)
else stepMotor=0x0;

for every step in the algorithm??

I am inexperienced with steppers so I would like some advice here.

thanks!
 
Please Help.


I found an excellent Application Node for Steppers speed control:
http://www.atmel.com/images/doc8017.pdf

I am still trying to understand this but I have a more basic question.

I am following the definitions in wikipedia for wave drive, full step and half step modes. For wave drive only a single phase is activated at a time (less torque) but for full step two phases are always on. Half step is the combination of both (no problem there)

However for the application note (and also other resources in the internet) full step is activating only one phase at a time (like wave drive)

Which is correct????
 
The thing is that for wave drive and full step it is a repetition of 4 (four) steps. (For half step it is more).
My question is , let's say I want to stop the motor (for example if I touch a button or in my case from a LCD or whatever signal you can imagine ) in other words I want the motor to be responsive to a user input. How do you do that???
for every step in the algorithm??
You can either write 0x00 which will turn off all power to the coils, or just not update the port value to keep the current coil(s) energised (which will hold the current position with force). The way you have written your code will require you to check if the motor is stopped before every line that changes the stepMotor port value. There are neater ways to do drive the stepper using a table of values for the full/half-wave step sequence, and reading from the table using an incrementing index (for forward motion), or a decrementing index (for reverse motion).

I am following the definitions in wikipedia for wave drive, full step and half step modes. For wave drive only a single phase is activated at a time (less torque) but for full step two phases are always on. Half step is the combination of both (no problem there)
However for the application note (and also other resources in the internet) full step is activating only one phase at a time (like wave drive)
Resources on the internet say both things. Both the 'wave-drive' and the 'full step' modes will move the stepper a step per state-change in the energisation sequence. The 'half-step' will step a half-step per state-change of the energisation sequence.
 
You can either write 0x00 which will turn off all power to the coils, or just not update the port value to keep the current coil(s) energised (which will hold the current position with force). The way you have written your code will require you to check if the motor is stopped before every line that changes the stepMotor port value. There are neater ways to do drive the stepper using a table of values for the full/half-wave step sequence, and reading from the table using an incrementing index (for forward motion), or a decrementing index (for reverse motion).

I understand that implementation. In that case if I want to stop the motor it is enough to stop the index, right?

Resources on the internet say both things. Both the 'wave-drive' and the 'full step' modes will move the stepper a step per state-change in the energisation sequence. The 'half-step' will step a half-step per state-change of the energisation sequence.

So there is not a definite definition? sometimess full tep can refer to wave drive?
 
Hello
I would really appreciate if someone can advice me, comment or give any idea to my situation here.

I reprogrammed my stepper motor control. This time it uses timers, etc. I solved the problem of stopping the motor like this: When I deactivate the timer the motor stops. When I activate the timer (well it really is a ticker) it repeatedly calls its sequence.

I have done quite a lot of work. I incorporated not only speed but also acceleration and deceleration. Tested it and for example it gives something like:
speedaccel.jpg
But I want to test it profusely.
One thing I notice (and it is important for my later question) Whenever I log delays (like the above graph) the stepper gets slower. I suppose it is obvious. Without logging it goes to its original speed.

So to test it further, I did the following:

  • Set the speed to 300 rpm
  • NO acceleration
  • move to position -600 (3 revolutions counterclockwise)
  • when stopped
  • move to position -300 (one and a half clockwise)
  • repeat
And it failed to move! The motor just got stucked.

Notice that this error does not happen if I do any of the following:
  1. Log the sequence of steps it is having (motor gets slower) or
  2. make both moves in the same direction or
  3. Set an initial acceleration
I was perplexed. I tried to reproduce the error with logging to see what was going wrong but as you see it did not reproduce.

Then after a lot of thinking I slowed the speed of the motor: And it moved!!!

So my conclusion is that a stepper motor can not move to a high speed (like 300rpm) all of a sudden. If I try to do that it gets stucked

I have to either reduce the speed of the sudden start or go to that high speed little by little (with acceleration).

Under this theory , I cant explain why it did work when it was both on the same direction.

So my question is (please I would really appreciate your insights)
Is my reasoning ok? Do steppers have a speed limit to which they can move all of a sudden. Do professional algorithms for moving steppers use acceleration by all means??

Thank you very much for any comments in advance


EDIT: Looking in the internet I found the concept of ramping up the Stepper
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top