Go Down

Topic: How to steady voltage measurement. (Read 553 times) previous topic - next topic

Seedler

A lot different then my thinking. You might consider using a co-axial cable to send the data from the resistor divider network. If only one side of the coax cable was grounded the cable would act like a large filter capacitor dampening out transients running along the center conductor, which would be where your sampling voltage would be.

If the machine has an actual earth ground and the earth ground is connected to the circuit ground of the machine, that's where I'd tie the outer conductor of the coaxial cable. The 2nd option would be to use the circuit ground of the machine. The last and least favorite option, is to tie the coaxial outher connection to the Arduino.

On the machine side, make the connection to the voltage divider, as short as possible, exposing the least amount of unshielded wire to the envronment. You may need to have a long outer braided wire of the coax to reach a ground connection; that's OK. You can wrap the braided wire with electrical tape or heat shrink. If you can, in the machine, secure the coaxial cable, as close as possible to the connection with the divider, so that is does not move around.

And that's what I'd do first with the situation as your've described.





On my divider the Positive wire is taken from the positive side of the divider, and the negative wire is taken from the center of the divider.  Which wire would I connect to the center core of the coax?  I need to take a negative to the Arduino as well in order to get a reading.  How do I do this if the shielding of coax is only connected to plasma cutter earth or ground?

Above my pay-grade but seems to me you should be able to filter the signal in hardware along the same lines that a rectified AC circuit filters out the sine wave when turning AC into DC - or the capacitors used in a DC power supply to take out the ripple. 
Are you suggesting a lowpass filter as well?

Thanks.

Idahowalker

If the coaxial cable does not work to satisfaction then active filtering could be employed.

Using two amplifiers with unity gain (1). Amplifier A would be a non-inverting non DC blocking amplifier. Amplifier B would be a DC blocking inverting amplifier. Tie the output of Amplifier A to Amplifier B where the inverted AC signal will be met by the non-inverted AC signal and cancel each other out, leaving a 'clean' DC signal for the A:D converter to process.

Idahowalker

On my divider the Positive wire is taken from the positive side of the divider, and the negative wire is taken from the center of the divider.  Which wire would I connect to the center core of the coax?  I need to take a negative to the Arduino as well in order to get a reading.  How do I do this if the shielding of coax is only connected to plasma cutter earth or ground?
A yes, the machines reference wire, you can bring that in wrapped, in a long spiral coil, around the coaial cable.

TomGeorge

Hi,
Thanks for the pics, but can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Tom.... :)
Everything runs on smoke, let the smoke out, it stops running....

Seedler

A yes, the machines reference wire, you can bring that in wrapped, in a long spiral coil, around the coaial cable.

You've lost me there :)

Hi,
Thanks for the pics, but can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Tom.... :)
I'll try and get a diagram drawn up tomorrow.

Idahowalker

You've lost me there :)
Well, you write -V which could imply a negative voltage; such as a +5V and a -5V. If a -5V was applied to a Arduino as ground reference and some voltage above 0V, say a +1V, was applied as an analog input that would exceed the safe operating range of the Arduino Analog input (5 Volt unit) pin. So, I reasoned that you'd not supply a -V to the Arduino to use as a Common Voltage Reference or 0 Volts and, therefor, you, should, mean Circuit Common from the machine.


+5V
0V
-5V


0V and -V are different things and to supply a negative voltage (-V) to an Adruino5 Volt unit as a common reference,  is a different conversation.

Seedler

Hi,
Thanks for the pics, but can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Tom.... :)
Sorry about the mess, but I think that's it all

Seedler

Between plasma cutter and Arduino is a few metres of wire

wolframore

Seedler, DMM are usually averaging voltage.  The output of plasma cutter is anything but steady DC voltage. 

If you do need some sort of RMS DC value then you need to take averages as suggested before or create a filter system that will allow a smooth reading.  I don't quite understand what you need exactly.

Your plasma arc voltage is different based on thickness, strike and the mode it's in.  What you're experiencing is likely in the strike mode where it needs to establish an arc.

if you rectified the reading and steadied it with caps you could get a version of average voltage out... Doe that help?
Bad boys rate our young girls but Violet goes willingly :)
- this is a mnemonic from BEC

TomGeorge

#24
Nov 09, 2018, 11:48 pm Last Edit: Nov 09, 2018, 11:56 pm by TomGeorge
Hi,
Ops cicuit;


What do you mean by,  "Clamp Coil" and "Torch Coil"?

How have you got the potential divider connected to the torch and clamp?

Thanks.. Tom... :)
Everything runs on smoke, let the smoke out, it stops running....

Seedler

Seedler, DMM are usually averaging voltage.  The output of plasma cutter is anything but steady DC voltage. 

If you do need some sort of RMS DC value then you need to take averages as suggested before or create a filter system that will allow a smooth reading.  I don't quite understand what you need exactly.

Your plasma arc voltage is different based on thickness, strike and the mode it's in.  What you're experiencing is likely in the strike mode where it needs to establish an arc.

if you rectified the reading and steadied it with caps you could get a version of average voltage out... Doe that help?
Thing is, the voltage is all over the place before I even switch plasma cutter on.  I will definitely employ some sort of running average to code.  Can you recommend a filter setup?

What do you mean by,  "Clamp Coil" and "Torch Coil"?

How have you got the potential divider connected to the torch and clamp?

Thanks.. Tom... :)
Look at the pictures I attached earlier.  I should have said transformers.  The divider is connected before the high frequency circuitry.


Seedler

Ok I added a smoothing sketch to my code, and an RC low pass filter between my divider and analog pin.

Code:
Code: [Select]
#include <TM1637Display.h>
#include <EEPROM.h>

const int CLK = 2; //Set the CLK pin connection to the display
const int DIO = 3; //Set the DIO pin connection to the display

TM1637Display display(CLK, DIO);  //set up the 4-Digit Display.

const int numReadings = 10;
int analog_value[numReadings];  // the readings from the analog input
int readIndex = 0;              // the index of the current reading
int total = 0;                  // the running total
int average = 0;                // the average

float input_voltage = 0.0;
float temp = 0.0;
float r1 = 99900.0;
float r2 = 1980.0;
float setVoltage = 102.0;

int eeAddress = 0;

int Enable = 7;
int STEP = 8;
int dir = 9;

int relay1 = 4;
int relay2 = 5;
int relay3 = 6;

int mainSwitch = 13;
int Up = 10;
int Down = 11;

bool startDelay = false;

void setup() {
  Serial.begin(9600);

  // initialize all the readings to 0:
  for (int thisReading = 0; thisReading < numReadings; thisReading++) {
    analog_value[thisReading] = 0;
  }
 
  display.setBrightness(0x0a);  //set the diplay to maximum brightness
  analogReference(EXTERNAL); // use AREF for reference voltage

  pinMode(mainSwitch, INPUT);
  pinMode(Up, INPUT);
  pinMode(Down, INPUT);

  digitalWrite(relay1, LOW);
  digitalWrite(relay2, LOW);
  digitalWrite(relay3, LOW);
  pinMode(relay1, OUTPUT);
  pinMode(relay2, OUTPUT);
  pinMode(relay3, OUTPUT);
 
  pinMode(Enable, OUTPUT);
  pinMode(STEP, OUTPUT);
  pinMode(dir, OUTPUT);
  digitalWrite(Enable, HIGH);
  digitalWrite(STEP, LOW);
  digitalWrite(dir, LOW);

  EEPROM.get(eeAddress, setVoltage);
}

void loop() {
  // subtract the last reading:
  total = total - analog_value[readIndex];
  // read from the sensor:
  analog_value[readIndex] = analogRead(A0);
  delay(10);
  // add the reading to the total:
  total = total + analog_value[readIndex];
  // advance to the next position in the array:
  readIndex = readIndex + 1;

  // if we're at the end of the array...
  if (readIndex >= numReadings) {
    // ...wrap around to the beginning:
    readIndex = 0;
  }
  // calculate the average:
  average = total / numReadings;
 
  temp = (average * 4.06) / 1024.0;
  input_voltage = temp / (r2/(r1+r2));
 
  Serial.print("v= ");
  Serial.println(input_voltage);
 
  display.showNumberDec(input_voltage);

  if(digitalRead(Up) == LOW){
    setVoltage++;
    EEPROM.put(eeAddress, setVoltage);
    display.showNumberDec(setVoltage);
    delay(1000);
  }

  if(digitalRead(Down) == LOW){
    setVoltage--;
    EEPROM.put(eeAddress, setVoltage);
    display.showNumberDec(setVoltage);
    delay(1000);
  }

  if(digitalRead(mainSwitch) == LOW){
    if(input_voltage >= 90 && input_voltage <=120){
      Serial.println("ARC OK");
      if(startDelay == false){
        delay(1500);
        startDelay = true;
      }
      digitalWrite(relay1, HIGH);
      digitalWrite(relay2, HIGH);
      digitalWrite(relay3, HIGH);
      digitalWrite(Enable, LOW);
      if(input_voltage <= setVoltage - 1){
        digitalWrite(dir, HIGH);
        Serial.println("Up");
        for(int i=0;i<200;i++){
          digitalWrite(STEP, HIGH);
          delayMicroseconds(100);
          digitalWrite(STEP, LOW);
          delayMicroseconds(100);
        }
      }
      else if(input_voltage >= setVoltage + 1){
        digitalWrite(dir, LOW);
        Serial.println("Down");
        for(int i=0;i<200;i++){
          digitalWrite(STEP, HIGH);
          delayMicroseconds(100);
          digitalWrite(STEP, LOW);
          delayMicroseconds(100);
        }
      }
    }
    else{
      Serial.println("Arc bad");
      digitalWrite(Enable, HIGH);
      digitalWrite(relay1, LOW);
      digitalWrite(relay2, LOW);
      digitalWrite(relay3, LOW);
      startDelay = false;
    }
  }
  else{
      digitalWrite(relay1, LOW);
      digitalWrite(relay2, LOW);
      digitalWrite(relay3, LOW);
      startDelay = false;
  }
}


I now seem to be getting a steady reading in the range I was expecting.  I believe this was mainly as a result of the low pass filter.

The program seems to crash if I take more than 10 samples of the smoothing code.  Any ideas?  Plus it takes a second or two for the voltage to ramp up from zero to 102v with the smoothing code.  Any way to make this happen faster?

z axis is going the wrong direction.  That will be easily fixed :).  May have to speed its movement up too.

The biggest problem I've seen though is that every other attempt the Arduino cnc controller crashes at plasma startup. I know this is a concern with plasma cutters, but it has never crashed on me before while cutting.  Even with the long wire run from my plasma divider to thc controller, it worked fine and never crashed.  The only difference now is the low pass filter.  What issues would it cause?


Despite these problems, it was operating the z axis and trying to steady its height.  I believe this will work if I can iron these faults out.

Thanks.

MorganS

Quote
delay(1500);
Think about what is happening here. You seem to have this delay so that the arc can settle for 1.5 seconds before beginning to control it. But your 10 measurements are now 1.5 seconds old. You then move the stepper based on that old average.

You need to keep looping. If there is a condition of "arc good" then also record the time at which that first became true. Some time after that you may set a new condition of "control active" or whatever. But keep loop() going and keep taking regular measurements for the averager.
"The problem is in the code you didn't post."

Seedler

Think about what is happening here. You seem to have this delay so that the arc can settle for 1.5 seconds before beginning to control it. But your 10 measurements are now 1.5 seconds old. You then move the stepper based on that old average.

You need to keep looping. If there is a condition of "arc good" then also record the time at which that first became true. Some time after that you may set a new condition of "control active" or whatever. But keep loop() going and keep taking regular measurements for the averager.
This delay only happens once through the loop at start of cut.  Yes it is to allow arc to settle, and to allow cnc controller to make final moves.  I don't think it will have much of an impact on the average voltage, or explain the slow ramp up of the voltage.  I could be wrong though :).  sup[pose a delay using Millis could be used.


Go Up