I have a XBee that is connected to the computer and I have grove current sensor which is connected to the AD2 pin of XBee . My question is can I able to use the following command for getting accurate current value of that sensor. I got this formula from the Grove wikki
amplitude_current = (float)(sensor_value / 1024 * grove_vcc / 800 * 2000000)
# Calculate effective value (mA)
effective_value = amplitude_current / 1.414
# minimum_current = 1 / 1024 * grove_vcc / 800 * 2000000 / 1.414 = 8.6(mA)
# Only for sinusoidal alternating current
print "sensor_value", sensor_value
print "The amplitude of the current is", amplitude_current, "mA"
print "The effective value of the current is", effective_value, "mA"
I’d say that’s the correct formula for getting the effective value. Here’s a very interesting topic on the Grove Current Sensor. I suggest you give it a good read.
@RobertLucian Thanks for your replay. I read the document you have provided in that I found Arduino A) pin out put value is from 0 to 36 but XBee ADC pin value is range from 0 to 1023 . So the above formula is suitable for my case .When I try to test 156Wh. I am getting 140 Wh. Should I calibrate this model for getting the accurate value.
I would make a suite of tests for different values - say 10 tests and then I’d check if adjusting the values (by offsetting them or by some sort of factoring it) is enough for predicting new values. Visualizing both curves (for both the calculated value and the measured one) should give lots of insight.
Following these tests and readjustments, if the sensor is not capable of predicting accurately, then it means it’s the sensor that’s not accurate enough for the task. Otherwise, then it means it was just a problem of calibrating it.