CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Stepper Motor Microstepping with an MCU or Arduino

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
neoply



Joined: 23 May 2017
Posts: 7
Location: Banned - spammer

View user's profile Send private message

Stepper Motor Microstepping with an MCU or Arduino
PostPosted: Tue May 23, 2017 2:28 am     Reply with quote

Hello all. Thanks for taking up your time to read my post.


I'm trying to make a fully configurable stepper motor controller by directly driving the H-bridges with the MCU, like an Atmel Atmega or other MCU, and use current feedback with the built in ADC, while using the PWM to create a current feedback loop (the ADC would measure across a sense resistor).


I'm trying to get the basics down of what is required to accomplish this. I need to be able to support microstepping as well. I've been looking at TPS2115APWG4 as the datasheet of http://www.kynix.com/uploadfiles/pdf9675/TPS2115APWG4.pdf , and have a basic idea of what it needs to do, but the implementation confuses me a bit. I can't find any other projects that accomplish this. It seems that nobody else uses microstepping, or nobody uses a current feedback loop.


Are there any open source projects that accomplish this task? If so, where can I find the source code and schematics of these projects ?


Can anyone help me ? I am very puzzled about this question.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue May 23, 2017 2:44 am     Reply with quote

There are several MicroChip application notes on this.
Assuming you do intend to use a PIC (given this is a forum for CCS C on the PIC...), these give a very good start, and are fairly easy to translate.
Some are for really basic PIC's and date back over 10 years. These actually give a superb overview of what is required. AN822 as a start.
There are also much more modern versions for chips like DSPIC's. AN1307. This uses a comparator to ensure safe operation.
The flow charts are really useful.

Beware that unless you buy special steppers designed for microstepping, the positional accuracy for this degrades as you try for finer step sizes. Perhaps 1/16 often works well, but the errors start to become very significant beyond this.

Also remember that the faster you want to move the motor, the more voltage you need. You want to create fast changes in a magnetic field. Inductors (which the coils of a stepper are), start drawing no current when you apply a voltage, and the current then rises, dependant on the voltage being applied, and the inductance of the coil. The only way to speed up the rise in current is to use much higher voltages. For instance a Microstep driver I have here is using 4.8v motors, and 72v drive. What you then have to do is have the hardware setup to limit the current, on a per pulse basis, not at the slow speed that any micro can manage, so that as you slow down, the coils do not receive more current than they are rated for.
So for low speed, what you describe may well work. To go faster you need to think again.
neoply



Joined: 23 May 2017
Posts: 7
Location: Banned - spammer

View user's profile Send private message

PostPosted: Tue May 23, 2017 3:55 am     Reply with quote

Thanks for your reply. I will think again to take your ideas and advice. Thanks a lot.
Ttelmah



Joined: 11 Mar 2010
Posts: 19195

View user's profile Send private message

PostPosted: Tue May 23, 2017 8:08 am     Reply with quote

It's well worth looking at the second AN I listed. They use a DSPIC and trigger the PWM fault input to stop the drive at a critical power level, and two analog inputs to control the PWM at lower current levels. The flow chart is nice, and should give good results.
neoply



Joined: 23 May 2017
Posts: 7
Location: Banned - spammer

View user's profile Send private message

PostPosted: Tue May 23, 2017 8:16 pm     Reply with quote

Thanks for your advice. I will enhance basic knowledge about it. Thanks a lot.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group