0

I am trying to develop a system that reads the amount of power consumption from my load. Here is how my setup looks like; enter image description here

The led represents a 5W and 12V light bulb(I was unable to get this in my simulator) and the battery i am using is 9 volts Here is my code;

 sens = analogRead(A0);
 vol = sens * (2.0) * ( 5.0 / 1024.0);
 tot_vol = 5 - vol;
 current = vol / 10;
 power = current * tot_vol;
 Serial.print(power);
 Serial.print ("\n");
 delay(1000);
 if(Serial.available() > 0){ // Checks whether data is comming from the serial port
state = Serial.read(); // Reads the data from the serial port
}
if (state == '0') {
 digitalWrite(ledPin, LOW); // Turn LED OFF
 state = 0;
}
else if (state == '1') {
 digitalWrite(ledPin, HIGH);
 state = 0;
 } 
}

I am trying to calculate the voltage drop across my resistor and then get the current and then power from that. This data is sent to an android app via the bluetooth module. However, here is the output i am getting; enter image description here

What am i doing wrong?

asked Sep 14, 2017 at 8:21
1
  • Question: why are you powering a 12V bulb with a 9V battery? Commented Sep 22, 2017 at 12:43

2 Answers 2

0

A number of things wrong:

  1. You have no ground connection to the Arduino. It can't work out what the voltage you are measuring is relative to. (Read this)
  2. You should have the shunt resistor as the absolute last item in your chain of components so it is connected directly to ground (V+ -> LED -> LED's Resistor -> Relay -> Shunt Resistor -> GND
  3. Your shunt resistor should be as low as you can get away with - low enough that it doesn't affect the circuit, yet high enough that you can measure a voltage drop. For that you need to first have a good idea about what level of current you will be measuring.

schematic

simulate this circuit – Schematic created using CircuitLab

answered Sep 14, 2017 at 10:36
4
  • Hi, i have updated the question with 2 images that represent my current situation(after following your instructions). I am getting roughly 0.48 watts per second for a 5w and 12v light bulb. Kindly advice if the power readings i am getting are accurate. Commented Sep 21, 2017 at 3:37
  • Your analog input is connected to the wrong side of the relay. Commented Sep 21, 2017 at 8:01
  • Where should the analog input be connected? Commented Sep 22, 2017 at 8:48
  • To the high side of the resistor. I will draw a circuit. Commented Sep 22, 2017 at 8:48
1

Normally the shunt resistor (in you schema 220 ohm) is way lower than the load it should measure, 12volt/5Watt = 0.42 Amp and R = U/I, 9V/0,42A = 21ohm. So your 220ohm's shunt is inflicting on the measurement value.

So to change the current measurement circuit you have to use a low ohm resistor and since the voltage drop over a shunt/low ohm resistor is small you need a amplifier.

Here is a page about how to calculate a shunt and use it with Arduino: http://www.vwlowen.co.uk/arduino/current/current.htm

If we use a simplified version, 8v over the lamp and 1volt over the shunt.

U = I x R

Rlamp = 21 ohm

Ilamp = 8 volt/21 ohm

Rshunt = U/I = 1 volt/0.42 Amp

answered Sep 14, 2017 at 8:53
2
  • Thank you. Even if i change the resistor to 10 ohms, the output does not really change Commented Sep 14, 2017 at 8:59
  • Yes, you need to be below the resistant of the light bulb (0,42 ohm). I will modify my answer with the formula. Commented Sep 14, 2017 at 9:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.