I got a WCS1600 Hall current sensor. For DC current, It's rated to detect upto 100A @ 5V. Sensor sensitivity is 22mV/A.
How do I go about the math to convert sensor values to Amps?
How do I go about the math to convert sensor values to Amps?
First, convert the sensor reading to a voltage. Only you can do this, as only you know what the voltage is on your Arduino.
Then, convert the voltage to amperage, using the 0.022V per Amp ratio.
Thanks! XD
I wrote this code, but apparently, the map function part isn't working properly. I just get 0.00 all the way on the serial monitor.
What am I doing wrong?
void setup()
{
Serial.begin(9600);
}
void loop()
{
int sensorVal = analogRead(A0);
float value1 = sensorVal * (5.0 / 1023.0);
float value2 = map (value1, 2.51, 4.71, 0, 100);
Serial.println(value2);
delay (200);
}
The map function does not take float arguments. What do you see when you print sensorVal? value1?
Why do you assume that they are correct, and that the problem is with the map() function?
Actually, subtracting 2.51 from value1, and then multiplying by 100 would be far easier. Assuming, of course, that value1 is meaningful.