my little lab

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
YES SIR!!! im so HAPPY for your reply and understanding...like you mentioned above i want a minimal part solution...it quiete late BUT tomorrow first thing ima buy the ULN2064 chip...and do the breadborad connection...

But Sir, what if i cant find the ULN2064, which ULN---- would you suggest??

regards,
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
Sir! what do i do with pins 10 and 15, the NC pins...i dont know what NC stands for...

and what do i do or where do i connect the 2 center tap wire?? do i have to connect them to 12V??

regards,
 

SgtWookie

Joined Jul 17, 2007
22,230
But Sir, what if i cant find the ULN2064, which ULN---- would you suggest??
I gave you a link to the ULN2064 at Digikey; they have over 3,000 of them in stock right now.

If you're not in the USA, I don't know what to tell you unless you put your general location in your profile. Country, province or state, and nearest large city is most helpful. "Planet Mars!" is no help whatsoever.
 

SgtWookie

Joined Jul 17, 2007
22,230
Sir! what do i do with pins 10 and 15, the NC pins...i dont know what NC stands for...
NC simply means "No Connection" - those pins have no internal connection. It doesn't matter what you do with them.

and what do i do or where do i connect the 2 center tap wire?? do i have to connect them to 12V??
Yes, they get connected to 12v along with the cathode (K) terminals.
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
You will need to use PWM on two I/O pins simultaneously to get the stepper to do 60 steps per rotation. It will need to be a version of what's called "microstepping". If you're driving a second hand like I suspect, the method of driving the motor is not going to matter, except for relative complexity.
Sir! does that mean that the PIC uc that im going to use MUST have 2 PWM channels??

i kinda read the datasheet of PIC16F690 on PWM and i think it only has 1 PWM channel, so this won't work with it, is that correct?

im happy we through with the hardware part...

Before talking about the software part, how is this going to be implemented logically???

Also, since i have to use PWM, that means that the 4 i/o pins that im going to use on the microcontroller shouldn't be any i/o pins BUT P1A, P1B, P1C, and P1D, is that correct??

regards,
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
oufff...it 02:12am where i am...be back in a few hours...but will i need Xtal clock or the internal clock will work fine??

thx a lot Sarge!!
 

SgtWookie

Joined Jul 17, 2007
22,230
Sir! does that mean that the PIC uc that im going to use MUST have 2 PWM channels??
No. Basically, you'll be using the outputs in more or less a "half-H-bridge" mode. You can set an odd pair of outputs to active-high and the even pair to active-low. Then the two outputs will get complementary PWM output. You will only enable one odd and one even output at a time.
You will have very fine control over the stepping of the motor if you want it.

Read through this tutorial a few times:
http://www.mikroe.com/eng/chapters/view/6/chapter-5-ccp-modules/

Before talking about the software part, how is this going to be implemented logically???
Read through the tutorial.

Also, since i have to use PWM, that means that the 4 i/o pins that im going to use on the microcontroller shouldn't be any i/o pins BUT P1A, P1B, P1C, and P1D, is that correct??
That's about it.
 
Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
oufff...it 02:12am where i am...be back in a few hours...but will i need Xtal clock or the internal clock will work fine?
It depends upon what kind of accuracy you need; and if it needs to be accurate, whether or not you want to use an external synchronization of some sort (like from the secondary winding of a mains-powered transformer)
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
Thx Sir 4 that link...I'm already reading on PWM and setting up the CCP module...that's why I been quiet! And now that you have added this beautiful link...ima read it too so we can discuss about the software implementation...

By the way, I bought the ULN2065B coz they didn't have the ULN2064/66...
Is the ULN2065B will work fine???

I'll be back in a few hours as I'm doing some readings...

Regards,
 

John P

Joined Oct 14, 2008
2,068
I think the UN2065B is a bit overspecified for this little motor. The ULN2003 would be a fraction of the cost. It'll work, but a good engineer doesn't waste resources. (A good engineer is lazy and a cheapskate, up to a point.)

But now the question is how you make the PIC16F690, with its single PWM output, run the motor in PWM mode. You could write code to produce PWM on a second output. Or do you really need the ability to produce PWM on any of 4 different outputs?
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
@John P: they had the ULN2003 and it was 1/3 of the cost of the ULN2065...

Well if the ULN2003 is better for this motor, I can still buy it...anyways...
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
Well, I think I did enough readings and I have a little understanding of PWM and duty cycle...but I also think it about time to discuss about the software implementation...

Given that the motor has to achieve 6 degree step/ second...my understanding is that the PWM Period is 1 second! Is that correct??

And as for the duty cycle, we can choose 50% duty cycle meaning the motor will be on for half a second and off for another half, is that correct??

BUT I still cant figure out how to achieve the 6 degree...I think we need to use the concept of microstepping...360 degree/6 = 60 step then what???

Can somebody please explain the above...

This concept is still fresh in my mind so I'm kinda...

Regards,
 

SgtWookie

Joined Jul 17, 2007
22,230
I think the UN2065B is a bit overspecified for this little motor. The ULN2003 would be a fraction of the cost. It'll work, but a good engineer doesn't waste resources. (A good engineer is lazy and a cheapskate, up to a point.)
In the OP's case, the ULN2064/ULN2065 is justified, as the Ic is going to be up to 330mA, which will cause a Vce of ~1.3v to 1.4v. A ULN2003 would have worked, but would be running very warm, particularly if not well heat sunk.

The ULN2064/65 will have a lower Vce (~0.8-1V) so the power dissipation in the IC will be about 28% lower to start with, and will be more "bullet proof" than the ULN2003.

But now the question is how you make the PIC16F690, with its single PWM output, run the motor in PWM mode. You could write code to produce PWM on a second output. Or do you really need the ability to produce PWM on any of 4 different outputs?
The single PWM can generate complementary outputs, up to 4. If you read that very informative tutorial I linked to on the prior page, you'll see how that works.
 

SgtWookie

Joined Jul 17, 2007
22,230
Well, I think I did enough readings and I have a little understanding of PWM and duty cycle...but I also think it about time to discuss about the software implementation...
You're going to write it.

Given that the motor has to achieve 6 degree step/ second...my understanding is that the PWM Period is 1 second! Is that correct??
Well, no. Your stepper motor has 48 steps per revolution, and you need 60 steps per revolution - so you are going to have to feed different PWM percents to the module every second, along with selecting the proper outputs to move the motor in the direction desired. The PWM frequency will be anywhere from a couple hundred Hz up to several kHz. We don't know what will make the least noise right now.

And as for the duty cycle, we can choose 50% duty cycle meaning the motor will be on for half a second and off for another half, is that correct??
No.

BUT I still cant figure out how to achieve the 6 degree...I think we need to use the concept of microstepping...360 degree/6 = 60 step then what???
You will be giving the PWM module different duty cycles so that two coils are active.

Here's another page with an example you can experiment with if you are so motivated:
http://www.micro-examples.com/public/microex-navig/doc/097-pwm-calculator.html

You need to understand just how this thing is going to work before you start writing a program to implement it, otherwise you'll be lost.
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
But now the question is how you make the PIC16F690, with its single PWM output, run the motor in PWM mode. You could write code to produce PWM on a second output. Or do you really need the ability to produce PWM on any of 4 different outputs?
I'm NOT too sure about it...:(
 

Thread Starter

Eric007

Joined Aug 5, 2011
1,158
The single PWM can generate complementary outputs, up to 4. If you read that very informative tutorial I linked to on the prior page, you'll see how that works.
I think it is by setting the CCP1CON bits:CCP1M3 - CCP1M0= 1100.
-s that correct??
 
Top