![]() |
![]() OCAU News - Wiki - PC Database - QuickLinks - Job Search - Pix - Sponsors |
|
|
#1 |
|
They're in the kernel!
Join Date: Jun 2002
Location: Melbourne
Posts: 7,714
|
I've built a stepper motor controller based on an Allegro A3977.
I want a relatively high-precision microstepping controller for CNC work. Click to view full size! (The schematic does not show all the ground pins on the chip, but they're all connected) The DC power rail running the steppers is 24 V. This is the stepper motor being driven. According to the A3977 datasheet, the maximum value of current limiting is set by ItripMax = Vref/ 8 Rs. Rs = 0.5 ohms, and the stepper motor's max coil current is 400 mA. Therefore, I've set the Vref to 1.5-1.6 V. If the PFD voltage is between 0.6 and 0.21 Vdd, the chip will operate in mixed-decay mode. I set it to give 2 V, which is 0.4 Vdd, assuming that mixed decay mode is OK. Just for testing purposes, I whipped up a couple of lines of Arduino code, since I needed something to generate the clock signal anyway. Code:
// Test program for A3977 stepper controller boards
// Pin mapping to physical hardware:
int home = 2;
int dir = 3;
int enable = 4;
int reset = 5;
int step = 6;
int led = 13;
// Square wave frequency (in Hertz), change if you like.
int frequency = 10;
// Half the period, in mS.
int halfPeriod = 1000 / (2 * frequency);
void setup()
{
pinMode(home, INPUT); // Output from the chip home, can be ignored.
pinMode(dir, OUTPUT);
pinMode(enable, OUTPUT);
pinMode(reset, OUTPUT);
pinMode(step, OUTPUT);
pinMode(led, OUTPUT);
digitalWrite(dir, HIGH); // Pick which direction you like.
digitalWrite(enable, LOW); // Active low enable. Must be low to make it go.
// It's pulled high in hardware so it will not
// go due to floating noise on the clock if
// the cable is disconnected.
digitalWrite(reset, HIGH); // Active low reset. Keep it high normally.
digitalWrite(step, LOW); // Start off with it in some defined state.
digitalWrite(led, LOW); // The pin 13 LED is in the same state as
// the stepper clock so we can watch it.
}
void loop()
{
// The pin 13 LED is in the same state as the stepper clock so we can watch it.
digitalWrite(step, HIGH);
digitalWrite(led, HIGH);
delay(halfPeriod);
digitalWrite(step, LOW);
digitalWrite(led, LOW);
delay(halfPeriod);
}
However, the motor is not spinning as expected. The stepper motor is making a high-pitched whine, and you can feel it "ticking" or "throbbing" internally - like it's trying to turn - but the shaft is not turning. I might have guessed this was caused by the windings being connected out of phase - but I tried swapping one with no effect. Does anyone have any ideas as to how to fix this? Cheers.
__________________
"How is anyone supposed to know that this isn't just a bunch of crap?" - Richard Feynman.
Last edited by Goth; 1st November 2009 at 12:15 AM. |
|
|
|
|
|
#2 |
|
Member
Join Date: Mar 2002
Location: Northern Beaches, Sydney
Posts: 3,826
|
So you're definitely energising the windings in the right order?
Also keep in mind that there will be a maximum speed you can step the motor at - since the windings need time to energise fully. Likewise there is a de-energising time. Just make sure you're not stepping the motor too fast - what happens if you slow your rotation speed right down?
__________________
System Specs: Q6600 G0 @ 3.2GHz (8 x 400MHz), TR Ultra 120EX, 4GB G-Skill PI PC2-8500 w/Dominator Fan, Asus P5K Premium, 768MB XFX GeForce 8800 Ultra, Creative SoundBlaster Audigy2 ZS Platinum Pro, 1x 150GB WD Raptor, 2x 750GB/1x 1TB/1x 1.5TB Seagate 7200.11 HDDs, 2x Pioneer DVR-212BKs, 2x Zalman ZMMFC-1 Plus, BenQ FP241W 24" LCD, Logitech Z-680 5.1 Speakers, Lian Li PC-A71B, 8x Scythe SFF21G, 850W Silverstone DA850 PSU. Over 40 Trades. |
|
|
|
|
|
#3 | ||
|
They're in the kernel!
Join Date: Jun 2002
Location: Melbourne
Posts: 7,714
|
Quote:
All the sequencing stuff is done inside the silicon. Quote:
__________________
"How is anyone supposed to know that this isn't just a bunch of crap?" - Richard Feynman.
|
||
|
|
|
|
|
#4 |
|
Member
Join Date: Mar 2002
Location: Northern Beaches, Sydney
Posts: 3,826
|
Yeah your 50ms delay (from 10Hz square wave) seems fine.
Everything I'm looking at here seems fine - though I am not 100% on all the resistor values you've selected that circuit diagram - but the logic of it all seems fine. One thing I can say is take very careful note of the timings in the datasheet for the A3977. Just go back through and make sure you're setting all the right pins high/low at the right time(s) relative to each other. Hopefully someone else a bit more experienced can see something that I'm not seeing. I'm interested to know what the problem is - so if you figure it out, make sure you post it up
__________________
System Specs: Q6600 G0 @ 3.2GHz (8 x 400MHz), TR Ultra 120EX, 4GB G-Skill PI PC2-8500 w/Dominator Fan, Asus P5K Premium, 768MB XFX GeForce 8800 Ultra, Creative SoundBlaster Audigy2 ZS Platinum Pro, 1x 150GB WD Raptor, 2x 750GB/1x 1TB/1x 1.5TB Seagate 7200.11 HDDs, 2x Pioneer DVR-212BKs, 2x Zalman ZMMFC-1 Plus, BenQ FP241W 24" LCD, Logitech Z-680 5.1 Speakers, Lian Li PC-A71B, 8x Scythe SFF21G, 850W Silverstone DA850 PSU. Over 40 Trades. |
|
|
|
|
|
#5 |
|
Member
Join Date: Jun 2001
Location: NarreWarren, Melb
Posts: 4,728
|
I don't have any experience with this IC, but from the symptoms it sounds like it is oscillating, I had this issue with the stepper controller I built.
Sticking a shunt resistor inline with the motor coils and putting a cro on that should show the current waveform that it is outputting, which may lead you in the right direction in solving the problem. I fixed my oscillating issues by placing an RC circuit in parallel with the motor coils, the large inductance of the motors can cause lots of issues with feedback control systems. I don't really know how to calculate the ideal values, but 100ohm and 1uF were effective for me
__________________
In memory of Cheers Z |
|
|
|
|
|
#6 |
|
Member
Join Date: Jul 2009
Posts: 57
|
I have used these successfully before, perhaps you can get something from its schematic:
http://www.schmalzhaus.com/EasyDriver/ |
|
|
|
|
|
#7 |
|
Member
Join Date: Jul 2001
Location: Lambton
Posts: 2,383
|
Tried alternating the frequency? Sounds like it's too low, perhaps.
__________________
I now have a blog. |
|
|
|
|
|
#8 | |
|
They're in the kernel!
Join Date: Jun 2002
Location: Melbourne
Posts: 7,714
|
Quote:
__________________
"How is anyone supposed to know that this isn't just a bunch of crap?" - Richard Feynman.
|
|
|
|
|
|
|
#9 |
|
Member
Join Date: Jun 2001
Location: Sydney
Posts: 1,975
|
So what was the problem?
__________________
There are only 2 reasons why you should run, 1. If you are being chased or 2. If you are on fire |
|
|
|
![]() |
| Bookmarks |
|
Sign up for a free OCAU account and this ad will go away! |
| Thread Tools | |
|
|