Using LinuxCNC to control 3 stepper motors concurrently
- MattMethods
- Offline
- New Member
-
- Posts: 8
- Thank you received: 0
I'm new to CNC programming and would like some advice for my Final Year project for my engineering degree.
I am building an experiment that needs to drive 3 stepper motors concurrently. The three motors will be used to drive 3 omnidirectional wheels, which in turn drive a larger metal sphere, similar to a ballbot experiment. I need to be able to set the motors to each operate at a certain speed (incredibly slow, somewhere in the order of 3-5RPM) for a set time x to drive the metal sphere in one axis, then be able to change speed and direction for another set period of time y to drive the metal sphere in another axis.
From my understanding, I need a program that will use a parallel port to output a certain number of pulses per second for each axis to control the speed and direction of the three stepper motors.
Will linuxCNC work using G-code for the operation of the experiment? Or is it possible to use another form of code to output x amount of impulses per second per axis for a certain amount of time within linuxCNC? Or should I look to a different software package altogether to control the experiment?
Thanks in advance for your help!
Please Log in or Create an account to join the conversation.
Let's start at the other end of the problem. How would you _like_ to control the machine?
Please Log in or Create an account to join the conversation.
- MattMethods
- Offline
- New Member
-
- Posts: 8
- Thank you received: 0
If you're referring to the actual drivers, I've got a small CNC kit found here oceancontrols.com.au/CNC-042.html where the driver is connected to the computer via a db25 cable, which receives information on direction and pulse from the computer and then sends that to each of the 3 motors individually.
In terms of a practical example of how I'd run it, I might want one motor to rotate clockwise @ 3.7RPM, and the other two motors to rotate anticlockwise @ 1.85 RPM for 5 minutes, and then change that to having one motor rotating clockwise @ 3.2 RPM, then another anti clockwise @ 3.2 RPM and the third stationary for 4 minutes etc. Ideally I want to be able to write a code for a certain experiment, be able to hook it all up, and let it run autonomously without needing to manually change the settings on the motors.
Does that help?
From my brief look online, would it be best to use G code to control the 3 axis (X,Y and Z), using incremental positioning (G91 I think it is?), and controlling the feed rate? Or would there be a simpler way to input the required pulses/sec and direction for the set time for each motor? From my understanding, if I used G code, I'd have to figure out the distances I would like each motor to travel, and then the feed rate I want it to run at?
Please Log in or Create an account to join the conversation.
I was wondering, though, if the requirement is to combine the three motions to achieve a movement in XY space. If that is the case then it would be better to look at using a kinematics module, to that an XY move is turned into three coordinated motor motions.
Please Log in or Create an account to join the conversation.
- MattMethods
- Offline
- New Member
-
- Posts: 8
- Thank you received: 0
For now, I just need a program where I can input the speeds for the three individual motors, for whatever length of time x, then the speeds for the second case for whatever length of time y etc, so I'm assuming that can be done using a pretty basic GUI, or do I need to go into HAL or something? (excuse my lack of knowledge around it, I'm still trying to wrap my head around the program).
Potentially, at some point, it might be worthwhile being able to input the relevant angles we want the sphere to rotate for an experiment in a custom GUI, rather than doing those calculations externally, which I would assume I'd look at using a kinematics module then? But at the moment, I just want to get the program running the stepper motors without any fancy math happening within linux.
Please Log in or Create an account to join the conversation.
How accurate do you need the timing to be? Have you considered that the time required might depend on the acceleration speed of the motors? It might be better to travel a fixed distance at a calculated speed.For now, I just need a program where I can input the speeds for the three individual motors, for whatever length of time x, then the speeds for the second case for whatever length of time y etc
This does sound like a job for a very simple custom GUI and some HAL. From HAL you would use the step-generators and perhaps some timer functions. Then you could connect the speeds and times directly from GladeVCP GUI elements to the step generator velocity and enable pins.so I'm assuming that can be done using a pretty basic GUI, or do I need to go into HAL or something? (excuse my lack of knowledge around it, I'm still trying to wrap my head around the program).
That depends on what you want to do. If this really is a ball-bot and you wanted to program it to move around in the XY plane with XY commands then you would use kinematics, otherwise the appropriate place to do the calculations is in the input data.Potentially, at some point, it might be worthwhile being able to input the relevant angles we want the sphere to rotate for an experiment in a custom GUI, rather than doing those calculations externally, which I would assume I'd look at using a kinematics module then?
Please Log in or Create an account to join the conversation.