Etruscian
Posts: 10
Joined: Wed Feb 13, 2013 12:52 pm
Location: Netherlands

Solar panel power output measurement with rpi

Wed Jun 11, 2014 1:14 pm

I've recently installed solar panels in my house and i'd like to use the raspberry pi to measure the power they produce. I've already got an ADC up and running on the pi (ABElectronics ADCPi v2.1). The program is also written to get a reading every 5 seconds and writing it to a file.

Since the voltage will always be 230V AC, the only thing the rpi needs to measure is the current flowing from the panels to the plug. I know how to make a current to voltage converter, but I'm only experienced with low voltage electronics.

What kind of circuit can i use to make sure the rpi doesn't get more than 4.5V on the analogue input (5V is max)? The whole circuit will be hooked up to a net voltage of 230V AC.

As safety precautions, I'm thinking of running the analogue input through a FET first, which will close the line if the voltage goes over ~4.5V. Any other things I should do to make sure the circuit is safe?
You might be disappointed when you fail, but you're doomed if you didn't even try

User avatar
Tage
Posts: 287
Joined: Fri May 24, 2013 2:29 am
Location: St Thomas, Ontario Canada

Re: Solar panel power output measurement with rpi

Wed Jun 11, 2014 2:04 pm

The solution will very much depend on how your solar panel system is configured. the simplest way to measure produced power would be to measure the voltage and current from the panels (dc). the measurement could be made by a separate micro controller and the data transmitted using wireless to your Pi. for example using Bluetooth.
if you have access only to the ac side it gets more complicated. you could just get an ac current transformer if you don't care about accuracy, and assuming that the current from the inverter is a sinewave and in phase with the voltage..
one way to limit input voltage to the measurement circuitry is to clamp the voltage with a zener. you will need some impedance in series with the signal source.

User avatar
RaTTuS
Posts: 10487
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: Solar panel power output measurement with rpi

Wed Jun 11, 2014 2:15 pm

who installed them?
is this UK
are they FIT units
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

Etruscian
Posts: 10
Joined: Wed Feb 13, 2013 12:52 pm
Location: Netherlands

Re: Solar panel power output measurement with rpi

Wed Jun 11, 2014 3:00 pm

@Tage I have access to both the AC and DC side, so i guess the dc side would be a lot safer. I completely forgot about that. Would it be best to measure the dc current with a hall sensor (wires are insulated), or should i put a small circuit in between?

@RaTTuS They are self installed in The Netherlands.
You might be disappointed when you fail, but you're doomed if you didn't even try

User avatar
BAStumm
Posts: 134
Joined: Fri Aug 23, 2013 3:37 pm
Location: Loon Lake, WA USA
Contact: Website

Re: Solar panel power output measurement with rpi

Wed Jun 11, 2014 3:20 pm

RPi has no analog input, you need an ADC expansion board.

What do you want to measure? Hall Effect Sensor measures current.

Edit: I should have read more... Get a hall sensor that outputs a mV signal proportional to your max amps. You should be able to find a sensor that is around 40mV/Amp. That will give you enough for 100A.

Etruscian
Posts: 10
Joined: Wed Feb 13, 2013 12:52 pm
Location: Netherlands

Re: Solar panel power output measurement with rpi

Wed Jun 11, 2014 3:37 pm

My only concern is the insulation around the wire. Would that be a matter of calibration or would it be easier to build a small circuit?
And I still need a solution for the dc voltage (resistor in parallel to bring the voltage down to max 4.5V?)
You might be disappointed when you fail, but you're doomed if you didn't even try

User avatar
BAStumm
Posts: 134
Joined: Fri Aug 23, 2013 3:37 pm
Location: Loon Lake, WA USA
Contact: Website

Re: Solar panel power output measurement with rpi

Wed Jun 11, 2014 3:55 pm

The insulation doesn't matter. Just watch the polarity of the donut, they only detect current flow in one direction. And I'm pretty sure there are current donuts for both AC and DC. Or are you wanting to read DC voltage?

Etruscian
Posts: 10
Joined: Wed Feb 13, 2013 12:52 pm
Location: Netherlands

Re: Solar panel power output measurement with rpi

Wed Jun 11, 2014 4:08 pm

Both DC current and DC voltage
You might be disappointed when you fail, but you're doomed if you didn't even try

User avatar
BAStumm
Posts: 134
Joined: Fri Aug 23, 2013 3:37 pm
Location: Loon Lake, WA USA
Contact: Website

Re: Solar panel power output measurement with rpi

Wed Jun 11, 2014 4:32 pm

What kind of DC Voltage and Amperage will you be reading? What is the max you want to rate for vs typical.

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Solar panel power output measurement with rpi

Wed Jun 11, 2014 6:14 pm

Really would help folks if you put up specs or links to the specs for parts of the system and how yours is configured.

I have previously done a solar panel monitor addon for 20V DC max and 10A DC max

Measuring the AC side is fraught with problems and it won't necessarily be 230V AC (RMS) it could well be anything to match the AC supply which has a wide tolerance +10% -6% when in spec and that is over at least one cycle to get the RMS. The instantaneous voltage may have all sorts of spikes and other issues.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

User avatar
Cancelor
Posts: 757
Joined: Wed Aug 28, 2013 4:09 pm
Location: UK

Re: Solar panel power output measurement with rpi

Wed Jun 11, 2014 6:30 pm

Etruscian wrote:@Tage I have access to both the AC and DC side, so i guess the dc side would be a lot safer. I completely forgot about that.
The DC side is probably 120V .... I'd be very careful with that :!:

Could you use one of these? >>> http://shop.openenergymonitor.com/100a- ... sensor-ct/
Image
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org

Etruscian
Posts: 10
Joined: Wed Feb 13, 2013 12:52 pm
Location: Netherlands

Re: Solar panel power output measurement with rpi

Wed Jun 11, 2014 8:51 pm

DC voltage is 75 to 230V, DC current is max 5A.
The AC side has 230V output with 2.17A max.

That clip would work for the AC side, not for the DC side.
You might be disappointed when you fail, but you're doomed if you didn't even try

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Solar panel power output measurement with rpi

Wed Jun 11, 2014 9:24 pm

Etruscian wrote:DC voltage is 75 to 230V, DC current is max 5A.
With two measurements taken (one voltage, before current, one current) you can work out power and many things. Easiest Voltage measurement is use 1% or better tolerance voltage divider so that at 250V it is still when divided down within ADC input range, BUT this will have to be done doing claculations based on the resistance values already on the board.

Please note the ADC board you are using is DIFFERENTIAL input so for single ended voltage measurements you may get issues due to resistance in negative input of each channel raising ADC negative above GND.

For current input it would be fairly easy to put a resistor inline with supply to get your measurements, but yet again the issues with existing input dividers will affect accuracy and needing to divide down approx 250V (with safety margin) down to +/- 2.048V at the ADC input.

Personally the effectively 18bit converter (ABElectronics ADCPi v2.1 using Microchip MCP3424) is overkill for what you are doing, an 8 bit converter (255 counts) could give you almost 1 ADC count for 1V steps, you have got upto 18 bits (262143 counts) which gives about 1048 max counts per volt step, or measuring down to mV resolution.

I would do the current measurement as either hall effect or resistor and voltage divider on both sides through a buffer amp to a lower spec ADC.at higher sampling rates. Even a PCF8591 powered from 3V3 and 2V5 voltage refernce would do the job easier.

The big issue is making sure your inputs are scaled down from approx 250V max to something like 2V5 range but overvoltage clamped to 3V3 or 5V would be easier and safer and give better headroom for the chips to survive overvoltage inputs.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Solar panel power output measurement with rpi

Wed Jun 11, 2014 9:49 pm

Update rechecked the circuit of the ADC board you are thinking of using and it is a DIFFERENTIAL ADC wired up so the inputs are SINGLE ENDED.

You WILL either need a hall effect sensor to measure current and porobably an op-amp stage to scale its output, or an external resistor and op-amp circuit to read current differentially to become single ended and that WILL need 0.1% or better resistors

All voltage and current measurement points still need to be scaled down from about 250V to ADC range

Unless they have used 0.1% or better tolerance on their voltage dividers you have a chance of channles not measuring accurately for the ranges they are using.
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

Etruscian
Posts: 10
Joined: Wed Feb 13, 2013 12:52 pm
Location: Netherlands

Re: Solar panel power output measurement with rpi

Thu Jun 12, 2014 11:06 am

Thanks for the informative post.

I'm thinking of getting a hall sensor for the current, that would be the safest.
For the voltage, wouldn't it suffice to use less accurate resistors and make a mapping which negates the differences? So see what the ADC reads, check with a multimeter (i know they aren't 100% accurate) on the bare open clamp circuit of the solar panels and adjust accordingly.

I know the ADC is an overkill, but i had it already laying somewhere.

Does the single ended differential inputs mean that it will measure the voltage in respect to an internally wired ground, or a reference voltage? Wouldn't measuring the voltage on the DC side be easier then, since there will be no negative component and thus no need to raise the average voltage to say 2v3?
You might be disappointed when you fail, but you're doomed if you didn't even try

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Solar panel power output measurement with rpi

Thu Jun 12, 2014 11:35 am

Etruscian wrote:Thanks for the informative post.

I'm thinking of getting a hall sensor for the current, that would be the safest.
May well need an op-amp scaling stage, as a resitor divider or other resistive means will have problems with the existing onboard resistor dividers.
For the voltage, wouldn't it suffice to use less accurate resistors and make a mapping which negates the differences? So see what the ADC reads, check with a multimeter (i know they aren't 100% accurate) on the bare open clamp circuit of the solar panels and adjust accordingly.
Using 1% resistors are cheap these days and usually have better temperature co-effiecents (ppm/deg C) than 5%. Mapping could be done but you would need an accurate and preferably calibrated multimeter and a stable source of at least 75V as reference, also you better do it at several ambient temperatures as they will vary. Each resistor will vary with temp slightly differently and the wider the initial tolerance the more marked the effects.
Does the single ended differential inputs mean that it will measure the voltage in respect to an internally wired ground, or a reference voltage? Wouldn't measuring the voltage on the DC side be easier then, since there will be no negative component and thus no need to raise the average voltage to say 2v3?
The negative sides of the ADC inputs are tied to GND, the same GND as the Pi, so all measurements are +/-5V range at the ADC connector relative to that GND. Most hall effects that have 5V o/p are raised anyway so positve current is from 2V5 to 5V, with no current being 2V5, you would need an op-amp stage with voltage reference to change that.

You will still need to drop the about 250V down to 5V but putting external resistors, you do not know what tolerance they have used for the ADC front end so hope they have used 1% or better. Rough calculations show you would need to put a 308k5 resistor in series as minimum to scale the Analog signals to 5V level from 250V. Using standard values like 300k or 330k will change the scaling dramatically, 300k would drop the max input voltage to approx 236V, upping to 330k will extend range to approx 260V.

To map the input ranges to ADC ranges you need to do an 18bit conversion (several probably averged to eliminate noise) for best resolution with at least 75 to 150V on the external resistor, so you got max number of bits active. This would have to be from a stable source. I have PSUs capable of 150V DC do you?
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Solar panel power output measurement with rpi

Thu Jun 12, 2014 11:39 am

Update When putting external resistors on these inputs, you really need to follow creepage and clearance distances for 230VDC so you would need something like 10mm between each wire and each resistor.

To aoid any effects of higher voltages near each other and not near lower voltage areas
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

Etruscian
Posts: 10
Joined: Wed Feb 13, 2013 12:52 pm
Location: Netherlands

Re: Solar panel power output measurement with rpi

Thu Jun 12, 2014 12:24 pm

Okay, so 1% resistors or less it is then.

I'm new to using hall sensors, so just to get a simple feel of them, what kind of output can i expect when i place them on a wire carrying 2A? (I know it depends on the type of the sensor, but is there a rough guideline?)

The hall sensor already gives 2V5 when not sensing any magnetic fields?

If 308k5 is optimal, wouldn't be 330k safer then? (more margin at the top so less likely to get overvolted).

The PSU is no problem, got access to one capable of over 500V. (perks of being a student at a technical university :D )
You might be disappointed when you fail, but you're doomed if you didn't even try

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Solar panel power output measurement with rpi

Thu Jun 12, 2014 12:43 pm

Etruscian wrote:I'm new to using hall sensors, so just to get a simple feel of them, what kind of output can i expect when i place them on a wire carrying 2A? (I know it depends on the type of the sensor, but is there a rough guideline?)
Best answer is read the data sheet, example circuits, characteristics curves etc.
The hall sensor already gives 2V5 when not sensing any magnetic fields?
Hall efect sensors are in most cases an electronic circuit (inside the IC) with o/p stages that already bias to mid-rail to allow for +/- current swings.
If 308k5 is optimal, wouldn't be 330k safer then? (more margin at the top so less likely to get overvolted).
Yes but do calculations based on actual values on your board the circuit says
10k and 6k5, which is a LOW impedance for an ADC front end (normally 1M or higher).. hence be careful connecting sensors and what the impedances are as the combined effect could cause over/under-volting and inaccuracy in your readings. It would have been better for them to use 1M and 650k or higher resistors.

Just start with voltage measurements then start testing current conversion circuits to add to the mix.

Remember all wiring and components on the 230V DC side will need lots of spacing and not Breadboard, the current sensor will need heavy track/wire.

Below is an image of a Pi add on I did for 20V DC and 10A monitoring, 2 x 20V DC voltage, 2 x 10A Current and 2 x 20V Switch inputs
Attachments
sfinalAssy.jpg
Solar Panel monitor
sfinalAssy.jpg (34.28 KiB) Viewed 4909 times
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: Solar panel power output measurement with rpi

Thu Jun 12, 2014 12:45 pm

BTW for accuracy on my current sensing the sense resistor was 0.01% tolerance and the input circuit used 0.1% tolerance resistors.

The current sensors are the large black items standing up top right of image
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

Return to “Automation, sensing and robotics”