Im looking for advice on how to achieve a similar operation.
im wanting to write code for a CNC plasma cutter torch height controller
when the table is not cutting the step and direction signals need to be passed through the arduino to the output pins but when cutting the input pin will be ignored and a height sensor signal fed into the arduino will be used to calculate a height error and output alternative step and direction signals.
I would like to think it was a simple problem but the more i try to find a solution the more i question if the digital input pin will track a step signal from a cnc controller like Mach3 or GRBL and duplicate the signal on an output pin.
I have already built a pcb to measure the arc voltage which works but i dint have the courage to connect its output to anything yet. It measures the 100v 5 - 50A output from the plasma cutter based on a potential divider using monster resistors. Until i see what is actually measured and when, i wont actually know whether or not it will be used to control the cutter. I could use it as belt and braces - a second input to confirm the pilot arc has triggered to reduce false input/operation.
It is however a good idea to consider a chain of multiple resistors that add up to the total resistance required. The input might see giant sparks of 1000V or more, so you need more physical distance between your high-voltage input and any low-voltage parts. With careful design, the smaller resistors will explode in the worst fault conditions and save your life. Make sure you look around more than one website or textbook for this part of the design. There's a lot of bad designs out there which will work, but they might burn down your house if there's a fault.
That's a huge assumption and its not my first project by a long shot.
I have over twenty five years experience in numerous engineering disciplines.
yes i could spend thousands on control gear and disagree that the humble micro isn't up to the job.
when i was a boy the Z80 was the go to processor of choice for not only primitive cnc machines but also spacecraft. If i don't try to make stuff work i will go insane and learn nothing, granted working on projects will probably drive me insane as well.
Your suggestion of more robust components i would suggest was a stab in the dark as there are no values mentioned on the drawing, the micro board and its associated filtering is also not shown on the drawing.
We are using Labview to control injection and spark timing on an engine. We use the Z-signal from a shaft encoder to create a reference signal that is used as a trigger for two counters, one for fuel injection and one for spark.
Currently, we are able to inject/spark once every N cycles. What we would like is to be able to inject/spark X times in a row every N cycles, as shown in the figure. For example, create a reference pulse every N cycles that triggers a retriggerable, finite pulse train of X pulses. In the example shown, N = 8, X = 3.
What hardware are you using to run this task? Error -50103 can happen for many reasons, the two most common being 1) all of the timing engines on your hardware are already being used or 2) you are trying to start a task with a channel that has been included in a task that is already running. Below are two articles I think would help solve your issue. One is common causes of the error you're seeing and the second is a retriggerablef inite pulse train example.
1. Based on the first article regarding ERR -50103, it seems that the most likely cause in my case would be "Case 3: Using multiple counter tasks on the same device." In the working code, outputs of CTR1 and CTR2 are both triggered by CTR0, but there is no error.
But I am not sure I fully understand how this works (see circled in red), especailly the pause trigger. Based on my configuration of counters described above, I am not sure which counter I must connect to the CO Pulse Ticks VI in my case - I am guessing CTR 3 as thats what I want to have a finite pulse train to use as a trigger for CTR1, CTR2.
The second link won't be needed. The essence of the idea is to use an external signal to serve the same purpose that the paired counter otherwise would have. But you'd also need that external signal to have very precise timing properties for the frequency & # of pulses you want to generate. It'll be simpler for you to just use Ctr 4 (and its pair, Ctr5) for your finite pulse train.
I am also trying to use this VI for a similar application to control fuel injection to a diesel optical engine. I have a PCI 6601 card however which has just 4 counters. Since the finite pulse generation requires a pair, I was wondering if I could use 1 counter from my pci 6040E daq card and the rest from 6601. Do you think that would work, using counters from 2 different devices?
If the frequencies are not contradicting between the 6601 and the 6040E DAQ card it should work. However, to avoid complicating matters, I would advise you to try to get both parts of the pair from the 6601 if at all possible and to use the 6040E DAQ card to replace the counter you move to become part of the pair for the finite pulse generation.
Thanks a lot for your advice. I've actually decided to go with a simpler approach to control the fuel injection instead of the above VI which is a bit too sophisticated for me to modify for my needs. I have decided to use the Generate Digital Re-trigger-able Pulse VI to control the injection which is perfect for my needs. Basically I need to receive a trigger signal which is the exhaust top dead center pulse from my engine and start counting from there. For an ignition advance of say 10deg(so basically 350deg after the trigger signal) I would need to count 700 pulses since my shaft encoder sends a pulse for every half degree. I have a few quick questions which I would really appreciate being answered:
1. I want to keep the pulse low for the first 350deg and then emit a pulse after that. I want to know in what order does the counter output pulse VI execute the ticks. Does it execute the low ticks first and then high ticks if the idle state is set to low? I read somewhere that for a retriggerable pulse, for what I need, I need to set the low ticks=initial delay. I would still like to know however just for my knowledge sake, if the initial delay is set to low, what executes first, low or high?
2. What should I do regarding my loop timing? The engine will be running at 600rpm and the source is the shaft encoder pulses for every 0.5 CAD(crank angle degree). Should I just delete the wait timing function inside the while loop? Is there a way to synchronize the while loop with the CAD?
3. This last one is not very important but would be convenient. I want to be able to control the number of injections so I want to use another counter to read the number of injection pulses it receives and then stop the program according to the number of injections I set. Can this be done within this same while loop or will it lead to complications?
2) I would recommend deleting your wait. The vi you attached is writing the digital signal to your "Counter" input. The "Source of Ticks" input specifies what frequency the counter is being generated at. Using this frequency you can decipher the needed timing for synchronization with the counter being generated. In a new vi using the DAQmx read you can read the signal in at a pace synchronized by using the same pace as your writing function in the channel.
In 2P mode, both signals are a pulse train. Only one input at a time will have a frequency, so if the CW pulse train is present, the motor rotates CW. If the CCW pulse train is present, the motor rotates CCWs. Which input receives the pulse train depends on the desired direction.
An absolute move transports the carriage to the commanded position regardless of its current position. For example, if the current position is zero and the commanded move is to 100 mm, the controller sends enough pulses to move the actuator forward to the 100-mm mark and stop.
To convert engineering units to pulses, first determine the constant that determines the number of pulses needed for a given move. Assume in the example above the motor requires 500 pulses to rotate one revolution and one revolution is 10 mm. Calculating the constant can be done by dividing 500 (ppr) by 10 (mm p/r). So the constant is 500 pulses/10 mm or 50 pulses/mm.
This constant can then be used to calculate the number of pulses needed for a move of a given distance. For example, to move 15 mm, 15 mm 50 ppm = 750 pulses.
To convert a pulse counter reading into engineering units, simply divide the pulse counter value by the command pulse constant. Thus, if the pulse counter reads 6,000, divided it by the command pulse constant calculated from the example above, the actuator position would be 6,000 pulses/50 ppm = 120 mm.
To command a speed in mm and have the controller calculate the proper frequency in Hz (pulses per second), the speed constant must first be determined. This is done by finding the command pulse constant (as shown above), but the units are changed. In other words, if the motor puts out 500 ppr and the actuator moves 10 mm per revolution, then if 500 pulses per second are commanded, the actuator will move 10 mm per second. Dividing 500 pulses per second by 10 mm per second results in 50 pulses per second per mm. Therefore, multiplying the target speed by 50 results in the proper pulse frequency.
The formulas are the same, but the units change:
Speed constant in pps = pulses per revolution/distance per revolution
Pulse speed (pps) = (speed constant) speed in mm
Using a setup that uses pulse train signals to control motion might seem daunting at first, however, paying close attention to signal types and settings on the controller and drives at the beginning can reduce the time spent making it work. In addition, if one takes the time to do some basic calculations right away, programming the speeds and distances will be easier and machine operators will have more intuitive information displayed on their HMIs.
Article published in Machine Design Magazine