I've done some reading around this topic and have got myself a bit confused so looking for a bit of guidance to straighten me out.
I have a (currently working absolutely fine) 20W solar panel that I use to charge a 12v battery. This is connected to an inverter and can be used to power things (eg my home server and a few other bits and pieces).
Anyway, as a little project I'm interested in measuring how much power my solar panel is producing at any point in time (then being able to graph it etc with some software).
My solar panel is rated at 20w and has a fixed current of 1 amp thus as the panel is more or less in sunlight it generates a value between 0-20V. Clearly I can't connect that directly to my Arduino or it will be dead pretty quickly.
I understand that if I can drop everything down to <5v then I could measure this on an analogue input pin however some pages suggest using specific ICs to do this, some use an interesting combination of resistors and sensor resistors, opAmps or voltage dividers, hall effect sensors...
Really what I'm looking for is a bit of direction on the "right" way (if one exists) to approach this. I'm not phased by having to build something from scratch (would be a good learning process) or to be directed at a specific off the shelf component that does this for me. At the moment I'm trying to cut through Google-confusion.
So do I put that in parallel to the connection to the battery? As presumably if I put this on the panel -> batt line I'd just end up with 5v and some heat and a non charged battery.
Its effectively a voltmeter, one end is connected to ground (which should be common with the arduino) the other is connected to the outlet of the solar panel. The connections to the batteries and stuff remains as is. The bit between the resistors is connected to an analog input. With the correct scaling of the resistors you'll get 0-5v from the takeoff for a 0-20v from the solar panel. I'd suggest around 1k and 3k for the two resistors. (1k connected to ground).
Thanks everyone for the feedback much appreciated...
So to summarise:
From Pluggy's comments - I run a voltage divider alongside the current cabling for charging the battery. I'd use a common ground for Arduino and the panel (presumably the ground of the battery I'm charging?) and then use the voltage divider schematic to scale down Vin to a 5v range...
@rob (graynomad) - yep understand that - I'll use voltage to derive watts as my panel is constant 1amp (until it hits something like 19v at which point it starts tailing off - but I'm more interested in rough measurement at this stage than perfect accuracy)
@magician - great link and I think that could be really useful to optimise my charging.
I'll use voltage to derive watts as my panel is constant 1amp (until it hits something like 19v at which point it starts tailing off - but I'm more interested in rough measurement at this stage than perfect accuracy)
That would appear to be an inaccurate statement, as it would seem to 'break' ohm's law. The current being drawn is determined by the load resistance and the internal impedenace of the solar panel. If there was nothing wired to the solar panel if would be developing zero watts even at maximum voltage output during max sunlight conditions.
You must also measure the current flow as well as voltage from the solar panel to be able to calculate power being supplied by the panel, Volts X amps = power in Watts.
In this case then would not the battery that is being charged just be drawing the maximum number of amps possible from the solar panel as that is all it's connected to? The panel can produce a maximum of 1amp so unless you were at the boundary condition of the battery being at almost 100% capacity can I not make the assumption that it's drawing 1amp almost constantly?
In my case I don't really care about the 100% capacity case for two reasons: 1. I have a charge controller that switches off supply if the battery hits capacity and is at risk of overcharge and, 2. Because I'm draining power to run a server the battery is constantly being discharged thus very rarely actually hits 100%.
Please correct me if I'm wrong as I've been making this assumption about how a solar panel charges a battery for years....
For some further context the reason I'm doing all of this is to set up a baseline for some further expansion of my solar system so I want to measure input from the panel (which will become panels) and then also look at output (as it will power additional devices). So I'm looking at building some kind of reporting system. Having said that - starting with a simple measure of what the panel is doing is the first step on this longer road!
If the battery is low then the current will be capped at 1A if indeed that's what the panel does.
But most panels don't have a regulator, they will put out as much as possible (or required) and that will change with temperature, so your final system won't be able to rely in this capped value even if the test system does.
At some point that current will start to drop as the battery charges. I think the point is that you will never know where that point is. 90%, 80%, 70% who knows and it's also dependant on the battery type and size.
In my case I don't really care about the 100% capacity case for two reasons:
The current trail off will start long before 100%.
Because I'm draining power to run a server the battery is constantly being discharged thus very rarely actually hits 100%.
Batteries like to be fully charged and depending on the type should never really get below 80% so ideally your system should always be operating in the grey area where you don't know what current is being drawn.
So IMO you can't rely on the 1A, that's just the max that may or may not be realised.
Having said that - starting with a simple measure of what the panel is doing is the first step on this longer road!
And that's my point, unless you can measure panel current flow and voltage output you can never know what the panel is contributing to the overall system. Also some higher order calculations using time would also give you kilowatt hours delivered over various time spans, day, month, year, lifetime. These are all key variable to determining the capabilities and the economic advantages or disadvantages of your solar system.
It may not be rocket science but it is science and good measurements leads to better and more complete data and without that data one cannot make reliable decisions.
As a wise man once said, measurement changes behaviour.
All extremely good points and some assumptions challenged which I always like. So on the basis that I'm not going to assume 1amp what's the right way to go about this in order to measure current and voltage. I can use voltage in parallel to the circuit but presumably to measure current I have to be in series - isn't putting my arduino in the path of potentially 1amp and up to 20v going to end up with some blue smoke?
ajfisher:
All extremely good points and some assumptions challenged which I always like. So on the basis that I'm not going to assume 1amp what's the right way to go about this in order to measure current and voltage. I can use voltage in parallel to the circuit but presumably to measure current I have to be in series - isn't putting my arduino in the path of potentially 1amp and up to 20v going to end up with some blue smoke?
If your solar cell panel is ground based, that is if it's negative lead is wired to everything else's (charger, battery, arduino, controller?,etc) ground then it's pretty simple. You wire a low ohm resistor, say 1 ohm (get a precision one) and wire the resistor in series from system ground to the solar panels negative lead. Now you can wire a measurement lead from the solar end of the resister to a arduino analog input pin. A analogRead() value of one volt (205 counts) would mean one amp of current is flowing. You can then use a map statement to convert A/D counts into current range. You already know about using two series resistors to form a voltage divider to allow the Arduino to measure panel voltage scaled to arduino safe voltage levels. For time measurements you could either add a $15 RTC/calendar chip to your arduino or use the a time library. It's not difficult as your solar panel is not a high current device. If we were talking panels of 10s of amps or higher then there are better ways to sample and measure DC current.
Again thanks for everyone's patience on this explaining it to me - it is much appreciated and it's always a great day to be learning things.
Okay so I have here a sketch of what that would look like according to Lefty's instructions - does this look right (before I go off and fry something )?
Now I've extended this to incorporate the original part of this thread - to measure voltage too:
I'm assuming I'm bringing the voltage measurement circuit back to the ground on the charge controller as well (indeed I'm assuming everything goes back to CC ground first as that is then tied to the battery ground) or should I be going directly to the battery and skipping the controller.
If all this is correct then I have one final question - for the arduino I was planning on powering this from something else (ie not 20v solar panel! In the first instance probably just a battery to get me up and running). Does the Arduino stay isolated in that regard or does the arduino's ground need to link back into the main solar panel / battery circuit?
Thanks for all the input... feel like I'm much closer to going and putting something together now which is quite exciting.
To measure the current use a Toroid Current Sensor -- some produce 100mv per amp. Usually they are designed for measuring line voltage or AC current though.. You can get pass through or clip on types.
A standard current transformer won't work, by definition they form a transformer around the wire they surround, and as transformers only work on AC......
From experience they are the worlds worst things to get reliable readings from with an arduino on AC too.
From a cheapskate point of view I'd stick a large wattage small value resistor in line to the battery and monitor the voltage either side of the resistor using a couple of analogue pins and a voltage divider on each to drop the voltage to what an arduino could measure. Since if you've already done one for the voltage out of the panel, you're half way there.
As already stated you have the current sensing resistor on the wrong lead of the solar panel, it needs to be on the ground lead side as I had clearly explained originally.
What you really need is an accurate system drawing made up to at least validate all the power and ground leads are properly wired to all the system components to see if the concept can be made to work.
Current measurement of what's happening to the system battery will be a little trickier as the current may be flowing into or out of the battery at different times. But I suggest you first get the system documentation up to snuff and get your basic solar panel measurements working.