Want to measure a solar panels voltage using an ADC input

rjandsam

Member
Hi, I want to measure a solar panels output using an ADC input but before I begin just wanted to know if this is a potential divider issue or does somebody know of a better method.
I will use a 14m2 and a panel capable of outputting 6v at 250ma, the Picaxe will be 3.3v regulated from a separate supply.

Thanks Rich.
 

g6ejd

Senior Member
Straight forward potential divider solution. Work out the maximum voltage likely to be seen and scale accordingly.
 

Michael 2727

Senior Member
You'll need to take into account that the Open Circuit Voltage
of the PV panel may be nearly double the 6V rating.
So your Divider will have to be setup for the MAX output V rating.
This will mean most of the time you will only measure in the
lower half of the Divider scale.
 

rjandsam

Member
Thank you guys I thought so, also sounds like a good idea to check the open circuit voltage.
I have never done anything solar before so it’s all new to me.

Thanks again
Rich.
 

MFB

Senior Member
If your new to solar power you should find the series of article that Nuts & Volts magazine published a couple of years back very informative. Not only did it cover the theory but also included many practical PICAXE based example projects. Well worth doing a search and down loading any articles that are available.
 

SteveT

Senior Member
If you have an Android device there is a Nuts and Volts app available from the Google store for free. It lets you preview the latest issues of the mag but gives full access to older issues.
 

AllyCat

Senior Member
Hi Rich,

You haven't said what you intend to do with the "voltage" measurement. IMHO the open-circuit voltage is not particularly useful and neither is the often-quoted "short-circuit current" (by itself), because neither involves the transfer of any useful power (P = V * I, and one of the latter is zero in each case).

Often a current measurement is more useful than the voltage, for example if you are directly charging a battery, then the voltage is "fixed" and it is the charging current which is the main factor to determine how long before the battery is fully charged. Or if the panel is driving some "electronics" via a voltage regulator, then measuring the panel voltage only really tells you if there is sufficient "headroom" voltage for the regulator to be operating properly.

Since the panel is rated at 6v, 0.25A, perhaps you should be (or are) using a (dummy) load of 24 ohms, in which case either a "tapped" load or separate potential divider, are indeed the correct way to keep within the input voltage range of the (PICaxe) A/D converter.

Cheers, Alan.
 

boriz

Senior Member
Agree with above.

One more point. A potential divider is an additional load on the panel, stealing valuable energy. Rather than have it permanently connected, have it switched in just before the measurement and then switched out. Using a transistor maybe.
 

rjandsam

Member
Hi guys thanks for all of the advice, I set up a 14m2 today and a divider circuit 8k and 10k and have been getting some pretty accurate readings compared to the bench meter. My aim is to have it charge a 4000 mah lipo with pcm and measure the battery and panel so that I can disconnect the panel from the battery at 4.1v to prevent overcharging.

Thanks

Rich
 

AllyCat

Senior Member
Hi Rich,

Yes, that's potentially a good idea, but I think you mean PWM, which is certainly an "interesting" (i.e. challenging) charging method (there should be several relevant threads on this forum). However, to be worthwhile, I believe it's necessary to use a switched mode (inductive) power converter, monitoring both the PV voltage and current, and employ a sufficiently sophisticated program to calculate and optimise the power transfer.

@Michael: Most PICaxe I/O pins (except the raw PIC's PGM/MR pin) have an internal "catching" diode to the supply rail (for "electrostatic" protection). So the pin voltage cannot rise more than about 0.6 volt above the supply rail. BUT, feeding too much current into the pin can destroy the diode, or even pull up the supply rail above its rated voltage (6 volts absolute maximum).

Cheers, Alan.
 

cravenhaven

Senior Member
You could use a zener to limit the voltage into the picaxe and then you could aim for a larger ADC swing over the voltage range you want.
 

westaust55

Moderator
Re: Open circuit Voltage.
What is the Microchip spec for MAX Voltage on any Pin.
Depending upon the PIC involved but typically the recommended max supply voltage is 5.5 volts (Absolute max 6.5 Volts)
The absolute max voltage on a pin is 0.3 Volts higher than The supply voltage (Vdd).
 
Last edited:

rjandsam

Member
Hi,
The potential divider 560k and a 680k is taking 4.5ua from the panel, voltage readings are just as accurate.
The panel has been producing 25ma on average all day today into the li-po cell which has reached 4.03v (4.1 on bench meter) at 4.05v an N mosfet will disconnect the panel from the battery.
Hopefully the inputs on the 14m2 will never see anything higher than 4.2v because of the way it has been setup, this was just a practice run to see what was possible with next to nothing, now I will look into ways to optimise the charge and discharge sequence.

Thanks
Rich
 

MFB

Senior Member
Is the centre of the potential divider feeding directly into the PICAXE analog input? The values given above would cause significant errors if an opamp voltage follower was not buffering the ADC input.
 

rjandsam

Member
Hi MFB,
yes the centre is feeding directly into the PICAXE analog input and the readings so far have been pretty accurate, do you have a schematic of what you would recommend?

Thanks
 

boriz

Senior Member
This has been covered before. Suggest you do a forum search. The maximum recommended input impedance for the ADC is 10K. You have it much higher than that. But a Microchip app note on the subject says you can get away with higher impedance just by using an additional capacitor from pin to ground. Can't remember the value. Small though. Maybe 10n or there abouts.
 

AllyCat

Senior Member
Hi Rich,

Yes, the Microchip datasheet recommends the A/D source resistance should be less than 10k ohms, so strictly you should be using a divider of 18k + 22k, or lower, but this still only consumes 0.4 mW at 4 volts. In cases where an even lower loading is required, then add an unpolarised capacitor (ceramic or plastic type, an electrolytic might "leak" current) of perhaps 1nF. However, the datasheet doesn't specify how much higher resistance might then be satisfactory.

Cheers, Alan.
 

srnet

Senior Member
I have used up to 200K and 22K, as a voltage divider, you loose some precision, but maintain a relatively high resistance in total.

Go can cut consumption further, approximately in half, by only grounding the low end of the 22K via a PICAXE pin when reading the voltage. The voltage on the AD pin in this case is approx 1/10th of the voltage being measured.

Then when the PICAXE pin is high, the 200K resistor only sees the higher PICAXE supply volts, via the input protection diodes, thus the current is lower.
 

MFB

Senior Member
Yes, that's why I place a rail-to-rail I/O amp between sources of resistance and an ADC input. Not only reduces sampling errors but prevents one overloading channel effecting the others. When used in the non-inverting unity gain configuration (output connected directly to the inverting input) the op amp only requires one protection resistor in series with the non-inverting input.
 

rjandsam

Member
Thanks guys for all of the great advice as usual.
I have searched the forum and found a few great ideas, this morning I have taken the regulator out of the equation and am using the calibadc10 command as recommended on one of the threads I found late last night.
this seems to work pretty accurately, any thoughts?
obviously this is not final by any means as I need to add light level temperature and other things into the code to make for a more reliable setup.
main:
CalibAdc10 w0
w0=52378/w0*2
pause 4000
SerTxd( #w0, " ",b10,b11,b12,cr,lf )
pause 4000
if w0=>415 then low b.4 'turns off panel through mosfet
else if w4=<400 then high b.4
endif
goto main

Thanks
Rich
 
Last edited:

AllyCat

Senior Member
..a panel capable of outputting 6v at 250ma, the Picaxe will be 3.3v regulated from a separate supply.
Hi Rich,

You defined the situation very well back at #1, but are you (still) using a regulated supply for the PICaxe? EDIT: Ah, I see you've edited your last post and have abandoned the regulator.

So the panel may deliver around 1.5 watts and a potential divider (of the "correct" value) would consume 0.0004 watt; IMHO no need to complicate matters with an Op-Amp (which may consume more power than the basic divider).

Yes, I nearly suggested CALIBADC earlier in the thread, but it's not necessaily any better, if you're using a regulated supply rail for the PICaxe. Both the PICaxe's internal "reference" and the external regulator will have some amount of "error". Therefore, whichever you use, you should really calibrate the value of the "multipler" in your software against a known voltage reference, such as a reasonable quality multimeter.

Cheers, Alan.
 

rjandsam

Member
Hi Alan /Marks,
I went back to the regulated version as recommended by Alan and used the code by Marks calibrated against my bench meter,it seems a very stable building platform now, thanks for the example code Marks.
doing it this way also allows me to use the panels values to best guess the current light level.
the 14m2 running at k31 is taking .145ma and wakes every 15mins ish to check light, battery level and temperature during this wake period it consumes a little more but only for a second so am very happy so far.
thanks for all of the great advice everybody.

Rich
 
Top