Feliz Navidad y Buenos Anos!
I'd be more than happy to help you (so would many others), but I have zero experience with motors and PWM.
Robert
Edit: start by posting a schematic and your code so far, that will help us to help you.
Feliz Navidad y Buenos Anos!
I'd be more than happy to help you (so would many others), but I have zero experience with motors and PWM.
Robert
Edit: start by posting a schematic and your code so far, that will help us to help you.
Oh hello there and Feliz año too!. I don't have anything yet, just all my enthusiasm to begin and learn. As I said before I have been reading and searching on the web. I found an application note from microchip about stepping and it was very well explain but the code explain their was in assembler and I don't understand a bit of that language. The link to the document is this one:
https://www.google.com.mx/url?sa=t&s...KMe0MPOHHzXisQ
It's very interesting actually, still I don't get anything from the code cause I know nothing about assembler. Im downloading books to learn more.
Thank you Robert for taking your time to look at my post. Anything I find out or investigate I will feedback the thread.
Best Regards!
What does your hardware look like?
Are you doing the current sensing/control with the PIC itself (ie sampling the actual current using the ADC) (no you're not if you're using the 16F84) or are you using external comparator and flip/flops to sense and regulate the current?
When microstepping you're not only controling the currents direction thru the coil (like you are when fullstepping) but also the amplitude. If you draw the waveform of fullstepping mode out on paper you're going to get something that, with a little bit of imagination, is looking like two sine waves with a 90° phase shift between A and B. They are very crude sinewaves with only 2 "steps" to them but never the less. Now draw the waveform for halfstepping out on paper and you'll see that it looks a Little bit more like two sinewaves, still very crude sinewaves with only 3 "steps" to them but still..... What microstepping does is adding more "steps" to the sinewaves. The more "steps" you add the sinewaves the smoother the motion from the motor becomes.
So, you need to be able to regulate the amplitude of the current thru each of the two coils in a SIN/COS relation to each other.
/Henrik.
A very long time ago I rotated a bipolar stepper motor with adjustable speed.
I then found the speed I needed and preset it to 10. That's why I commented out the ADCIN commands.
The outputs turn on FET's to drive the motor. Hope this helps.
'COMPILED FOR 12F675
ANSEL = 0 'all inputs digital
CMCON = 7 'comparators off
trisio = %00010000 'ALL OUTPUTS EXCEPT GPIO.4 SPEEDPOT
DEFINE OSCCAL_1K 1 ' Set OSCCAL for 1K device to accurize osc
@ DEVICE MCLR_OFF, INTRC_OSC, WDT_ON, BOD_ON, PWRT_ON, PROTECT_ON
GPIO = 0
SPEEDPOT VAR BYTE
START:
LET SPEEDPOT = 10
Low GPIO.4
High GPIO.2
'ADCIN 3,SPEEDPOT
Pause SPEEDPOT
Low GPIO.0
High GPIO.1
'ADCIN 3,SPEEDPOT
Pause SPEEDPOT
High GPIO.4
Low GPIO.2
'ADCIN 3,SPEEDPOT
Pause SPEEDPOT
High GPIO.0
Low GPIO.1
'ADCIN 3,SPEEDPOT
Pause SPEEDPOT
GoTo START
I don't have a hardware configuration yet, and about the sine/cosine relation I have been reading. The thing is that I don't know how to output this software configuration through the pic. And yes, the pic should do the sensing of the current, throw the corresponding pwm signals to the coils and the combination to make the steps. I want to know if it is possible to program this to the pic via picbasicpro, because I heard of some limitations it has against assembler (in the ccpm modules I read). And if it is possible to do, how to start. Actually I am studying about assembler just to comprehend the code in the application note that I shared in a previous reply.
Best regards and thank you all people for helping.
Hi,
It's possible to do with a PIC and PBP but it's not an easy task and not a suitable beginners project to implement the current control within the PIC itself.
A much easier (but still not a beginners project IMO) is to use an exernal driver with integrated PWM current control (such as the L6207 though there are many alternatives) and then use the PIC to generated the apropriate phase- (digital) and current reference (analog) signals.
You'd then use the two CCP modules to generate the two current refernce signals (SIN/COS) and a couple of I/O's to drive the digital inputs of the driver chip.
As for generating the SIN/COS reference signals there's been more than a couple of threads on this forum regarding that specific task (though it usually involves a student who's final project is to build a three phase inverter or motor drive), if you search the forum I'm sure you'll find a couple of threads that might be of interest.
What size of motor are we talking about here? Is a little NEMA11 with a rated current of couple of hundred mA and a suitable voltage of <24V or is it a NEMA56 which will need a hundred volts or more and currents in 10A range?
/Henrik.
It is a Nema 23 with 2.3 amp per phase, and 1.8 V (but as i have been reading, it is better powered by a higher voltage supply, hence the current control you mentioned). Another subject that is not clear to me is the current control and microstepping, how can you implement it together or if one is dependent from the other one. not sure about it
Bookmarks