Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Measure DC current of a motor using an Arduino nano

Status
Not open for further replies.

abouabdelmajid

Newbie level 5
Joined
Aug 24, 2017
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
109
i am trying to mesure the curent of a 12v DC motor using an arduino nano. i used this diagram

schéma.png

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:

Hi,

Sadly, I think we can't help.
* We don't know the measurement range of your system (to calculate the multiplier. In your case: 0.044A/LSB)
* and we don't know the zero_current_offset of your system. (to calculate the subtractor. In your case: 3.78A)

Klaus
 

Hello,



Datasheet of your sensor ?

if it is an ACS712 , offset is arround VCC/2
and with a scale of 30Amps, no chance to measure 12.92 mAmps !

Event with a scale of 5Amps..
This kind of sensor dose'nt cover all the scale
ie: for 5 Amps scale AC712 sensor
you have 185mV/Amps so with ADC10 bits 5V => 37.88 points / amps
so +-512 poinst => +-13.5 Amps for +-2,5V,
it is not fo +-2,5Amps!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top