Stepper motor control using ATMEGA8

Go To Last Post
26 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello, I am trying to command a 4-wire bipolar stepper motor using an ATMEGA8 and L293d H-bridge. Could anyone help me with a piece of code and an electric scheme? 

Thanks in advance!

Last Edited: Fri. May 19, 2017 - 03:03 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

How far did you search? There's been tons of prior threads that mentioned "h-bridge" 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

One thing I feel worth pointing out, as it would appear from your OP that you only have one H bridge, you'll  need two H bridges to drive a 4 wire (bipolar) stepper motor. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

From the information I have found, only one H-bridge is needed. Here is something I have found: http://www.plc-doc.com/stepper-m...

But I would need a code for Atmel Studio 6.2. Can anybody help me modify the code in the link? 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Howard_Smith, I suppose L293d is a dual H-bridge.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The given code looks like Codevision, why not simply get the evaluation version of that? 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Could you help me with that?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In truth I did not bother to check the device when I saw the OP, but yes that device does contain 2 H bridges. Have you not considered using a newer device? Perhaps one that is capable of microstepping, such as the L6472 (or the L6482 if you need external FETs for more powerful motors) which have the advantage of SPI communication, essentially meaning all you have to do is send commands to it over SPI to drive your motor.

 

Edit: If you have an Arduino you can get a Nucleo board for the L6474 which would no doubt have an Arduino library for it already, which you could simply import into AS7. I don't know where in the world you are but I can pick one of those up for a measily £10 GBP

Last Edited: Thu. May 18, 2017 - 06:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

John Samperi

Ampertronics Pty. Ltd.

www.ampertronics.com.au

* Electronic Design * Custom Products * Contract Assembly

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ieremia7 wrote:
From the information I have found, only one H-bridge is needed.

Wrong. You need one H-bridge per winding. Since your motor has 2 windings you need two H-bridges. There many driver-ICs available. They vary in e.g. max current, and also in other capabilities. E.g. do you need microstepping?

 

You can of-course build your own H-bridges from discrete components, but in many cases the driver-ICs makes things easier (not that they remove all discrete components, but a lot of'em..)

 

There can be no specific advice given unless you give some numbers for your motor. Current? Voltage? Do you have a manufacturer name and a model/part number?

 

As has been hinted at above there are loads of info on the Web re stepper motors. First stop is often this: http://homepage.divms.uiowa.edu/... (Carefulo, he's writing about both unipolar and bipolar motors!).

 

I'm a fan of the NJMnnnn driver ICs for bipolars: http://www.njr.com/semicon/motor... NJR has a bunch of nice app notes that are excellent reads. If you look e.g. at http://www.njr.com/semicon/produ... then the links to the app notes are half-way down the page under the "Related Data" heading.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the valuable information but the proiect I have to make involves a bipolar stepper motor and an Atmega8. I also already bought an L293d driver. The only problem I have is with writing the code for Atmega8. Does anyone have made a program like that? I can pay, also.

Last Edited: Fri. May 19, 2017 - 10:58 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Regarding the stepper motor, it is a DC 12V with 7.5° per step.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Everything you need.

 

http://www.plc-doc.com/stepper-m...

 

But if your professor knows how to use Google to search, s/he will find this also.

 

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I already found that website. But I don't understand the electric scheme. It uses a 4 wire bipolar stepper motor but in the electric scheme, there are 5 wires.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You really didn't read the site too closely did you? I see only four wires to the motor.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

ieremia7 wrote:
Regarding the stepper motor, it is a DC 12V with 7.5° per step.

Think.

 

Why is the voltage and current draw of the motor important? Hint: voltage * current = power. Most components have explicit maximum power ratings in Watts, or implied by stating both voltage and current.

 

ieremia7 wrote:
Thanks for the valuable information but the proiect I have to make involves a bipolar stepper

If that was re my post then what is the "but" about? Jones site is full of info regarding bipolar stepper motors. NJM/NJR as a lot of driver ICs for bipolars.

 

ieremia7 wrote:
But I don't understand the electric scheme. It uses a 4 wire bipolar stepper motor but in the electric scheme, there are 5 wires.
Not to the motor. Take a look at the first figure and you'll find 4 wires from the L293 to the motor.

 

If you ask questions about things you don't understand we  will try to help you understand. And since the suspicion on this being a school assignment has been raised: No-one will give or sell ready-to-run code if we suspect this is a school assignment.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did not asked for a ready-to-run code.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And it is not for a school asignment. It truly is for a school project.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

School assignment or school project does not matter. School projects are for you to solve. We can help by answering questions and explain stuff but will not simply give away ready-to-run code. And you're definitively not supposed to buy solutions for school work.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ok. Can you recommend some material regarding stepper motor control and atmega8 programming? I can't find too much information. The atmega8 data sheet does not contain too much information that I need. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The link that I gave you was a fairly detailed explanation of the theory. Yes it includes code, but you do not have to use it directly. You could use it to learn the principles of operation and then attempt writing your own version. Understand?

 

edit. typo

 

Ross McKenzie ValuSoft Melbourne Australia

Last Edited: Fri. May 19, 2017 - 02:55 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No. The ATmega data sheet does not talk about specific applications. That is only natural sincd the ATmega can be used for thousands of different applications.

You simply wont find all info in one place. It'll be pieces here and pieces there and it is your job to put it together. (Unless someone has done exactly what you are looking for and has put it on the web...)

Have you had a look through Jones site that I pointed to?

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This looks interesting : http://www.instructables.com/id/Bipolar-Stepper-Motor/

It was the fifth hit when I googled "atmega h-bridge bipolar stepper"...

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Fri. May 19, 2017 - 03:00 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now I'm studying it. Thanks a lot!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If you know how to google and read why do you then bother us with simple questions?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Gentlemen.

 

Please remember that honey works better than vinegar.

 

Keep it nice or there will be repercussions.

 

Thanks.

 

Ross

Ross McKenzie ValuSoft Melbourne Australia