Hypersensing questions
- snowgoer540
 - 
				
									Topic Author
											 - Offline
 - Moderator
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 2498
 - Thank you received: 835
 
			
	
						16 Aug 2020 01:51				#178344
		by snowgoer540
	
	
		
			
				
Ok I’ll step through it with him next time he’s at the shop. It may be that the threshold needs lowered a bit. Thanks Rod, good luck with the delivery!
					
	
			
			 		
													
	
				Replied by snowgoer540 on topic Hypersensing questions			
			I've got a mess in my workshop pending delivery of a press brake tomorrow so I can't get to the plasma to check for a couple of days.
The main thing would be the threshold, is there power to the circuit (light on on power supply) and that you can see the voltage in halshow changing from 0-24 or so volts
Ok I’ll step through it with him next time he’s at the shop. It may be that the threshold needs lowered a bit. Thanks Rod, good luck with the delivery!
Please Log in or Create an account to join the conversation.
- bevins
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 1940
 - Thank you received: 338
 
			
	
						17 Mar 2021 18:24				#202614
		by bevins
	
	
		
			
				
Is there docs on this? I've read the whole thread and I am more confused than before reading it.
I think I have the wiring of it setup but making it work in LCNC will prove to be difficult unless I can read some docs somewhere.
					
	
			
			 		
													
	
				Replied by bevins on topic Hypersensing questions			
			
I've got a mess in my workshop pending delivery of a press brake tomorrow so I can't get to the plasma to check for a couple of days.
The main thing would be the threshold, is there power to the circuit (light on on power supply) and that you can see the voltage in halshow changing from 0-24 or so volts
Ok I’ll step through it with him next time he’s at the shop. It may be that the threshold needs lowered a bit. Thanks Rod, good luck with the delivery!
Is there docs on this? I've read the whole thread and I am more confused than before reading it.
I think I have the wiring of it setup but making it work in LCNC will prove to be difficult unless I can read some docs somewhere.
Please Log in or Create an account to join the conversation.
- rodw
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 11472
 - Thank you received: 3848
 
			
	
						17 Mar 2021 20:35				#202638
		by rodw
	
	
		
			
	
	
			 		
													
	
				Replied by rodw on topic Hypersensing questions			
			
				Use the circuit with the 24k resistor shown
Use ohmic3.comp here
forum.linuxcnc.org/plasmac/38848-hyperse...ons?start=210#175839
Create a new hal file and edit your ini file so it is loaded that contains
Once installed, man ohmic3 should give you some docs. You will need to edit the volt-divider pin if you are using a THCAD-10. I chose the 390K resistor to give a 24.5 volt full scale with a THCAD-5 (per the formula in the THCAD manual). I wanted to make sure the THCAD could see a bit past 24 volts.
You may need to spin up halscope to review your thresholds of a wet torch and edit these thresholds to suit.Ohmic3 does not really use the low threshold as once the voltage starts to fall, it will trigger so it may sense an ohmic off signal above the low threshold
WARNING: Plasmac now uses motion.motion-type so some changes may be required on this signal.. eg. To use Plasmac's pin..
Output-11 is the pin that enables the 240V relay. I think I have mine disconnected...
					Use ohmic3.comp here
forum.linuxcnc.org/plasmac/38848-hyperse...ons?start=210#175839
Create a new hal file and edit your ini file so it is loaded that contains
loadrt ohmic3 names=ohmicsense
addf ohmicsense servo-thread
 
setp ohmicsense.thcad-0-volt-freq    140200
setp ohmicsense.thcad-max-volt-freq  988300
setp ohmicsense.thcad-divide         32
setp ohmicsense.thcad-fullscale      5
setp ohmicsense.volt-divider         4.9
setp ohmicsense.ohmic-threshold      22
setp ohmicsense.ohmic-low            21.5
setp ohmicsense.mode                 1 
setp ohmicsense.num-readings         10
net ohmic-vel ohmicsense.velocity-in <= hm2_7i76e.0.encoder.02.velocity
unlinkp debounce.0.2.in
net ohmic-true ohmicsense.ohmic-on => debounce.0.2.in
net plasmac:ohmic-enable  plasmac.ohmic-enable
net plasmac:ohmic-enable           =>  ohmicsense.is-probing
#net plasmac:ohmic-enable        plasmac.ohmic-enable             =>  hm2_7i76e.0.7i76.0.0.output-11
net ohmic:type  <= motion.motion-type
net ohmic:type  => ohmicsense.motion-type-in
net ohmic:power <= ohmicsense.power-on
net ohmic:power => hm2_7i76e.0.7i76.0.0.output-11Once installed, man ohmic3 should give you some docs. You will need to edit the volt-divider pin if you are using a THCAD-10. I chose the 390K resistor to give a 24.5 volt full scale with a THCAD-5 (per the formula in the THCAD manual). I wanted to make sure the THCAD could see a bit past 24 volts.
You may need to spin up halscope to review your thresholds of a wet torch and edit these thresholds to suit.
setp ohmicsense.ohmic-threshold      22
setp ohmicsense.ohmic-low            21.5WARNING: Plasmac now uses motion.motion-type so some changes may be required on this signal.. eg. To use Plasmac's pin..
Output-11 is the pin that enables the 240V relay. I think I have mine disconnected...
		The following user(s) said Thank You: bevins 	
			Please Log in or Create an account to join the conversation.
- bevins
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 1940
 - Thank you received: 338
 
			
	
						18 Mar 2021 10:54		 -  18 Mar 2021 11:04		#202722
		by bevins
	
	
		
			
	
	
	
			 		
													
	
				Replied by bevins on topic Hypersensing questions			
			
				Thankls, I'll see if I can get all this setup.
I though comps were suppose to be compiled.
This is the comp?
	
		
			
		
		
			
							
		
	
So if using a thcad-10 then use a 24K resistor instead of the 390K you used as shown in the attached pdf?
					I though comps were suppose to be compiled.
This is the comp?
			Warning: Spoiler!		
		component ohmic3 "LinuxCNC HAL component that uses a Mes THCAD for Ohmic sensing";
description
"""
Mesa THCAD Card component to scale input and outputs from the Mesa THCAD5, THCAD10 and THCAD300 cards.
Which is designed to allow user configurable voltage threshold for ohmic sensing.
Scaling of the Plasma arc voltage by a voltage divider is supported.
.br
Output pins are provided for:
.br
ohmic-volts (the voltage sensed on ohmic sensing)
.br
ohmic-on (true if ohmic-volts >= ohmic-threshold)
.br
arc-on (true if arc voltage is received eg. full scale reached or exceeded)
.br
Actual voltage as read from the THCAD card (0-300V, 0-10V or 0-5V depending on the THCAD version used.
.br
Normally, we would use a THCAD-5 for ohmic sensing in conjunction with a 24 volt isolated power supply and a 390K resistor.
This would result in a full scale reading of 24.5 volts which is above the power supply output voltage.
So if full scale is reached, it can be assumed that the THCAD-5 is sensing an arc voltage.
In this case, the circuit will remain protected by the THCAD's ability to tolerate a 500V overvoltage indefinitely.
It is recommended that power to the Ohmic sensing circuit be disconnected unless probing is in progress to prevent corrosion in consmables where a water table is in use.
.br
\\fBEXAMPLE:\\fR
.br
THCAD5 card using a 1/32 frequency setting and a voltage divider internal to the plasma cutter with range extended
to 24.5 volts with a 390K external resistor as per the manual. Additional information and wiring diagram is contained in the Plasma Primer in hte main Linuxcnc documents.
.br
 
.br
loadrt ohmic names=ohmicsense
.br
addf ohmicsense servo-thread
.br
.br
setp ohmicsense.thcad-0-volt-freq    122900
.br
setp ohmicsense.thcad-max-volt-freq  925700
.br
setp ohmicsense.thcad-divide         32
.br
setp ohmicsense.thcad-fullscale      5
.br
setp ohmicsense.volt-divider         32
.br
setp ohmicsense.threshold            18
.br
setp ohmicsense.ohmic-low            5
.br
net ohmic-vel ohmicsense.velocity-in <= hm2_7i76e.0.encoder.00.velocity
.br
net ohmic-true ohmicsense.ohmic-on => plasmac.ohmic-probe
""";
author "Rod Webster";
// Example Calibration Data: 0v = 122.9 kHz, 10v = 925.7 Khz should be entered as 122900 and 925700
pin in  float thcad_0_volt_freq          "0 volt calibration data for THCAD card in Hz";
pin in  float thcad_max_volt_freq        "Full scale calibration data for THCAD Card in Hz";
pin in  float thcad_divide = 32          "THCAD Divider set by links on THCAD board (1,32,64 or 128";
pin in  float thcad_fullscale = 5        "THCAD Fullscale (5, 10 or 300)";
pin in  float velocity_in                "The velocity returned from the THCAD and read by the Mesa encoder input";
pin in  float volt_divider = 4.9         "The divide ratio (default 1:1)";
pin in  float ohmic_threshold = 18       "The threshold  volts above which Ohmic sensing is set to be true";
pin in  float ohmic_low = 5              "The threshold  volts below which Ohmic sensing is set to be false";
pin out  bit arc_on                      "True if full scale (eg arc is on)";
pin out float thcad_volts                "Measured thcad voltage";
pin out float ohmic_volts                "Calculated Ohmic  voltage";
pin out bit   ohmic_on                   "Threshold plasma torch voltage";
pin in  bit  is_probing                  "True if probing";
pin in  s32 motion_type_in               "Connect motion.motion-type here";
pin out bit power_on                     "Turn relay on with this pin";
pin in  s32 mode = 0                      "0 = use low threshold, 1 = use trend";
pin in  s32 num_readings = 5              "number of servo cycles to stay on trend";
pin out float dbg_avgv                   "average arc volts";
function _;
license "GPL";
;;
#include <rtapi_math.h>
#define BUFSIZE 1000 // maximum number of readings to average torch volts
float avgarcvolts(double tvolts, int iscutting, int buffersize);
static int cycles = 0;
double buf[BUFSIZE];
int reading_count;
float avgarcvolts(double tvolts, int iscutting, int buffersize)
{
	// Calculates the moving average of buffersize readings
	
	static double *b = &buf[0], *p = &buf[0];		// pointers for beginning of buffer and current position
	static double *e;   // pointer for end of buffer
	static int   wascutting = 0;		// cutting state last time
    static double sumvolts = 0.0;		// Sum of readings in buffer
    static int numreadings = 0;			// number of readings in buffer
    e =  &buf[buffersize];              // Initialise end pointer
	if(!iscutting && wascutting){
		// Torch just turned off, so reset the variables
		p = b;
		sumvolts = 0.0;
		numreadings = 0;
		wascutting = iscutting; 		//and save the state
		return(0.0);
	}
	if(iscutting){						// Arc_OK is on so lets start gathering data to average
		*p++ = tvolts;					// Save volts to the buffer and increment pointer
		if(numreadings < buffersize)
			numreadings++;
		if(p > e)						// if we've gone past the end of the buffer, wrap to the beginning
			p = b;
		sumvolts += tvolts;				// add the new reading
		if(numreadings >= buffersize)
			sumvolts -= *p;				// subtract the oldest reading (which is the one we are pointing at now)
	}
	wascutting = iscutting; 			//and save the state
	if(numreadings)					
		return(sumvolts/(double)numreadings);  // return Average volts
	else
		return (0.0);					// catch divide by zero errors
}
FUNCTION(_) {
      double thcad_vel_scale = 1/((thcad_max_volt_freq - thcad_0_volt_freq)/thcad_fullscale/thcad_divide);
      double thcad_scale_offset = thcad_0_volt_freq/thcad_divide;
      double avgvolts = 0.0;		// average volts
      thcad_volts = (velocity_in - thcad_scale_offset) * thcad_vel_scale;
      ohmic_volts = thcad_volts * volt_divider; // Calculated torch volts from THCAD
      static int first_pass = 0;
      
   	  if(num_readings > 1000)	    //enforce number of readings limits
        reading_count = 1000;
      else 
        if(num_readings < 3)
          reading_count = 3;
      else
        reading_count = num_readings;
      if(is_probing){
        if(!first_pass){
                first_pass = 1;
                if(! power_on)
                    power_on = 1;
        }
      }
      power_on = !motion_type_in ? 0 : 1;
      avgvolts =	avgarcvolts(ohmic_volts, (int)1, (int)reading_count);
      
      switch(mode){
        case 0:
          if(is_probing)
            ohmic_on    = (ohmic_volts >  (ohmic_threshold && is_probing) ? 1 : 0);
          else 
            if( ohmic_volts < ohmic_low)
                ohmic_on = 0;
          break;
        case 1:
          if(is_probing){
            dbg_avgv = avgvolts;
            if(!ohmic_on){
              if(ohmic_volts > ohmic_threshold){
                ohmic_on = 1;
              }
            }
            else{
              if(avgvolts < ohmic_threshold || ohmic_volts < ohmic_low){
                ohmic_on = 0;
                first_pass = 0;
              }              
            }
          }          
          else{
            ohmic_on = 0;
          }
          break;
        default:
          // Report error invalid mode
          break;
      }      
      arc_on      = (thcad_volts >= thcad_fullscale ? 1 : 0);
      if(!is_probing)
        first_pass = 0;
}So if using a thcad-10 then use a 24K resistor instead of the 390K you used as shown in the attached pdf?
		Last edit: 18 Mar 2021 11:04  by bevins.			
			Please Log in or Create an account to join the conversation.
- rodw
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 11472
 - Thank you received: 3848
 
			
	
						18 Mar 2021 11:44				#202725
		by rodw
	
	
		
			
	
	
		
			
			 		
													
	
				Replied by rodw on topic Hypersensing questions			
			
					Attachments:
Please Log in or Create an account to join the conversation.
- rodw
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 11472
 - Thank you received: 3848
 
			
	
						18 Mar 2021 11:51				#202727
		by rodw
	
	
		
			
	
			
			 		
													
	
				Replied by rodw on topic Hypersensing questions			
			
				By my calculations, a 147k resistor will give a 24.7 volt full scale which would work well instead of 390k			
					Please Log in or Create an account to join the conversation.
- bevins
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 1940
 - Thank you received: 338
 
			
	
						18 Mar 2021 12:11				#202729
		by bevins
	
	
		
			
				
OK noted. Where do I put this comp file and how to reference it?
					
	
			
			 		
													
	
				Replied by bevins on topic Hypersensing questions			
			By my calculations, a 147k resistor will give a 24.7 volt full scale which would work well instead of 390k
OK noted. Where do I put this comp file and how to reference it?
Please Log in or Create an account to join the conversation.
- rodw
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 11472
 - Thank you received: 3848
 
			
	
						18 Mar 2021 12:23				#202731
		by rodw
	
	
		
			
	
			
			 		
													
	
				Replied by rodw on topic Hypersensing questions			
			
				(sudo) halcompile --install ohmic3.comp
Then include the provided hal file in my spoiler which unlinks anything required except motion-status as mentioned
sudo is not required for a rip build
					Then include the provided hal file in my spoiler which unlinks anything required except motion-status as mentioned
sudo is not required for a rip build
Please Log in or Create an account to join the conversation.
- bevins
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 1940
 - Thank you received: 338
 
			
	
						18 Mar 2021 12:44				#202734
		by bevins
	
	
		
			
				
OK but is that file going to compile with all those .br in there? and uncommented comments?
					
	
			
			 		
													
	
				Replied by bevins on topic Hypersensing questions			
			(sudo) halcompile --install ohmic3.comp
Then include the provided hal file in my spoiler which unlinks anything required except motion-status as mentioned
sudo is not required for a rip build
OK but is that file going to compile with all those .br in there? and uncommented comments?
Please Log in or Create an account to join the conversation.
- rodw
 - 
				
											 - Offline
 - Platinum Member
 - 
				
			 
		Less
		More
		
			
	
		- Posts: 11472
 - Thank you received: 3848
 
			
	
						18 Mar 2021 12:52				#202736
		by rodw
	
	
		
			
	
			
			 		
													
	
				Replied by rodw on topic Hypersensing questions			
			
				Try it, it worked for everybody else. I gave you a link to the file to download
There is a lot of documentation in there for the man page that requires other halcompile switches.
					There is a lot of documentation in there for the man page that requires other halcompile switches.
Please Log in or Create an account to join the conversation.
		Moderators: snowgoer540	
		Time to create page: 0.156 seconds