Code: Select all
#define V_BATPIN A3 // Analog PIN 3
#define PSENSORPIN A2 // Analog PIN 2
Unfortunately, the result is only partially usable. According to arduino specs, for input range [ 0 ; 5.0 Volt] analogRead() returns 10 bit [0 ; 1023]; thus 4.9mV/unit. But when attaching a current sensor, with a constant load, I find the return value of analogRead() to be within a range of +-30 units, i.e. +-150mV. That is very inaccurate, about 5 bits of the 10 bits are garbage.
On the other hand, monitoring the output voltage of said sensor with a multimeter does not show such variance.
The maximum reading frequency is never reached with MWii http://arduino.cc/en/Reference/AnalogRead
Using averaging filter in MWii would only disguise the hardware inaccuracy, so it is not an option. Here I am wondering what could be done to increase the actual accuracy of analogRead() up to the nominal accuracy? Any ideas, please?