Go Down

Topic: WCS1700 Noise problem (Read 360 times) previous topic - next topic

Thanto

Sep 19, 2018, 03:20 pm Last Edit: Sep 19, 2018, 03:21 pm by Thanto
Hi. I have this hall sensor module . How can I reduce noise in this sensor?
when there is no current sometimes the sensor give -0.015 or 0.015.

Code: [Select]

#define wcs1700 A0

float vpp = 0.0048828125;
float sensitivity = 0.032;

void setup() {
  pinMode(wcs1700, INPUT);
  Serial.begin(9600);
  Serial.println("CLEARDATA");
  Serial.println("LABEL,Computer Time,Amps");
}

void loop() {
  int counts = analogRead(wcs1700) - 7;
  float voltage = counts * vpp;
  voltage -= 2.5;
  float amps = voltage / sensitivity;

  Serial.print("DATA,TIME,");
  Serial.println(amps);
  delay(1000);
}
 :o  :o

TomGeorge

Hi,
Welcome to the forum.

Can you post a link to data/spec of the WCS1700 please?

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

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

ReverseEMF

"It's a big galaxy, Mr. Scott"

Please DON'T Private Message to me, what should be part of the Public Conversation -- especially if it's to correct a mistake, or contradict a statement!  Let it ALL hang out!!

Wawa

#3
Sep 20, 2018, 12:08 am Last Edit: Sep 20, 2018, 12:27 am by Wawa
If you measure a 140Amp sensor (+70, -70) with a 10-bit A/D (1024 values),
then don't expect a resolution of two decimal places.
Two decimal places would require at least 14000 counts.

This seems to be a ratiometric sensor, in which case the datasheet is wrong (and so is your code).
This sensor sems to outputs VCC/2 with zero current. That might be 2.500volt on a 5.00volt supply.
But an Arduino 5volt supply is never exactly that.
The code should use an A/D value of 512 as zero reference, not 2.5volt.

All you need is this line.
float current = (analogRead(wcs1700) - 512) * 0.1386;
Then print to one decimal place.
Serial.println(current, 1);
Code: [Select]
const byte wcs1700 = A0;
float zero = 511.5; // zero calibrate
float span = 0.1386; // max Amp calibrate
float current;

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

void loop() {
  float current = (analogRead(wcs1700) - zero) * span;
  Serial.print(current, 1);
  Serial.println(" Amp");
  delay(1000);
}

Smoothing code (multiple reads and averaging) might still be needed.
Leo..

MarkT

Hall sensors are always noisy, your only recourse is low-pass filtering to average the
readings over a longer time period, or use a better technology.

Note that that device has no accuracy specification at all in the datasheet!  Not very
encouraging.  Its sensitivity depends strongly on supply voltage too.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Wawa

Hall sensors are always noisy, your only recourse is low-pass filtering to average the
readings over a longer time period, or use a better technology.

Note that that device has no accuracy specification at all in the datasheet!  Not very
encouraging.  Its sensitivity depends strongly on supply voltage too.
Datasheet mentions a 10-100n cap across the analogue input.
And yes, snoothing code could improve noise.
There could be another problem. We don't know what OP is measuring.

Looks like someone took a standard C-core, put a standard hall sensor in the gap, and encapsulted it in plastic.
I think one hall sensor is much the same as another.

The ratiometric code I posted compensates for that varying sensitivity.
Leo..

MarkT

There are three sorts of hall sensor I know of:

ACS712 and similar that have a copper strip running over an isolated hall chip all potted in a single package.

Ferrite core with a gap and a hall chip in the gap

Ferrite core with a gap and a hall chip in the gap and a secondary winding which is actively driven to
keep the magnetic field zero.  The secondary current is related to the primary current by the turns
ratio and the hall chip can be much more sensitive, so superior sensitivity and lower noise is possible.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

Thanto

Thanks for all the reply

If you measure a 140Amp sensor (+70, -70) with a 10-bit A/D (1024 values),
then don't expect a resolution of two decimal places.
Two decimal places would require at least 14000 counts.

This seems to be a ratiometric sensor, in which case the datasheet is wrong (and so is your code).
This sensor sems to outputs VCC/2 with zero current. That might be 2.500volt on a 5.00volt supply.
But an Arduino 5volt supply is never exactly that.
The code should use an A/D value of 512 as zero reference, not 2.5volt.

All you need is this line.
float current = (analogRead(wcs1700) - 512) * 0.1386;
Then print to one decimal place.
Serial.println(current, 1);
Code: [Select]
const byte wcs1700 = A0;
float zero = 511.5; // zero calibrate
float span = 0.1386; // max Amp calibrate
float current;

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

void loop() {
  float current = (analogRead(wcs1700) - zero) * span;
  Serial.print(current, 1);
  Serial.println(" Amp");
  delay(1000);
}

Smoothing code (multiple reads and averaging) might still be needed.
Leo..
Hi, where is the span value came from?

WattsThat

#8
Sep 27, 2018, 01:38 am Last Edit: Sep 27, 2018, 01:41 am by WattsThat
70 / 512 = 0.1386

Your math is wrong using 511.5. Use the simplified code Wawa posted in #3.
Vacuum tube guy in a solid state world

Wawa

Hi, where is the span value came from?
33mV/A and a bi-directional 70A sensor (140A range) is 0.033volt*140= 4.62volt span on a 5volt supply.
4.62/5 of the range of the Arduino A/D (1024), or ~946 A/D values for 140Amp.

140/946 = 0.14799

Seems I was a bit off.
Change that 0.1386 to 0.14799
Still wise to calibrate if you have the means.
Leo..


Wawa

#10
Sep 27, 2018, 01:52 am Last Edit: Sep 27, 2018, 12:28 pm by Wawa
Your math is wrong using 511.5.
Sensors like that output about VCC/2 with zero current through the sensor.
511.5 is exactly in the middle of the range of a 10-bit A/D, but it might need calibrating.
A zero current calibration value of anything between ~510.0 and ~513.0 could be needed.
Leo..


Go Up