Spindle Speed to Serial Port

More
18 Jul 2010 09:59 #3403 by gangsta
Hi

I have just finished retrofitting my Denford Orac lathe with driver boards, and a PC running EMC. All is going well! The only part I cannot figure out is the spindle speed output. My VFD takes a 0-10v Analogue signal for spindle speed, and I cannot afford to buy a fancy controller board with analogue outputs. I am however quite handy with PIC processors.

Can someone tell me how to output the desired spindle speed to the Serial Port. I am new to linux and python, but im sure it will be a modified version of the thread here - www.linuxcnc.org/component/option,com_ku...tart,0/lang,english/

I guess the output to the serial could be something like S1000.

It would be handy to offload all the spindle controls to the board, for example start/stop/direction etc, or even better add some relay controls too. Basically all i/o that doesn't need to be realtime (will save pins on the parallel port card)

Examples: Tower lights (I have a red/green/blue lights for stopped/toolchange etc), coolant, door interlock, chuck clamp etc

What would be best to handle closed loop spindle speed, having emc monitor the spindle and send changes to the required speed, or just have emc send the speed, and the PIC lock onto the desired speed (still connect the encoder to emc for screw cutting etc)

Many thanks

Graham

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

More
19 Jul 2010 00:12 #3410 by Zig
Replied by Zig on topic Re:Spindle Speed to Serial Port
I am no great expert when it comes to HAL programing.. ( just starting to look at it with some degree of urgency) but it would seem to me that if You had a spare LPT port or card You would then be able to do a number of things directly and immediately through the second ( maybe even third LPT port) rather than using RS232 portsince i am sure there is a hal component to handle that kind of port.

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

More
19 Jul 2010 15:05 #3416 by andypugh
It is probably a lot easier to use PWM into a lowpass.

I made a circuit using a current source, opto-isolator and a dc-dc converter as I needed a fully-floating 0-10V as the controller I had required that the variable voltage be connected between motor positive (at +100V) and the control terminal.

The drawback with my circuit was that I missed the point that my opto-isolators don't sink current (not pull-push) so it ended up being very non-linear unless used at 300Hz. The "logic output" optos such as uk.rs-online.com/web/search/searchBrowse...getProduct&R=5473699
might not have this problem.

Using an opto you can have a 5V PWM input and a 10V PWM output, then it is just a case of connecting a capacitor between the output to the VFD and earth, and a resistor between the output and your opto-isolator output. If the opto is not "push/pull" then you will also need a resistor in parallel to the capacitor to allow the output voltage to fall as well as rise.

Even if you end up with a non-linear pwm to voltage realtionship, if you use closed-loop speed control then it will self-correct.

Adding an external PIC board just seems to be an unnecessary complication.

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

More
19 Jul 2010 17:16 #3420 by gangsta
Thanks for the replys

Andy, thats what I was hoping to hear, I asked a few times yesterday in the IRC to see if I could just do PWM > low pass. How can I find out if my VFD terminals are at mains potential?

Also will a single stage filter work ok, or would a 2 stage filter be better?

ZIG, thanks for the suggestions. I have 3 LPT ports in my system. So I may play more with HAL in the future. I would in the future still like to get the spindle speed command passed out to a PIC, so that I dont need to rely on the computer generating PWM. Using an external board it can be closed loop without tying up the processor. For now an isolated low pass it is :D

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

More
19 Jul 2010 18:40 #3421 by andypugh
gangsta wrote:

Andy, thats what I was hoping to hear, I asked a few times yesterday in the IRC to see if I could just do PWM > low pass.

I know, I saw both questions, somewhat after you had logged off again.

How can I find out if my VFD terminals are at mains potential?

They won't be, this was a peculiar drive intended to be driven from an on-board pot. But to be sure, just check it with a multimeter. Don't worry too much about the "input" terminal, but you will almost certainly find that all the low-sides are common and the +10V for a pot is only +10v.
In fact, you could use that potentiometer +10V as your 10V for the pwm converter.

Also will a single stage filter work ok, or would a 2 stage filter be better?

Single stage is fine, you will probably want a time constant around 20Hz (nothing higher makes any real sense with a 50Hz motor) and a 1kHz PWM, so the sharpness of the cutoff is irrelevant.

Using an external board it can be closed loop without tying up the processor. For now an isolated low pass it is :D

You worry too much. (Or have spent too long on PICs) Running a PID in the servo thread takes almost no CPU.

Here is my schematic. If I was doing it again I would use the +10V from the VFD instead of the DC-DC convertor. I would also probably skip the constant current source. Note that there are two PWM to voltage convertors on this schematic, plus some relay logic to steer them to the right places. In fact, you can probably ignore all of the schematic other than the "yes, it is perfectly do-able" aspect.

picasaweb.google.com/lh/photo/QYTcQg-xDq...ymTQ?feat=directlink

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

Time to create page: 0.136 seconds
Powered by Kunena Forum