Author Topic: measure current with Hall effect Current Sensor  (Read 890 times)

0 Members and 1 Guest are viewing this topic.

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
measure current with Hall effect Current Sensor
« on: October 13, 2018, 03:33:23 pm »
Hi All,
i am trying to measure an AC current from Microwave transformer (which is rewound to be used a spot welder) at the secondary. With a bulb in series at the primary i get current reading of 19A.

How do i measure it with a Hall effect current sensor (http://www.tamuracorp.com/clientuploads/pdfs/engineeringdocs/L06PXXXS05.pdf).

I get 1.46A in the serial monitor with the below code.
Code: [Select]
const int TRIAC = A1;
const int VIN = A7;
float voltage;
byte cal = 0;
unsigned int maxReading = 0;
unsigned int minReading = 1023;
unsigned int reading = 0;

void setup()
{
  Serial.begin(115200);
  pinMode(TRIAC, OUTPUT);
  //pinMode(Isense, INPUT_PULLUP);
}

void loop()
{
  if (cal == 0)
  { cal = 1;
    digitalWrite(TRIAC, HIGH);
    reading = analogRead(A2);
    Serial.println("Calibrating.....");
    while (millis() < 1000)
    {
      voltage = analogRead (VIN);
    }
    digitalWrite(TRIAC, LOW);
    float current = (voltage / 1024.0) * 5.0;
    Serial.print("Current: ");
    Serial.print(current,2);
    Serial.println("A");
  }
}
 

Offline duak

  • Super Contributor
  • ***
  • Posts: 1048
  • Country: ca
Re: measure current with Hall effect Current Sensor
« Reply #1 on: October 13, 2018, 05:20:01 pm »
A description or sketch of the circuit would be useful.

The current sensor will produce an AC waveform centered around half its power supply voltage.  Do you have an AC-DC converter to convert the AC output of the current sensor to DC for the A/D converter?

The code looks like it will print the last sample at the end of a one second period.  I think I see a number of other problems in the code, however, I don't know enough about the various definitions to say for sure.

Cheers,
 
The following users thanked this post: anishkgt

Offline anishkgtTopic starter

  • Frequent Contributor
  • **
  • Posts: 769
  • Country: qa
    • George Hobby
Re: measure current with Hall effect Current Sensor
« Reply #2 on: October 13, 2018, 07:43:55 pm »
Code: [Select]
void loop()
{
  if (cal == 0)
  {
    int counter = 0;
    cal = 1;
    digitalWrite(TRIAC, HIGH);
    int i;
    for (i = 0; i <= 10; i++)
    {
      int Vin = analogRead (VIN);
      voltage = Vin;
      voltage += Vin;
      //Serial.print(i);
      //Serial.print(" ");
      Serial.println(voltage);
    }
    digitalWrite(TRIAC, LOW);
  }
}

Here is the revised code. I was hoping with this sensor i could straight away get voltage reading corresponding the ac current. What more would i need to get a current reading ?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf