Go Down

Topic: Measure current (Read 297 times) previous topic - next topic



I am trying to measure current with my Arduino Uno, and I want some opinions on my solution. Is this the right way to go?

Circuit: https://www.dropbox.com/sh/etny3sgyzmgrn9e/HMYVGX15Rm
(The LED in the image could be switched to whatever I need to measure)

Code: [Select]
const byte Vin0 = A0;
const byte Vin1 = A1;
const float R = 2.0;

void setup(){

void loop(){
  float V0 = analogRead(Vin0);
  float V1 = analogRead(Vin1);
  float I = (5.0 * (V0 - V1)) / (R * 1023);
  Serial.print("[ Voltage: ");
  Serial.print(5.0 * V0 / 1023);
  Serial.print(" V Current: ");
  Serial.print(I * 1000);
  Serial.println(" mA ]");



yes that is doable.
However you are doing 2 analog reads, one after the other. So your voltage could have changed in the meantime.

I would suggest you put your 2 Ohm resistor at the bottom connected to ground (so swap position with the 200 Ohm R).
This way you measure against Ground, and you only need to do ONE analogread.


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131