Driving SEW Motors
Can the HAL be customized to provide RS 485 commands?
Rick Retzlaff, University of Saskatchewan
Please Log in or Create an account to join the conversation.
Can the HAL be customized to provide RS 485 commands?
Yes.
Whether it will work properly or not is a slightly different question, and might have to be settled by experiment.
Do you know the communications protocol? How would the drives feel about 1kHz update rates?
Does the existing PC have RS485 ouputs?
Please Log in or Create an account to join the conversation.
I have a national instruments are RS485 PCI card that I intend to use
A backup plan would be to stick an Arduino Mega in the middle to interpret the step/direction signals from the parallel port output and then generate RS85 commands directly to the motor controller. My concern with this is jerky motion.
This will not be a precision machine no matter what we do. To some extent, it's a learning exercise for the students.
Please Log in or Create an account to join the conversation.
Maybe it would help to describe a typical LinuxCNC control loop.I would be surprised if it was happy with the one kHz update rate. These are industrial automation motors that are not used to this kind of thing.
Every 1mS (typically) the servo-thread runs. It first reads all input (such as encoder positions), Then it calculates the next positions in the "motion" module, and then it updates all the outputs.
In the case of a parallel-port software-stepping setup some of the inputs and outputs are actually the commands and current positions of the software stepgens (and possibly encoder counters) which are running in the completely separate base-thread.
So, to run your drives in this structure, youwould be reading back a position from the drive and sending a new position at 1kHz.
You would probably have to write a HAL driver for that card. (which might not be especially difficult).I have a national instruments are RS485 PCI card that I intend to use
I don't know of any currently-supported RS-485 hardware, though there is some RS-422 stuff.
The fact that I don't know about it is only a vague indication that it might not exist.
There is a userspace Modbus module. I don't know if that would be part of the solution. (taking the signals through HAL into Userspace might reduce the timing problems, even if the command position is updating at 1kHz the usersace component is free to ignore the fact).
Eeeew!A backup plan would be to stick an Arduino Mega in the middle to interpret the step/direction signals from the parallel port output and then generate RS85 commanda
Please Log in or Create an account to join the conversation.
I am not convinced the 1 ms cyclic loop is relevant to these SEW controllers. From what I understand, when EMC2 is running in a closed loop system -- it is directly reading encoders and providing control signals to the motors themselves. Hence the PID Controller built into the system.
In the case of these SEW controllers, this is all occurring internal to the controller itself. You just tell it to go there, and it gets there with all of the ramps and feedback internal to the controller itself. Is this anything like any other interface that EMC2 works with? I don't think it's even possible to get direct encoder information back from the controller.
I understand your sentiment with regards to sticking an arduino in the middle. However, in particular what is the nasty bits of this that you could see?
Re userspace Modbus module - could you point me towards some documentation?
Rick
Please Log in or Create an account to join the conversation.
To a certain extent the Mesa and Pico stepper boards work this way, but in 1mS time slices.You just tell it to go there, and it gets there with all of the ramps and feedback internal to the controller itself. Is this anything like any other interface that EMC2 works with?
The problem with sending endpoints and speeds to two motors is, how do you do a curved path which requires coordinated motion between two motors?
This problem gets more interesting when you consider acceleration limitation too.
The buffered systems such as the Smoothstepper often used with Mach3 presumably do the curve generation in the Smoothstepper, not in the controller.
That might not matter, you can either trust the motors to go to where they are told, or use any position feedback that comes back down the RS422 link.I don't think it's even possible to get direct encoder information back from the controller.
Partly that it adds more hardware in the middle of a problem caused by too much hardware. And partly going from position to step to serial to position.I understand your sentiment with regards to sticking an arduino in the middle. However, in particular what is the nasty bits of this that you could see?
The code is here (including an annotated INI file)Re userspace Modbus module - could you point me towards some documentation?
git.linuxcnc.org/gitweb?p=linuxcnc.git;a...hb=refs/heads/master
I am not doing very well at tracking down any docs. It was based on this one:
wiki.linuxcnc.org/cgi-bin/wiki.pl?Contri...ts_Les_Newell_flavor
Which might have docs in the ZIP file.
Please Log in or Create an account to join the conversation.
Through RS 485 I can command a motor speed and retrieve position (not encoder counts, but actual position -- 32-bit integer. The motors actually have resolvers). If I had a driver that could talk through the RS485 card, HAL would look after PID control ???. What would be involved in terms of custom programming to make this happen?
It doesn't necessarily have to run at 1 kHz. This is a big ugly slow machine, I could run it more slowly. I read about a parameter in one of the configuration files that could slow this down.
thanks in advance.
Please Log in or Create an account to join the conversation.
that should make a closed loop velocity mode PID control possible.
Since I would expect the velocity commands to be quite accurate
a lower update rate is feasible as long as you don't have very high
acceleration so the steps in velocity during acceleration do not get too big
As long as your driver can get the position in and velocity out to HAL pins the rest is doable
entirely in HAL or at the worst with a custom component or two
Please Log in or Create an account to join the conversation.
That would be rotor angle, presumably? You can probably promote that to a multi-turn value fairly readily, code in the Mesa resolver card driver currently does exactly that.Through RS 485 I can command a motor speed and retrieve position (not encoder counts, but actual position -- 32-bit integer. The motors actually have resolvers).
If you had a driver, the rest becomes almost trivial.If I had a driver that could talk through the RS485 card, HAL would look after PID control ???. What would be involved in terms of custom programming to make this happen?
Do you have links to the docs for the drives and the RS485 card?
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.