Cyclic Analog Read

Hello,

I have a problem with my analogread() function.

int voltPin = A0;
float volt;
void setup() {
  // put your setup code here, to run once:
Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
//volt = 50*analogRead(voltPin)/1023;
volt = analogRead(voltPin);
Serial.println(volt);
delay(100);
}

I’m using an Arduino UNO, I have a circuit consisting of a 10Kohm pot with a 4.5v battery source (3 AA batteries in series). By using the voltage divider, I connect 2 resistors tapped to A0 pin.

I’ve attached an image of my connections via simulator.

Problem:
I haven’t been able to get a consistent or accurate reading.
The values I get also seem to be cycling between 0 and 1023 in the form of a sine wave.

Objective:
I’m trying to use a digital potentiometer to cycle through a range of resistances to act as a load for a solar panel. I intend to trace the IV curve of the solar Panel using this.

Does this sound plausible at all?

Need some help, thanks!!!
Please do let me know if more information is needed!

-Sherman

I’m pretty sure you need to connect the pot’s -ve to the Arduino Gnd

Here’s OP’s pic:

6a74c55857cf2c219c14a452e98765385ea39707.png

You sure the connections to the pot are correct? All the ones I’ve ever seen have the resistor on the outer pins and the wiper in the middle.

You don't have a circuit.

Its called a circuit because current goes round. So there must be at least two wires between two parts of any circuitry except for an antenna.

You are trying to use your pot+battery as an antenna connected to an analog input pin!!

Hi, Don't use that circuit, if you turn the pot to either extreme CW or CCW you will short the battery out and possiby damage the pot.

Tom..... :o :o :o

Hi,
This I think is what you are trying to do;
AnalogRead.jpg
Tom… :slight_smile:

Hi,

Objective: I'm trying to use a digital potentiometer to cycle through a range of resistances to act as a load for a solar panel. I intend to trace the IV curve of the solar Panel using this.

A digital pot will not have the power rating needed to even load a 1W panel.

Can you tell us your electronics, programming, Arduino, hardware experience? Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png of how you will connect the load and monitor current and voltage.?

The Arduino can do what you are asking, but power levels and voltage and current connections will have to be thought about. What Voltage and power is/are the panels?

Here is a pretty serious version of what you are trying to do. http://www.re-innovation.co.uk/web12/index.php/en/projects/solar-pv-iv-curve-tester

Have you googled arduino PV testing

Thanks.. Tom.. :)

Digital pot cannot handle power, only for signals.

A variable load can be done using a high power voltage-controlled constant-current sink circuit.

Like figure 2 on this application note: https://www.maximintegrated.com/en/app-notes/index.mvp/id/3748

By the way digital pots are almost never used, they are only needed when handling delicate analog signals that need attenuation, such as hifi audio. Most of the time if you think you need a digipot, you actually need a DAC.

Objective: I'm trying to use a digital potentiometer to cycle through a range of resistances to act as a load for a solar panel. I intend to trace the IV curve of the solar Panel using this.

The manufacturer's datasheet may already have this information.

MarkT: By the way digital pots are almost never used, they are only needed when handling delicate analog signals that need attenuation, such as hifi audio. Most of the time if you think you need a digipot, you actually need a DAC.

In fairness to Okuside, this kind of thing is what a digipot would be useful for if it could handle the power. It was meant to be used as a variable resistance load, not just a divider outputting a voltage for some other subcircuit to reference.

Hi,
The ops circuit kind off makes sense,
6a74c55857cf2c219c14a452e98765385ea39707.png
The pot is being used as the PV load, the battery is simulating the PV.
But due to gnd problems will not work.
Also using fritzy instead of drawing a circuit of what he wants.

Tom… :slight_smile: