opensource THC for Plasma , Fiber laser and co2 laser

More
21 Sep 2020 19:42 #183174 by taloot

parport

did u solve the voltage divider issue?
coz divider it self is a big time investment,,, better to buy one,., if u are interested in experimenting ( not cost) then i will give u updated skecth for liner convertion with low freq,, but ur divder is ready? and whats ur mcu ( u can use arduino or stm32 or esp32)
my current code is for esp32
but for now we need to check the the divider reading ( if u have it)

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

More
21 Sep 2020 20:09 - 21 Sep 2020 20:11 #183179 by pinder
i was able to convert plasma voltage to 5v range with direct non isolated voltage divider, and was able to read the value using arduino micro.
futher multiplying divider ratio, I got the plasma voltage.
No fancy divider.

is there any problem with that.

what I am planning is to generate freq output (proportional to input voltage) on digital pin. as thcad board does.
Futher i can safely connect that pin to parport with optocoupler in between.
Does you Esp32 program does the same?
Last edit: 21 Sep 2020 20:11 by pinder.

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

More
22 Sep 2020 12:05 #183286 by pinder

i was able to convert plasma voltage to 5v range with direct non isolated voltage divider, and was able to read the value using arduino micro.
futher multiplying divider ratio, I got the plasma voltage.
No fancy divider.

is there any problem with that.

what I am planning is to generate freq output (proportional to input voltage) on digital pin. as thcad board does.
Futher i can safely connect that pin to parport with optocoupler in between.
Does you Esp32 program does the same?

@taloot any idea?
can you share wiring diagram with a chinese voltage divider and esp32 and parport.

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

More
22 Sep 2020 19:08 #183332 by taloot

i was able to convert plasma voltage to 5v range with direct non isolated voltage divider, and was able to read the value using arduino micro.
futher multiplying divider ratio, I got the plasma voltage.
No fancy divider.

is there any problem with that.

what I am planning is to generate freq output (proportional to input voltage) on digital pin. as thcad board does.
Futher i can safely connect that pin to parport with optocoupler in between.
Does you Esp32 program does the same?

thats good , if u can read it without hanging ,,
yes the code i did do the same what u want
// Arduino RBD Capacitance Library v1.0.5 Example - Continuously print the capacitance value.
// https://github.com/alextaujenis/RBD_Capacitance
// Copyright (c) 2015 Alex Taujenis - MIT License

#include <RBD_Capacitance.h> // https://github.com/alextaujenis/RBD_Capacitance

#include "filters.h"

const int allowed_freq = 5 * 1000 * 1000;

const unsigned long DEFAULT_MIN_FREQ =  1 * 100;
const unsigned long DEFAULT_MAX_FREQ = 30 * 10000;

const unsigned long DEFAULT_MIN_CAPA =  0;
const unsigned long DEFAULT_MAX_CAPA = 250;

unsigned long min_freq = 200000;// = 1.2 * 1000;
unsigned long max_freq = 300000;// =  12 * 1000;

unsigned long min_capa = 196;// =   1 * 1000;
unsigned long max_capa = 205;// =   4 * 1000;
const int pwmpin = 22;

RBD::Capacitance cap_sensor(13, 4); // send, receive pin

const float cutoff_freq   = 100.0;  //Cutoff frequency in Hz
const float sampling_time = 0.00005; //Sampling time in seconds.
IIR::ORDER  order  = IIR::ORDER::OD1; // Order (OD1 to OD4)

// Low-pass filter
Filter f(cutoff_freq, sampling_time, order);

int pwm_ch = 0;
int resolution = 1;

float capa_val;

float capatofreq(float capa_val) {
  float ret_val = 0;
  
  if ( capa_val < min_capa ) {
    ret_val = min_freq;

  } else if ( capa_val > max_capa ) {
    ret_val = max_freq;
  } else {
    ret_val = min_freq + (max_freq - min_freq) / ((float)(max_capa - min_capa)) * (capa_val - min_capa);
  }
  //return ret_val;
  return (float)(max_freq - (ret_val - min_freq));
}

void setup() {
  Serial.begin(115200);
  
  Serial.println("Starting...");
  
  ledcSetup(pwm_ch, min_freq, resolution);
  ledcAttachPin(pwmpin, pwm_ch);

  cap_sensor.setSampleSize(15);

}

void loop() {
  cap_sensor.update();
  if(cap_sensor.onChange()) {
      // code only runs once per event
      capa_val = cap_sensor.getValue();
      Serial.print("capa_val: ");
      Serial.println(capa_val);
      float filteredval = f.filterIn(capa_val);
      capa_val = filteredval;
      int pwm_val = (int)capatofreq(filteredval);    
       
      ledcSetup(pwm_ch, pwm_val, resolution);
      ledcWrite(pwm_ch, 1);
      
      Serial.print("filter_val: ");
      Serial.println(capa_val);
      Serial.print("capa mode pwm_val: ");
      Serial.println(pwm_val);
      
  

  }
}
The following user(s) said Thank You: Clive S, pinder

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

More
22 Sep 2020 19:14 - 22 Sep 2020 19:21 #183334 by taloot
this code is for esp32.. and it uses capacitance as input.. u can change it to analog read pin.


for arduino u need different code coz the esp32 have special library for pwm which is ledc its based on hardware timer ,,
if u have esp32 modify the line here,
int pwm_val = (int)capatofreq(filteredval);

make it analog read
it will be 1024 on arduino 1024 =300v
0 = 0v
u can define min and max value and map it accross the pwm
on esp32 its 4096


for paraport 1khz to 3khz is ok
max i can achieve is 20khz

arduino nano performance is bad for pwm
stm32 fast but complext
esp32 easy for this task
Last edit: 22 Sep 2020 19:21 by taloot.
The following user(s) said Thank You: pinder

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

More
23 Sep 2020 02:07 - 23 Sep 2020 02:10 #183373 by pinder
thankyou @taloot.
I am waiting for my esp32 to arrive.

If anytime you get a spare time, please write a seprate detailed tutorial for plasma with circuit diagram for parport and mesa board.

For a newbie like me sometimes it becomes difficult to understand a simple thing.

Thanks for your work with laser, I hope to work with that sometime.
This THC also makes linuxcnc independent from prorietory hardware.
cheers!
Last edit: 23 Sep 2020 02:10 by pinder.

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

More
14 Dec 2023 08:34 #288114 by jgarcia
For advanced Torch Height Control (THC) functionality, especially for fiber lasers and plasma, I recommend exploring the Monport laser. Monport lasers offer versatile features and compatibility, making them suitable for various applications. Their user-friendly interface and robust performance could be a valuable addition to your setup.

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

Moderators: snowgoer540
Time to create page: 0.371 seconds
Powered by Kunena Forum