3
\$\begingroup\$

I am currently doing a MPPT(Maximum Power Point Tracking) using Arduino UNO. So far I have pretty much almost finished the coding. When I was about to test my program using a regulated DC power supply, it suddenly occurred to me that I had done things wrongly. How was my circuit going to detect/read the voltage and current values?

Regarding this, I do not know how I can let my Arduino circuit detect the current and voltage values separately on each analog input. I would be using the current and voltage value (pv_I and pv_Vnew) to multiply them together to obtain the power value.

My problem is that I need help with the hardware, getting the voltage and current values into the ADC I hope someone can help me with this problem.

If it helps, this below is a part of my code where i do the multiplying and stuff.

float pv_I; //input current
float pv_Vnew; //input voltage

void reading(void)
{
  pv_I = analogRead(A0);     //This is the area that is in question
  pv_Vnew = analogRead(A1);  //This is the area that is in question

  reading_value[0] = pv_I;
  reading_value[1] = pv_Vnew;

  Serial.print("Current, Voltage: "); //Start of string

  for(int i = 0 ; i < 2 ; i++)
  {  
    Serial.print(reading_value[i]);  
    Serial.print(", "); // Seperate each value with ',' to identify them seperately
  }

  Serial.println(" END"); // End of string
  delay(500);

}

void PowerCalculation(void)
{
  tempPower = pv_I * pv_Vnew;
  pv_NewP = tempPower;

  Serial.print("Calculated Power: ");
  Serial.println(pv_NewP);
}
\$\endgroup\$
  • 1
    \$\begingroup\$ Other than with a shunt resistor and an in amp? \$\endgroup\$ – Ignacio Vazquez-Abrams Nov 10 '16 at 2:15
  • \$\begingroup\$ What exactly is your problem? - your software appears to be reading a current value from ADC channel A0, and a voltage value from A1. \$\endgroup\$ – Peter Bennett Nov 10 '16 at 3:18
  • \$\begingroup\$ @PeterBennett The idea is to let A0 read a current value and A1 read a voltage value. But I have not yet enabled it to do so. \$\endgroup\$ – bytk Nov 10 '16 at 4:16
  • \$\begingroup\$ @bytk: It is not clear from your question whether you want help with the software (reading and processing the values), or with the hardware (actually getting the voltage and current values into the ADC). Please edit your original post to include a clear question, or description of your problem. Your comment above does not clarify the matter. \$\endgroup\$ – Peter Bennett Nov 10 '16 at 4:48
  • \$\begingroup\$ @PeterBennett Thank you for the feedback! I have amended my post. \$\endgroup\$ – bytk Nov 10 '16 at 5:09
3
\$\begingroup\$

As alluded to in the comments, your code implicitly assumes both a voltage representing the load voltage and a voltage representing the load current.

Assuming that the load voltage is less than the UNO input maximum, your circuit can look like

schematic

simulate this circuit – Schematic created using CircuitLab

If you make RSense at least 100 times smaller than RLoad, the error introduced will to "Voltage" will be less than 1%. This means, of course, that you wil have to pick R3 and R4 to give adequate gain so that "Current" is usable small. You will also have to keep careful track of stray ground resistances so that you correctly read the current-induced voltage, since RSense will be small and small errors in the ground resistance will make a difference.

If it is important to you that your load be grounded, then

schematic

simulate this circuit

is what you want. Note that the op amp is replaced with a differential amp with a fixed, known gain. The biggest problem that you will probably face is that the load voltage may well be too high for the UNO, and this will also cause problems with providing appropriate supply voltages to the diff amp so that you don't overdrive the inputs (common mode voltage too high).

\$\endgroup\$
  • \$\begingroup\$ Thank you for this very helpful explaination and method. I will work on this. However I do not understand what is RSense, OA1 and DiffA1. \$\endgroup\$ – bytk Nov 10 '16 at 4:21
  • \$\begingroup\$ RSense is a small resistor which senses the value of the current using Ohm's Law. If your current is 1 amp, and RSense is .01 ohms, the voltage across it will be .01 volts. using a gain of 100 will give 1 volt at the UNO - but you've got to be careful. OA1 is an Op Amp. DiffA1 is a differential amplifier - look it up. It will also need a high gain if RSense is low. \$\endgroup\$ – WhatRoughBeast Nov 10 '16 at 5:46
  • \$\begingroup\$ A typical implementae of a differential amplifier is an instrumentation amplifier, which you can build yourself from opamps and resistors, or buy as expensive part if precision really matters. \$\endgroup\$ – Michael Karcher Nov 10 '16 at 8:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.