Stepper control via Linux/Java

S

Thread Starter

Sigi

Hi, I'm new here and from Costa Rica.

I want to fully control 3 stepper motors using my PC.

At this time I have learned that Windows will not work, reading a discussion here called "How can I make the stepper motor turn faster in VB6?"

I realize that I need to learn Java and Linux, but I want to know if any Linux can be used or only the RTLinux system can give me the results that I want to make the motors using the microstepping technique.

I have skills in VB programing and have some stepper software developed to control 3 stepper motors (bipolar ones) with the use of PC gamepads.

I want to know if there are some source code about microstepping with PC via parallel port?
 
M

Michael Griffin

See the following article. I've referenced this article several times already for previous similar questions. This doesn't cover microstepping, but it may be useful to you.

"http://linuxgazette.net/122/sreejith.html".

It describes controlling stepper motors using the parallel port of a PC. It includes circuit diagrams as well as 'C' source for the device driver and an example program. The article is intended to describe the basics of controlling motors for student robotics projects.

P.S. This question gets asked so frequently here that I usually just cut and paste the same answer I gave the last time it was asked.
 
R

Rokicki, Andrew (Andrew)

It is possible to do on Linux. One problem that you will run into with a standard kernel is that the slice time of the task scheduler which I think is 10ms. One way to get around this and get better results is to recompile the kernel. To accomplish this look up HZ variable in kernel source. Value of HZ=4096 will give you .25ms slice time(if I remember correctly). Do some testing and if standard-modified kernel is not good enough for your application go with RTLinux kernel.

Also similar to Windows you can not access I/O directly from user space you will need driver for this or be root (security warning).
 
C

Curt Wuollet

Java would not be my choice for this either. And the rest of the answer depends on just how fast you have to go. A minimal C program will deliver the best speed short of assembler. But your desire for a higher level language would suggest either a small C motor driver program that accepts commands from your HLL, or, if you have to go really fast, a RT routine that accepts commands from your HLL. In the first case you have two "ordinary" programs with some sort (there are many choices) of interprocess communications. In the second case the low level programs has more constraints and programming is a bit more difficult. Many "real time" applications are constructed this way so you can use the features of the operating system and GUI for presentation and use a small high priority program to twiddle the bits.

Regards

cww
 
R

Robert Scott

Microstepping requires special hardware. You can't do it with software alone. The hardware provides that ability to control the precise level of the current in each phase of the motor.

Robert Scott
Real-Time Specialties
Embedded Systems Consulting
 
C

Curt Wuollet

I believe that you can open the port, etc, as root and then drop the privilege level. And the earlier hardware remark is true, but you can use pretty rudimentary hardware if your software is fast enough. I think you can do the Hz gambit without a recompile if you have the right stuff enabled, might be a tunable. I haven't been as tuned in as I once was. Stepping at high speeds gets a lot more complicated than it seems, but everyone should have the experience. :^) Really moving something is easier than just running a motor because it provides some damping.

Regards
cww
 
Top