hello
I want to connect this current transducer at arduino uno and I dont know how http://www.lem.com/docs/products/htfs_200_800-p.pdf can u help me
I need to measure the current from a 12V battery
hello
I want to connect this current transducer at arduino uno and I dont know how http://www.lem.com/docs/products/htfs_200_800-p.pdf can u help me
I need to measure the current from a 12V battery
Does anyone know how to connect this sensor at Arduino board ??
There is a picture, on last page. You should connect
Sensor ---////------ Arduino
5V +5V,
0V Gnd,
Output any analog input A0-A5
Than in a sketch, you calculate current based on a given formula:
Output voltage (Analog) @ I P = V ref ±(1.25 · I P /I PN ) V
just solve an equation for IP
so in my case Ipn=800?
Ip = 800 * (Vref -+ Vout) / 1.25.
thanks u so much, I will try and see whats happen
can anybody help me and find the mistake
void setup(){
Serial.begin(9600);
pinMode(A0, INPUT);
pinMode(A1, INPUT);
}
float Reference = 0;
float volts = 0;
float ref = 0;
float RawAmps = 0;
float Read = 0;
void loop(){
Read = analogRead(A0);
Reference = analogRead(A1);
volts = Read * ( 5.0 / 1023.0 );
ref= Reference * (5.0 / 1023.0);
RawAmps = (800 * (volts+ref/1.25));
Serial.print(RawAmps);
Serial.println("=");
delay(500);
}
You have two voltages and presumably a known resistor and you trying to calculate current flow?
V = IR, so V/R = I.
V = difference in voltage between the two inputs.
You don't calculate that.
V/R = current, I don't see a resistor value either. Is that what 800 is? If so your formula is incorrect.
my problem is that i have to measure current that flow through a wire with this sensor http://www.lem.com/docs/products/htfs_200_800-p.pdf
so I need help how to connect the pins + the code, is for my bachelor degree
Try exactly as in reply #4:
RawAmps = 800.0 * (volts+ref ) /1.25;
It would make sense to pre-calculate coeff. 800 /1.25.
I did this
void setup(){
Serial.begin(9600);
}
float Vout = 0;
float Vref = 0;
float Ip = 0;
float Volts = 0;
void loop(){
Vout = analogRead(A0);
Vref = analogRead(A1);
Volts = ( ( Vref - Vout ) * ( 5.0 / 1023.0 ) );
Ip = (800*Volts) / 1.25;
Serial.print("Current Amps = ");
if (Ip < 0.00){Ip = -1;}
Serial.print((Ip < 1.00) ? (Ip * 1000) : Ip);
//Serial.println(Intensity);*
Serial.println((Ip < 1.00) ? "mA" : (Ip == 1.00) ? "Amp" : "Amps");
//Serial.println(Vout);
//Serial.print(Vref);
//Serial.println(Volts);
//Serial.println(Ip);
Serial.print("");
Serial.println("==================");
delay(500);
}
And? There is no question in your post. Its good practice, to print over serial monitor any variable you have in the code, so you can verify if your math works flawless
help me find the mistake, every time I measure give me the same measurement, so I want to use this sensor to measure the current that flow through a wire http://www.farnell.com/datasheets/30908.pdf?_ga=1.131992584.628000669.1488581309
I have put the pins
arduino // sensor
5v // 5v
gnd // 0v
A0 // Vout
2.5 from a extern battery // Vref
and this is the code
float Read=0.0;
float Tens=0.0;
float Vref=2.5;
float Ip=0.0;
void setup(){
Serial.begin(9600);
}
void loop(){
Read= analogRead(A0);
Tens = (Read5/1023);
Ip=(800(Tens-Vref))/1.25;
Serial.println(Ip);
delay(250);
}
What value does your Arduino give you?
What value(s) do you expect?
Are you measuring DC or AC?
Can you measure Vout with a DMM or observe it with a 'scope under "X" amps?
Does Vout=2.5v at zero amps (measured with a DMM)?
Does Read=511 or thereabouts at zero amps?
2.5 from a extern battery // Vref
This is wrong.
Sensors like this are ratiometric.
You should power the sensor from Arduino's 5volt pin (same Aref), and subtract ~512 from the analogue reading.
There are many example sketches on this forum for an ACS712 sensor, which is electrically the same.
Here is some code I wrote for a 30Amp current sensor to get you started.
You might have to tweak/calibrate the "span" value for your sensor, so e.g. 100Amp current displays 100Amps.
Note that your sensor is a high Amp type. The resolution (readout steps) you will be getting is 1Amp at best.
Leo..
// 30A bi-directional ACS712
int sensorPin = A0; // the pin that the sensor is connected to
// YOUR calibration
float offset = 511.5; // zeroing bi-directional sensor | could be 510.0 to 513.0
float span = 0.07315; // span | depends on type of sensor used (e.g. 30A) | finetune max readout
const byte numReadings = 32; // number of readings for smoothing (max 64)
int readings[numReadings]; // raw A/D readings
byte index = 0; // index of the current reading
unsigned int total = 0; // running total
float current; // resulting current
void setup() {
Serial.begin(9600); // ***set serial monitor to this value***
for (index = 0; index < numReadings; index++) { // fast-fill the array at startup
readings[index] = analogRead(sensorPin);
total = total + readings[index];
}
index = 0; // reset index
}
void loop() {
total = total - readings[index]; // subtract the last reading
readings[index] = analogRead(sensorPin); // one unused reading to clear any ghost charge
readings[index] = analogRead(sensorPin); // read the sensor
total = total + readings[index]; // add the reading to the total
index = index + 1; // advance to the next position in the array
if (index >= numReadings) // if we're at the end of the array
index = 0; // wrap around to the beginning
// convert value to current
current = (total / numReadings - offset) * span; // value to current conversion
// print to serial monitor
Serial.print("Current is ");
Serial.print(current); // default two decimal places | ...(current, 1); is one decimal place
Serial.println(" Amp");
delay(100); // use a non-blocking delay when combined with other code
}
grrrrrr
when I measure with arduino it give me 22.33 or 26.59, right now I m trying to measure Ac current, and yes when I measure Vout with an dmm is 2.5v at 0 amps
thank u @Wawa I will try what u sad.
so I don't power Vref from an external 2.5 battery??
and this code that you give me is good for me?? I dont have to change anything?
Just calibrate zero current (without current through the sensor) and gain (with a known current through the sensor). Both explained in the sketch.
I hope you realise that this is a +/- 1200Amp sensor that you're trying to measure with a 10-bit A/D.
Don't expect to see small currents.
Leo..