cancel
Showing results for 
Search instead for 
Did you mean: 

Stepper motor (half step and micro step ) in stm32f030

sanjib
Associate III
Posted on April 16, 2014 at 14:08

The original post was too long to process during our migration. Please click on the attachment to read the original post.
9 REPLIES 9
chen
Associate II
Posted on April 16, 2014 at 15:47

Hi

''I am really a new guy in this and i have never drive a motor ''

Just how new are you to this?

Do you know about electronics?

Do you know about motors, coils etc and back emf?

Before you even run your code - make sure the circuit is OK.

The STM32 IO ports (processor itself) is not very tolerant of over voltage!

''I am using is H bridge''

What have you done to make sure the code/circuit cannot short out the power supply?

(open A0 and A1 together or B0 and B1 together)

If you have never driven a stepper motor before - forget the half step.

Start with full steps. Get full steps working first.

'' How to achieve for microstepping too ''

Depends on the stepper motor. I have not heard of stepper motors that can do better than half step (but what do I know).

Half steps are acheived by powering 2 coils on together - there by forcing the rotor to go in between 2 coils.

To achieve better than half step will depend on the topology of the stepper motor.

''Delay or you can say acceleration for that I have used DMA''

Controlling rotational speed is about controlling the rate at which the field coils are stepped through.

Yes, DMA is one possible answer (but there are other simpler ways)

''I think I have to use pwm too for (got to know from internet source ) to control the heat of the motor''

Most stepper motors should be capable of having a coil on continuously without over heating.

If it is getting too hot (check the specifications) - then it is being over driven

''V supply is 5 volt and the motor is 2 volt''

Check what voltage you are putting across the coil.

Posted on April 16, 2014 at 16:03

I think you need to remove a lot of the clutter. Learn to use the ''Format Code Block'' when pasting source.

The RMW against ODR seems to be incredibly wasteful, learn to use BSRR to atomically set/reset bits in a single write.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
ivani
Associate II
Posted on April 17, 2014 at 09:50

You need to start from the other side - learning how the motor is controlled.

Every stepper could be controlled by microsteps. If you intend to do it by yourself you will need to regulate the current trough motor windings by some sine/cosine table. So, you will need to have two current sensors (amplifiers) for current feedback, two PWM's and two PID loops to control the current in a real time.

If you don't want to go so deep you could use of-the-shelf driver, which could do microstepping - there are a lot of such chips from Allegro Microsystems, for example:

http://www.allegromicro.com/en/Products/Motor-Driver-And-Interface-ICs/Bipolar-Stepper-Motor-Drivers.aspx

zzdz2
Associate II
Posted on April 17, 2014 at 10:27

'' How to achieve formicrostepping too ''

 

Depends on the stepper motor. I have not heard of stepper motors that can do better than half step (but what do I know).

 

Microstepping is good to reduce noise produced by a motor, without microstepping they are quite noisy.

chen
Associate II
Posted on April 17, 2014 at 11:09

Hi

Do you mean electrical noise or mechanical noise/vibration?

Anyway - we are digressing.

Should Sanjib attempt half step and microstepping OR

should he get the basic stepping working before attempting half and micro stepping?

frankmeyer9
Associate II
Posted on April 17, 2014 at 11:19

Should Sanjib attempt half step and microstepping OR

 

should he get the basic stepping working before attempting half and micro stepping?

My suggestion - he should look for a mentor, and learn more about electronics and embedded SW development. Judging by this and former posts, such a project is way over his head.

zzdz2
Associate II
Posted on April 17, 2014 at 18:07

Do you mean electrical noise or mechanical noise/vibration?

 

Mechanical/acoustic noise. I don't like such sound, microstepping makes it better.

sanjib
Associate III
Posted on April 19, 2014 at 07:06

Thanks a lot for all your replies. I am overwhelmed. But the H bridge circuit (which block diagram I have posted) is correct because it has been designed by a experienced electronics engineer but he don't know the software. I have to write the code for it. He have said me  to use PWM to avoid the excess heat ........The one which is done in my code ( by using DMA ) is for ramping . moreover the half step table is also provided by him. So here the doubt is how to use the pwm to avoid excessive heat in my present code.

sanjib
Associate III
Posted on April 21, 2014 at 12:59

Hi All

I am able to run the motor ....but the transistor is getting heat .....so i cannot run for maximum time. I think we can achieve this by doing PWM in my present code ....can any body help me please. Can anybody help how to use pwm in my present code so that it doesn't got heat too much