Arduino, A3977, and AD9833

Hello everybody.

I am very new to electronics, but am working on a project that involves a stepper motor. I need very precise and smooth control over the motor, at very low rotation rates.

I currently have it setup, and working well, using the A3977. This works well within a certain frequency range, but unfortunately this range is no good to me. I have been using a simple "blink" ape control for the STEP input of the A3977...there are obvious problems with this.

I have began looking for other options to drive the STEP input, something that will produce a nice, clean square wave, and it seems that the AD9833 is the way to go. I have ordered the chip, and am now researching how to implement it. This is where I need some guidance.

Reading through the data sheet, I need an external clock, the frequency of which will determine the frequency of the square wave output. Can I use the Arduino for this (it will also be doing other simple tasks in the final product), or should I get a dedicated crystal?

Does anyone have any experience with the AD9833? Is it relatively simple to adjust the output frequency on the fly? (Ultimately it will be controlled with LabView.) The addition of this chip has added an extra level of complexity to my system, which is fine, it just adds to my learning curve, is all.

If anyone has any better suggestions, I'd love to hear them.

Let me give a little more info about the project.

The stepper motor is 12v, .75A, and has 400 steps. 1RPM is far too fast for my application. I am not exactly sure of the useful range yet, I have not calculated it, but I am guessing that it would be on the order of 0.1hz. I am trying to control a syringe that will deliver volumes of around 10ml/hour to 0.01 ml/hour.

Thanks!

I struggle to understand how you can fail to drive a motor at such a low speed - the A3977 should make it really simple. What is failing?

It isn't failing, it works just fine, and I am able to control the speed and such, but ultimately the arduino will be doing several other tasks. Using the "on,delay, off, delay..." sequence for my STEP input is simply not IDEAL because it is subject to interrupt. I need very smooth, and very precise output, like I said, on the order of 1 ml/hour from a syringe, which is around 48 micro steps a minute (at 1/8 step). This is very slow, and seemingly easy to control, but I cannot have any pulsing. I am trying to generate a very fine spray from the tip of a needle, so, in short, I am looking for a very clean and consistent STEP input, which is why I am looking to outsource this frequency cycle to a dedicated chip.

Does that make any sense, or was that a ramble?

If you're looking for a simple chip to offload this pulsing you should grab an ATTiny84. They come in DIP packages, they're cheap, and used in conjunction with the Arduino you have would require no extra components.

Hmm...So just use this for the same high, delay, low, delay, pulsing method? Or is there a better way of doing it?

I'm not sure why you'd think there would be a better method. The A3977 only accepts high and low and doesn't care if that's a sine wave or square wave. You can't control the form of signal that the A3977 sends to the stepper by changing the form of signal that you're sending the step pin.

Mr_Faineant:
It isn't failing, it works just fine, and I am able to control the speed and such, but ultimately the arduino will be doing several other tasks. Using the "on,delay, off, delay..." sequence for my STEP input is simply not IDEAL because it is subject to interrupt. I need very smooth, and very precise output, like I said, on the order of 1 ml/hour from a syringe, which is around 48 micro steps a minute (at 1/8 step). This is very slow, and seemingly easy to control, but I cannot have any pulsing. I am trying to generate a very fine spray from the tip of a needle, so, in short, I am looking for a very clean and consistent STEP input, which is why I am looking to outsource this frequency cycle to a dedicated chip.

Does that make any sense, or was that a ramble?

If you haven't encountered BlinkWithoutDelay you need to, there is no need for any extra hardware, 1ms resolution should be fine for 48 steps a minute.

If you are stepping at about 1 microstep a second you will be lucky to get an even spray - the motor will jump each microstep in a tiny fraction of second and stay there till the next one - some sort of low-pass filtering would be needed in the physical domain, or gearing to allow the motor to run faster.

Chagrin:
I'm not sure why you'd think there would be a better method. The A3977 only accepts high and low and doesn't care if that's a sine wave or square wave. You can't control the form of signal that the A3977 sends to the stepper by changing the form of signal that you're sending the step pin.

I understand that, but the reason that I think that there may be a better method is that I require the Arduino to do some other tasks at the same time, and constant serial read and write. This will interrupt the frequency of the pulse, thus affect the frequency of the output. I don't care about the form of the signal, just the consistency of it. If you are wondering why I think this to be the case, it is because it says so here...

http://arduino.cc/en/Tutorial/SecretsOfArduinoPWM

"One major disadvantage is that any interrupts will affect the timing, which can cause considerable jitter"

I cannot have "considerable jitter."

MarkT

Thankyou, I will look into BlinkWithoutDelay.

Sending a pulse to the step pin is not a place where you would be using PWM -- or certainly not where you're using step rates of 10 steps/second. The A3977 does specify a minimum pulse length of .1 picoseconds but that length of time is shorter than two consecutive calls to digitalWrite() and is not a concern.

As previously suggested the BlinkWithoutDelay example should give you the foundation you need. With respect to interference with serial input/output it is important to keep your messages short, however, but still not likely to cause great concern while keeping pace with a slow step rate.