Tuesday, November 06, 2007

 

Non Blocking Stepper Control!

The biggest hurdle so far in developing an Arduino based firmware is controlling 3 stepper motors from one Arduino board. It doesn't have threading, so in order to control them separately you have to have to do time based checks. The Arduino libraries have support for getting milliseconds elapsed, but for driving these steppers at 200RPM+ speeds, I need sub microsecond resolution. I poked around in the forums, where westfw posted a sweet little function to get high precision ticks.. basically a counter that increments every 4 microseconds!

I took that function, put it into my Arduino RepStepper library, and tested it out. I had a few hiccups at first (which later turned out to be a ridiculously simple mistake) but once I got it working, I had a non blocking stepper controller class! The main benefit is that it allows me to control 3 steppers independently of each other. Here's a video of 3 stepper motors moving at different speeds, in different directions:


Crazy Stepper on Stepper Action from Zach 'Iowa' Hoeken on Vimeo.

Comments: Post a Comment

Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?

Subscribe to
Posts [Atom]