Hello Guest it is April 23, 2024, 12:49:50 PM

Author Topic: [CSMIO-IP/S + MACH3] using an analogue output to control an external device  (Read 7751 times)

0 Members and 1 Guest are viewing this topic.

Hi all,

I am trying to control an external device using an analogue output from my CSMIO-IP/S to control an external device (Arduino).
I managed to configure the setup to output a voltage signal using a G-code adjusting spindle speed ('S####' command).
So, when I set different numbers after 'S' command, the output voltage changes.
But, the problem is whenever I change the voltage, the stepper motors controlling the main axes stop for a while. After adjusting the voltage, they run again.
I really need a smooth and continuous operation.
The current spindle setting is attached.

Any advice will be really appreciated.
Do you think I can solve the problem using a macro?

Best Regards,
Eric.
« Last Edit: November 25, 2020, 07:02:17 AM by razer00 »

Offline Tweakie.CNC

*
  • *
  •  9,199 9,199
  • Super Kitty
    • View Profile
The problem is that the S### command breaks the CV chain.

Axis movements do not break the chain so movement of a spare axis such as from B0 to B100 will create step and direction signals on the Output pins of your choice which your Arduino could use. Also electronic potentiometers are driven by step and direction signals. Food for thought perhaps ?

Tweakie.
PEACE
Thank you very much for your advice, Tweakie.

Unfortunately, I'm not very experience in CNC control so I cannot understand what you meant by CV.
But, as far as I understand, you say I cannot use S command without stopping the axes?

Is there any way to output a analogue voltage signal at each target coordinate without stopping the motion?

Best Regards,
Eric.

Offline Tweakie.CNC

*
  • *
  •  9,199 9,199
  • Super Kitty
    • View Profile
Hi Eric,

Sorry for the abbreviation, CV stands for Constant Velocity. Let me explain in a different manner...

You cannot use an S### command without breaking the smooth chain of motion.
However, there is a way - others, in the past, have connected an encoder to the Z axis stepper motor and because axis movements can be made without breaking the smooth chain of motion used the encoder output to create an anologue variable.
As said earlier, my preference would be the electronic solution of connecting an electronic potentiometer as the B axis then using that to generate the required analogue variable. An Arduino could be used to perform the same function.

Hope this helps,

Tweakie.
PEACE
Hi Tweakie,

Yes, that could be an option, but it is not a very convenient solution for my existing setup.
Do you mean that there is no other way to output voltage without disturbing the motion control at all?

Best Regards,
Eric

Offline TPS

*
  •  2,505 2,505
    • View Profile
hello eric,

can you describe, what you want to do, for the Moment i am not able to follow.

analog Output of CSlab can be controlled within macros (M call's) for example)
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Hi TPS,

Thanks for heading up.

CS-lab has suggested me to use the analog output for spindle speed (S command).
But, the problem is that whenever the G-code runs the S command, the axes (stepper motors) movement stops.

Would the macro be able to output voltage signal without stoping the axes?
If so, how should I setup the pins and macro?

Thanks,
Eric.

Offline TPS

*
  •  2,505 2,505
    • View Profile
hello Eric,

as Tweakie sayed any usage of S word or also a custom macro call will interupt constant movement.

so the only way is to use an "unused" axis and read the axis Position via macropump or a brain and
write the analog out manualy.

here:https://en.cs-lab.eu/digital-and-analog-ios-configuration-its-easy/
is a Diagramm, witch Shows the adresses and ranges of the analog Outputs.

a code example for macropump would be:

Code: [Select]

'convert B-axis Position 0-100 to 0-10V on analog output1
SetModOutput(81,GetDro(4)*4.095)


but the update time will be about 10ms

anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.
Hi TPS,

Thank you very much for providing the very answer that I wanted to get. So, the conclusion is there is no way to directly use the analogue output without stoping the axes motion. OK.

You suggested converting the axis position to analog value.
Can I just use macro without any hardware modification?
I'm sorry I don't have experience in using macros before.

I've got 4 axes currently being used, with 6-axis CSMIO-IP/S module. I only have 4 stepper motor drivers connected.
Do you mean that I can just make a macro you suggested and connect wires to analog output pin 81?

SetModOutput(81,GetDro(5)*4.095)

What is the number 4.095?

Best Regards,
Eric.

Offline TPS

*
  •  2,505 2,505
    • View Profile
in my posted link (https://en.cs-lab.eu/digital-and-analog-ios-configuration-its-easy/)
you can see analog Output Need's a value 0-4095 for 0-10V

so 0-100 (b-axis Position DRO(5)) multiplied by 4.095 will bring the result.

you can put the posted code into macropump.m1s (make sure macropump is enabled in
General config) and it should work.
anything is possible, just try to do it.
if you find some mistakes, in my bad bavarian english,they are yours.