abouabdelmajid
Newbie level 5
i am trying to mesure the curent of a 12v DC motor using an arduino nano. i used this diagram
i used this code
instead of having the right value 12.92ma (measured by amperemeter) i am havung wrong negative values
Somebody can help me please
i used this code
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 void setup() { Serial.begin(9600); } void loop() { float average = 0; for(int i = 0; i < 1000; i++) { average = average + (.044 * analogRead(A0) -3.78) / 1000; //5A mode, if 20A or 30A mode, need to modify this formula to //(.19 * analogRead(A0) -25) for 20A mode and //(.044 * analogRead(A0) -3.78) for 30A mode delay(1); } Serial.println(average); }
instead of having the right value 12.92ma (measured by amperemeter) i am havung wrong negative values
Somebody can help me please
Last edited by a moderator: