Yeah, sometimes it's a real challenge keeping the magic smoke, inside the chips.
Printable View
As time has gone on, I've found multiple posts about building an Arduino THC. They always have a lot of discussion and disagreement on voltage isolation and positive versus negative arc voltage.
Then, they always just end. I've yet to see a resolution.
I did some more testing with a scope. It reinforced the belief that the divided voltage coming out the CNC port is isolated. If you measure it, you get a reasonable positive voltage.
If you hook the ground of the scope to the ground clamp and the positive to the CNC port, you get a very dirty negative signal with voltages well out of the digital logic range. So, it looks like its bad to have earth ground connected to any logic circuit in the overall system (torch, Arduino, motor control). The PC is not an issue for the normal interface as I'm using an isolated BOB with seperate power supplies.
Since the Arduino runs on a wall wart with no ground, there shouldn't be an issue with ground loops between the Arduino and the CNC port.
I looked at the 5 volt supplies I have for my motor controllers. The chasis-A/C ground on that is indepenent of the negative signal. So, I think that it is isolated enough that it wouldn't cause the any problems. (I need to run that by my EE friend.) But, it probably wouldn't be a bad idea to put some opto isolators on the logic signals that go to and from the break out board.
I now have all the parts for an op-amp filter circuit. Once I figure out if optoisolators are necessary, I can get any final parts and do the electronics build.
I've seen a few posts across the internet regarding the output of the voltage circuits on the CNC connection being sketchy and sometimes dropping off midway through a cut. Not sure if it is really an issue, just something to keep an eye on.
I had kind of forgotten about Arduino. I have another potential use for it for a speed controller on a small clutch Dyno I hope to someday get completed.
I have seen a few THC applications that just end as well. Seems weird.
I spent the day at an Analog Devices seminar. They presented isolators for a couple hours. They have some really cool stuff that could be used for this project - if I could solder fine pitch packages/surface mount - which I can't.
I run two power supplies on my Break Out Board so that it is truly isolated (it doesn't share a common power supply).
I realized that I could take one potential ground loop out of the picture by powering the Arduino from the 5 volt power supply that runs the motor side of the BOB and motor controllers (rather than its own supply).
The updated system diagram is below:
Attachment 7931
I haven't build the op amp circuit yet, but tonight I wired the Arduino to run off the motor's 5 volt supply and had it reading the torch voltage.
It was pretty noisy, but I didn't have the op-amp circuit yet and the filtering was pretty crude. But, it was reading the voltage, scaling it and then displaying it.
At this point I feel pretty sure that this hardware configuration will work from an isolation viewpoint, which was my biggest concern. I just need to start working on the filtering to get a decent reading.
Sounds great. I really like the approach you are taking with this.
I think you are going in the right direction! I like that you are using the full arc voltage instead of the divided arc voltage. I'm sure there is a very good reason why one would use divided arc voltage for THC. Using the full arc voltage will allow anyone with any plasma cutter to use your THC. I also like that you are developing the OK to move as well. My setup does not use the OK to move, and I know other people have had to jump the OK to move pins to work. This could potentially open up the cnc plasma market for all plasma cutters to have a THC ability.
I haven't looked at the okay to move pins yet. Have you heard of any problems with them on the PP50?
I didn't have any special plans for that yet, I just figured it would be cleaner to put all the signals through the Arduino. But the side benefit is that they are there if you need to do anything.
I had thought about putting the E Stop through it, but decided not to for now.
This guy has several post, but he had some troubles with the OK to move function.
http://www.cnczone.com/forums/plasma...bot_4_0_a.html
I think the external CandCNC method is probably more robust than however the internal is being done.
If I am not mistaken, John from CNCzone has since switched over to a Hypertherm unit. He is the one who was having unstable voltage and similar issues causing the torch to quit halfway through the part, etc.
Not sure it if was just wiring or settings or not. His solution was to swap to a Hypertherm. Cost about $1500 more than the Everlast I believe he noted.
I didn't read the entire thread, but I did see where he said that he used the divided voltage. Depending on where the noise is being introduced, you could have the case where the noise is a much greater percentage of the overall signal with using the divided voltage instead of the full voltage.
I've been working on the software over time and spent this weekend getting the hardware prototype done.
My goal was to have enough to allow me to test my table without THC functionality. I believe I'm there. It works on the bench, I just need to try it on the CNC table. (Currently focusing on getting all SheetCam and Mach configured properly so I can try to cut.)
I figured that I'd build the prototype cheap and easy. If/when it works well, I I'll do a clean build. I didn't want to spend a lot of time in case I had to rework anything.
So I could test the software, I wired the buttons before I had an enclosure. I make the wires long, so now its a bit of a rats nest.
To prevent any issues with ground loops, I wanted to put the electronics in an insulated box. Project boxes are expensive and I didn't feel like making a wood enclosure for it. So I went to Walmart and bought a cheap plastic food container. They didn't have much to choose from and I ended up having to get one with a vent in the middle. (The hole in the lid.)
Attachment 8141
The single push button on the left is to set the mode (disabled, run, manual torch moves). I haven't wired it yet because its a late addition.
The two red buttons are for voltage up and voltage down. They will also allow moving up and down through the menuing system.
The black buttons on the right are for the menuing system and are "Menu/Select" and "Cancel".
I looked at a number of different prototype boards. I ended up using one that is made for the Mega board. I put the voltage divider on the board (it includes a filter cap and zener diodes for overvoltage protection). You can see the resistors left of center on the board.
You can see the corner of the relay board on the right behind the Mega board. This is for the plasma trigger.
I haven't finished the voltage sensing circuit. I need to add the amp/filter. I have an op amp circuit that filters off anything over 100 hz. Hopefully that will help with noise.
Attachment 8142
The box has a DB-9 at each side. One goes to the CNC port and the other goes to the motor control. Since I knew I'd have to work on it, all the wiring connects to the board with plugs that go on header pins.
I had to change the LCD display mounting. It usually mounts on top of the Mega board, but I wanted the proto board there. So, I made a couple "extension cords" that all them to be separated.
Looks pretty good to me. I use containers line that for all sorts of things. No sense in trying to make everything neat and tidy when you are 99% sure you are going to want to add in another feature or change something.
All it needs is for you to break out the sharpie and label it :-)
So, I have the THC running enough to receive "Torch On" commands and then trip the relay and do feedback of the Arc Good signal. (Don't have Mach looking at the Arc Good yet.) And, I've successfully done my first cut.
So now I'm going to start working on the analog voltage filter. But I was doing some general web surfing and it looks like a number of people have just done a serial link to Mach and implemented the THC in "Brains". But, these are like the other posts talking about homebuilt THC's - they are from around 2010, and then just ended after a couple posts.
I've just finished wiring the op amp circuit. It is a 1:1 amp circuit (no amplication), but should filter out any frequency over 100 Hz. Hopefully, that will deal with the noise.
I've check the wiring tomorrow and add a couple resistors on some signal lines. I started "cleaning up" the software last night, so once that's finsihed, I can load it up and see how well it does.
Attachment 8220
On the upper half of the board, the components to the left of center is the voltage divider with filter cap and zener diode overvoltage protection.
On the bottom left corner is the op amp circuit.
The green wires are so the display can be mounted away from the proto board.
Its been slow going.
As the code has grown in complexity, I had to reorganize it and clean it up. That took about half a day, then another half day to fix everything I broke.
I started testing the op amp circuit today and I have to go back and check my construction. I have 2.5 volts coming out with 0 going in. The output voltage should be the same as the input voltage.
There's a great free program from TI. It's called "Filterpro". I used that with input from my "consultant" to come up with the op amp circuit. It's in the attached image.
Attachment 8261
It probably won't be until mid-week that I can get some help figuring out what I did wrong.
It's been a while since I posted any updates on the Arduino THC project.
It's taken me a while to get the code working after I screwed it up by "cleaning it up". While I was working on getting it working, I started testing other features I had implemented. Unfortunately, it still isn't working as much as it was before I broke it.
I have usage trackign mostly working (all the parts that I could test). It tracks:
- Pilot arc count (number of times torch was triggered)
- Pierce count (number of times arc good signal was received)
- Usage time on tip (hours, minutes, seconds)
- Cutting voltage set point
In addition to updating the data, it will save it to flash after having been idle (not cutting) for a minute.
I've implemented a state machine to control the THC. The states it has are:
- Disabled (won't pass through "torch on" signals)
- Enabled (allows use of menus and goes to cutting mode on "torch on" signal)
- Cutting (actively cutting and controlling torch height)
- Cruise Control (monitoring cutting voltage and will set cutting voltage to the current value when the button is pushed)
The menu system is working, though not all the features are implemented.
I have the voltage monitoring "sorta working". I'm using the op-amp filter and the software is filtering the voltage readings using a sliding window average of 25 samples total, each taken about every 1 - 3 millisecond (sampled as fast as possible). The voltage value is displayed on the LCD every 25th sample.
It's not the best way to do it, but you can tell how stable the voltage is by how blurred the LCD display is. If it isn't being filtered well, it's just an unreadable blur. I've gotten to the point where it appears to be pretty stable at the 1 volt level (I haven't really been paying attention to the tenth of a volt part). While this may not be the most reliable way to figure out what's going on - it's the best I have right now.
When the pilot arc ignites, I get a good voltage display that is pretty stable. However, when it goes into cutting mode, the display goes to zero - which I'm sure is a software bug. My challenge is to try to figure out how to debug it without a debugger and without a serial port to dump data to (I ordered chips to opto-isolate the serial port, but don't have them yet.)
I'd like to figure out an easy way to debug this without using the CNC system. I could make a box to do it (power supply, switches, LED's and a potentiometer to vary input voltage), but would rather not spend the time. So, if I can't jury rig it, I'll have to do that.
I've also been looking at noise issues. The bulk of the noise is coming from the switching supplies that run the CNC interface, and the stepper controllers. I'm using this to power the Arduino. It's horribly noisy. When disconnecting the interface to the CNC and powering it on its own wall wart - the signal is much cleaner. I should be able to address that once I get the opto-isolators. That will let me use the wall wart and I can isolate the signals to the CNC and for a serial port to collect data.
I hadn't bothered to hook up a common ground yet as I didn't want to destroy anything with a ground loop. I did find that I got rid of a lot of noise by just connecting the chasis of the PC to the old computer chasis holding my motor controllers and power supplies.
I got a new oscilloscope for this project and I still haven't totally figured it out. It appears that some setting I'm changing causes the signal to appear to be much noiser (in spite of the LCD display showing that it appears pretty clean). I haven't figured that out yet.
At this point, I need to:
- debug the "arc good" signal (I'm getting it from the PP50, but not passing it back to the CNC)
- figure out why 0 volts is displayed while cutting
- figure out why it seems to hang every now an then
Then, later this week I should have the parts to opto-isolate the interface to the CNC and a serial interface to the PC.
After spending all night debugging the THC software and my Mach configuration, and counting countless 1" circles, I got basic THC functionality running.
At one point the hysteresis value I was using was too large and it made it look like the torch was sawing through the metal the way it was going up and down. It's alway more fun when you can laugh at your mistakes.
While it's only the simple case of cutting a circle, it does seem to work. The one problem I've noticed is that Mach was seeing the torch down signal, but didn't appear to be going down past the programmed height for the "touch and go". On the plus side, that probably kept the torch from diving.
I used a THC post processor in Sheetcam, but I think I probaly have a configuration issue with Sheetcam or Mach. That's a problem for another day.
The adventure continues with more work on the hardware and software.......
Did make your own THC post processor, or did you find one online? That's pretty cool that you have got it working. If you have it cutting 1" circles and they look good, then I would say it's pretty close!
You should post some pics of the circles.
From my experience it seems that the problems I have encountered (so far), it was because sheet cam was not configured properly.
I'm just trying to debug the THC, so I used the "MP 1000-THC" post processor. It used the touch and go, but it just didn't seem to go lower than the set cut height. I'm pretty sure it's the post processor or g-code or Mach. The circles aren't any better than the ones I cut without the THC because it just stayed at the same min height - which was too high.
I've just done an ascii capture of the voltages to look at the variability and my filtering. I want to do a couple more captures to get a better data set. But, I was waiting 500 ms. after "arc good" to start control but based on the one set of sample voltages, it takes until about 600 ms after "arc good" for the voltage to stabilize.
It also looks like my software filter is way too slow. I time I'm averaging over 25 samples (with a sample about every 7 ms). That's way too long. Based on that data, I think a three or four sample average should be good.
do you have the THC enabled in MACH3? I would think its similar MACH3 setup as the one I use http://www.ebay.com/itm/Proffessiona...item27ccdd2789
Although when I checked max cl mode, mine went nuts!!!!
You will need to give it room to work in, so the minimum height needs to be lower than the expected cutting height. Also be sure if you are using soft limits, that they will also allow the motion you need. I can understand not wanting the torch to slam into the work while you are debugging, but if the THC is going to work it has to have the room to do so. How flat is your test metal, and how well aligned to the X and Y axis? If you know the area you are cutting in is flat, and aligned, you can set your soft limit to around .010" off the plate and know that your torch won't hit it. If that passes then, you could shim up your plate to a slight angle and confirm that the torch can follow it. You could also run with the torch off, and feed your device with a variable power supply to confirm that it behaves as desired.
I do have the THC enabled in Mach. I have the option to follow the torch moves without THC on. All the THC option does is stop the system if the arc is lost.
I looked at the setting link you gave, thanks. I'm good with all the settings. I don't have the MaxNC mode set, that appears to be for mills. I do want to jump on the sheet cam support boards to see what I can learn.
Ram - I still have a lot to learn about.... Am I right in assuming that the soft limits you refer to are in Mach? I didn't expressly set any.
Is it safe to assume that Mach will never allow the THC to drive the torch lower than programmed in G-code? (That seems to be what I'm seeing.) If that's the case, how do you deal with the time it takes the voltage to stabilize after the pierce? (It looks like it takes about 800 or 900 ms. for the torch voltage to "stabilize" after I get the "arc good" signal.) It seems like if you set the cut height too low, you could strike before the THC cuts in.
Well, I think I figured it out. Its so obvious its embarassing.
On the mach screen there are DRO's for THC MAX and THC Min. Min is set to .2
I've been so busy watching the torch, oscilliscope and the THC display, I've never really paid attention to the Mach screen. I'll give it a try tomorrow.
One of the problems I've been having is that the LCD display blurs if values are changing quickly.
I haven't had a chance to put in opto-isolators for the serial port yet. But, I really wanted to get some data out of the THC based on what it was seeing. I realized that if I used a laptop running on a battery, I wouldn't have to worry about ground loops. So, I connected a TTL to USB adapter I got on ebay. I did a cut and captured the voltages. The graph below shows a plot of those values for a cut of of 1" circle.
Attachment 8492
The blue line is the raw voltage as red from the A/D. It is in counts (it's a 10 bit A/D, so it ranges from 0 to 1023). The red trace is the value after software filtering.
I started capturing voltages when the torch on signal went active. I put a 0 value in when the software had waited 500 ms. after the "arc good" signal went active. The 500 ms. delay doesn't seem like long enough to wait before starting height control.
Using the 500 ms period as a reference, it works out to an average of a sample about every 7 ms.
The software was running pretty slow (I think due to the slower than normal serial library I was using). I expect I can easly ramp the sample rate up higher, though it seems to be doing pretty good at the current rate.
You can tell that the software averaging is too slow. I was doing a sliding window average over 25 samples, so that ends up being a 175 ms average. The voltage is clean enough that I can do a much shorter running average (maybe 3 samples or about 20 ms?).
The op amp filter circuit is filtering well, but I ran a circuit simulation and found that some of the wierd behavior I'm seeing is actually how the circuit works (at 0 V in you get about 1.3 V out and the output won't go higher than 3.7 volts). So, I'm just going to need to play with the voltage divider more to get the cutting voltage in the middle of the op amp's range.
I had taken a class on LTSpice (analog circuit simulator) and it helped me figure out parts of the voltage circuit I didn't understand. It turns out that the 100K resistor on each side of the torch voltage coming out of the CNC adapter reduce a signal in the 110 V range down to the 60 V range. I had though I was cutting at a much lower voltage than is normal, I now know its due to the CNC port resistors.
I'm going to have to write a single post on all the details of the CNC port when I'm done. I've learned a lot of things that I've never seen documented in one place.
Sounds good. Mach will not let the torch go below the soft limits set in the machine setup. The g-code is not really checked for any other limitations and if you tell it to slam into the part and have no soft limits set, it will go ahead and do that. This is because there are a bunch of ways you can offset the positions, so even the DRO will not be telling you the real position. There are the machine coordinates, and the part coordinates and Mach allows a bunch of other offsets for doing multiple parts or fixture offsets. The soft limits look at the actual machine positions and will trigger an e-stop if you hit them. It is a good practice to set them up as a safety. You can also have hard limit switches, but they only tend to protect X and Y. Safe Z min height is too variable to set with a hardware switch, because it will be different for each thickness of material. At least with a plasma you don't usually have to worry about vices and fixtures. There is a macro in mach that will do the touch off from the plate to set the Z offset and you can have that set as a soft limit at the same time. It would be nice to see that voltage graph with the Z axis position on it as well. I don't understand the time scale, is the 0 at 73 really at 500ms? How long is the entire trace?
Since this isn't yet tied into the PC and Mach, I can't get the Z-axis.
The X axis is the sample number. I think that the 73rd sample was at 500 ms, so I just divided 500 by 73 to get an average 7 ms. sample time. (Now, I'm not sure if that is exactly right, but I have some newer, better captures to analyze.
I now have the voltage control loop working. It is issuing up and down commands (sometimes). I have a bug somewhere to look into - at one point the data dump says a torch up was requested, but I'm not sure that it was actually signalled to Mach.
This trace is cutting a 1" circle and has an arc-ed lead-in and arc-ed lead-out. The X-axis on the chart shows the sample number. I've labeled the key points with their name and time. The Y axis is volts in analog counts (not volts).
Attachment 8510
(Sorry for the bad image, I couldn't get a higher res image to upload.)
I'm not sure I understand why the voltage goes up and down as it does after the "Arc Good" signal. I'm guessing that "Arc Good" must come on when the pilot arc ignites so that Mach will start the pierce. But, it that's the case, would the pierce cause it to drop then rise like that?
The interesting thing is at the end. You can see where the torch crossed the kerf from the start of the cut. At 50 ipm the width of the kerf takes about 116 ms. to cross. That means it should be easy to implement "anti-dive" by looking for steep slopes on the voltage changes.
I just noticed that SheetCAM can do wiggle piercing as well, so you might want to make sure that all that will work as well.
I don't have a way to tie where the torch is at and what it's doing to the voltage capture. That makes it a little harder to figure things out. But, I would think that you wouldn't want to try to do control during the pierce anyway, so wiggle piercing shouldn't make a difference. I don't know for sure, just trying to reason through it.