rs485 huanyang speed control

More
29 Jun 2018 05:36 #113056 by InMyDarkestHour

Redundant or high priority task-switching functionality is fool-hardy on a system that supports a single application that demands the user's full undivided attention!


I see you removed the above section from your post.

It's kind of funny statement about a multi user & multi tasking OS. Maybe you weren't quite thinking this one through.......No harm tho ;)

No I haven't looked into the spindle section yet, no need for it ATM, I still prefer setting the speed manually for the time being.
What I have been working on & off with is remote USB control panel using an open source USB stack and an Arduino nano, which I'll probably switch over to a teensy for the greater I\O.
I've also experimented with the modbus component over TCP\IP with a Adrunio nano.

Please Log in or Create an account to join the conversation.

More
29 Jun 2018 07:18 #113063 by BrendaEM
Curtisa, thank you for your parameter assurance. This makes me feel that proceeding and experimentation are valid.

Yes, I would like to see your .hal and .ini files. I might learn something from them, when you have time.
Additionally, I think I see things in my .hal that don't need to be there...such as PWM code, perhaps.

I am going to backup my configuration, try rolling another stepconf session. It is possible that by me not putting enough information about the spindle--even if it may not appply to the HY spindle, the .hal it produces does not have something it needs.

Please Log in or Create an account to join the conversation.

More
29 Jun 2018 07:22 - 29 Jun 2018 07:55 #113064 by BrendaEM
ozzyrob, yes, I had written to respond to what you stated, but I realized that the forum thread, the topic, and LinuxCNC should come first, as should you. You are on this thread harassing me, and you aren't even interested in the topic.
Last edit: 29 Jun 2018 07:55 by BrendaEM.
The following user(s) said Thank You: InMyDarkestHour

Please Log in or Create an account to join the conversation.

More
29 Jun 2018 09:20 #113069 by andypugh

The Test2 example has likely needless PWM code in it, in what looks like the spindle section, which makes me trust it less as an example to learn from.
"setp pwmgen.0.pwm-freq 100.0"


There are at least three ways to control a VFD.

1) Software PWM: Typically using the parallel port. Hal needs to load a pwmgen component. Variable duty-cycle digital output is converted to an analogue voltage to become the speed reference for the VFD. The simplest converter is a resistor/capacitor filter, but that can only go up to PWM voltage and will thend to be non-linea. An optocoupler circuit can address both these issues:
photos.app.goo.gl/eTzgyahpoCThL9EdA
Or you can save some trouble and use: store.mesanet.com/index.php?route=produc...id=205&search=spinx1

1a) Software PWM on an FPGA card or similar. The PWM runs on a Pico or Mesa or similar card. There is no need to load a pwmgen, as there is one "in" the card with pins created by the driver. Normally you would use a daughter-card which already contains the PWM to analogue circuits. Typically these can output bipolar voltages (-10 to +10) if required.

2) Hardware analogue output. This is what the 7i76 and 7i76E do. A serially-accessed hardware drives a digital potentiometer.

3) Modbus (or other serial connection). Numbers are sent to the VFD. It decides what to do with them.

I have attached my spindle.hal as an illustration of why HAL samples tend to be of limited value; It uses a custom component to select gears from an electrically operated gearbox, it uses resolvers and it contains a PID component for closed-loop speed control that isn't actually used. So only about 8 lines would be any use to another machine.
Attachments:
The following user(s) said Thank You: BrendaEM

Please Log in or Create an account to join the conversation.

More
29 Jun 2018 10:38 #113077 by curtisa

Curtisa, thank you for your parameter assurance. This makes me feel that proceeding and experimentation are valid.

Yes, I would like to see your .hal and .ini files. I might learn something from them, when you have time.
Additionally, I think I see things in my .hal that don't need to be there...such as PWM code, perhaps.



Attached are my ini and hal files.I've done nothing more than follow the steps in the video I linked to earlier. It appears that the only change I made was to swap the directions of the spindle forward and reverse HAL pins. For whatever reason my spindle wanted to rotate in the opposite direction to what I was expecting. I could've started debugging the whole installation of the spindle, wiring and VFD, but in the end swapping the HAL pins was just the easiest way for me to achieve this. The rest is as per the Youtube clip and works as expected.
Attachments:
The following user(s) said Thank You: BrendaEM

Please Log in or Create an account to join the conversation.

More
29 Jun 2018 12:11 #113082 by Clive S

It appears that the only change I made was to swap the directions of the spindle forward and reverse HAL pins. For whatever reason my spindle wanted to rotate in the opposite direction to what I was expecting.


Just for the benefit of others. Swapping over any two of the spindle motor cables (U,V or W) would have had the same effect.

Please Log in or Create an account to join the conversation.

More
30 Jun 2018 02:36 - 30 Jun 2018 02:37 #113117 by BrendaEM
Thank you Andypugh, Clive S, and Curtisa,

Does the Hy spindle diver need classic ladder?

Presently, I am in this hellish loop. I need Stepconf because I have something missing in my .hal for the motor, but Stepconf will destroy my configuration, so I have to backup, Stepconf, sort, compare, edit, ad naseum.
  • My .hal is (also) way custom to accommodate my stepfw/steprev motors.
  • I don't know enough to invoke the modbus stuff to get it ready for the typical addition by Marco Reps.
  • I don't know if classic ladder is needed.
  • I likely I have needless PWM stuff in there from the original Stepconf .hal.
  • Misc: My original .hal/ini is missing GUI stuff for the readout/control, which I may forgo if I can get it going.
Last edit: 30 Jun 2018 02:37 by BrendaEM.

Please Log in or Create an account to join the conversation.

More
30 Jun 2018 04:06 - 30 Jun 2018 05:24 #113121 by BrendaEM
Oddly, I got it going a little bit : )
I can turn on the motor, adjust the speed screen readout, but I can't yet raise the motor speed.
The motor is running pretty slow, at it's minimum, but at least they are communicating.
A Modbus GUI loads and drops out before LinuxCNC runs.

One of the culprits was a missing -r twittle in the following line before the baud rate. My ergonomics at the machine make me look back and forth, and I failed to notice a difference. I don't know how many times I've looked at this. Duh!
loadusr -Wn vfd hy_vfd -n vfd -d /dev/ttyUSB0 -p none -r 9600

I still needed to add in the .ini the following in the [Display] section.
PYVCP = custompanel.xml

I thought it was missing one of these, but it's already connected:
net spindle-cmd-rpm => spindle-vfd.speed-command
ref: forum.linuxcnc.org/24-hal-components/292...inuxcnc-2-7?start=30

Other than the VFD proper name is different, and that there are two nets on the same line, right now it looks similar...
net spindle-speed-cmd  motion.spindle-speed-out-abs => hy_vfd.command
net spindle-cmd-rps-abs                <= motion.spindle-speed-out-rps-abs
net spindle-cmd-rpm-abs		        => vfd.speed-command

....to some of the lines in the spindle block I have:
loadusr -Wn vfd hy_vfd -n vfd -d /dev/ttyUSB0 -p none -r 9600
net spindle-cmd-rpm     	             <= motion.spindle-speed-out
net spindle-cmd-rpm-abs		             <= motion.spindle-speed-out-abs
net spindle-cmd-rps                    <= motion.spindle-speed-out-rps
net spindle-cmd-rps-abs                <= motion.spindle-speed-out-rps-abs
net spindle-cmd-rpm-abs		             => vfd.speed-command
net spindle-cw motion.spindle-forward  => vfd.spindle-forward
net spindle-ccw motion.spindle-reverse => vfd.spindle-reverse
net on motion.spindle-on	             => vfd.spindle-on
net spindle-at-speed                   => motion.spindle-at-speed

In the other thread there was some talk of speed scaling in the thread linked above, but I am not getting any change for my button-pushing effort, so I suspect I would be curing the symptom at this point. If I can create a speed change, then it was too low, then It would seem that scale would be just the thing.
Attachments:
Last edit: 30 Jun 2018 05:24 by BrendaEM.

Please Log in or Create an account to join the conversation.

More
30 Jun 2018 10:23 #113128 by andypugh
You don't need classic ladder to run the hy_vfd. That is a completely different way to run a modbus device than the hv_vfd HAL component.

....to some of the lines in the spindle block I have:
loadusr -Wn vfd hy_vfd -n vfd -d /dev/ttyUSB0 -p none -r 9600
net spindle-cmd-rpm     	             <= motion.spindle-speed-out
net spindle-cmd-rpm-abs		             <= motion.spindle-speed-out-abs
net spindle-cmd-rps                    <= motion.spindle-speed-out-rps
net spindle-cmd-rps-abs                <= motion.spindle-speed-out-rps-abs
net spindle-cmd-rpm-abs		             => vfd.speed-command
net spindle-cw motion.spindle-forward  => vfd.spindle-forward
net spindle-ccw motion.spindle-reverse => vfd.spindle-reverse
net on motion.spindle-on	             => vfd.spindle-on
net spindle-at-speed                   => motion.spindle-at-speed


I am _so_ tempted to just give a bunch of documentation links to prove that it is all there...

The vfd name is different because you have made it different in the loadusr line.
linuxcnc.org/docs/2.4/html/hal_basic_hal.html#r1_1_3

You are loading a component and waiting for "vfd" to be ready before continuing, then passing some parameters to the hy_vfd function, namely a name change (-n) a port name (-d) and a baud rate (-r) and a parity (-p)
So you could just use
loadusr -W hy_vfd -d /dev/ttyUSB0 -p none -r 9600
or even set the VFD params to the hy_vfd defaults (38400 baud, odd parity) and use
loadusr -W hy_vfd -d /dev/ttyUSB0
In either case the hy_vfd pins would all be called "hy_vfd.pin-name"

In your HAL the lines
net spindle-cmd-rpm-abs		             <= motion.spindle-speed-out-abs
...
net spindle-cmd-rpm-abs		             => vfd.speed-command
Should mean that the command signal is going to the VFD. You can check this with the halmeter (in the Machine menu with Axis and Gmoccapy, "loadusr halmeter" in a terminal in some other GUIs like Touchy)
If the speed command is changing then my suspicion is that PD002 isn't set to 2-communications port
The following user(s) said Thank You: BrendaEM

Please Log in or Create an account to join the conversation.

More
30 Jun 2018 17:02 #113136 by BrendaEM
Hi, in this instance and only in this one instance, I did figure out that the VFD was renamed in the loading line.

I used the same low baud rate as everyone else in holistic hope that it have a lower impact on latency elsewhere.

I will re-recheck the VFD PD002 speed command source, try commenting out classic ladder, and do some halmeter checking.

Thank you for your input. I am elsewhere on this forum asking for better docs with more examples. I appreciate what you have done for not only myself but others. I just think you shouldn't have to do so much of it : )

Please Log in or Create an account to join the conversation.

Time to create page: 0.124 seconds
Powered by Kunena Forum