# Measure power of solar cell with an ESP8266

Scenario
I plan to buy some bigger solar cells (together around 500 W) and use them to make my electricity bill cheaper. In order to find the perfect location on my roof before the purchase, I thought about placing an ESP8266 on my roof with a small 0.21 W solar cell that sends the power data every hour to my phone.

This way, I can leave my ESP on a certain location for a few days and check the data. After, let's say, a week, I will place it on a different location and check the data as well. After a few weeks, I should find the perfect location for the bigger cells. I know that this is just a reference and won't be that accurate.

Material

• ESP8266
• 3 V and 70 mA solar cell (= 0.21 W)
• a few resistors

Ideas for implementation
My idea is to short-circuit the solar cell all the time and measure the current with a known resistor from the voltage drop across it. Additionally, I can measure the voltage by simply using one of the analog pins and converting the analog value into a real voltage. After that, I can multiply the current and the voltage and have the power (Watt) sent to my phone every hour.

Questions

1. Is it accurate enough to use a resistor for measuring current?
2. Will a permanent short-circuit damage my solar cell?
3. Is the voltage during a short circuit the same as without a load or will it decrease?

(3) would make this whole project useless because I don't have accurate voltage values and so also a wrong measurement for the power.

• I don't want to rob you of your project, but isn't it much easier to find a shade-free spot facing geographic south (or slightly off if you want more power in the morning or in the afternoon), and use an angle calculator like solarelectricityhandbook.com/solar-angle-calculator.html to find the optimal angle for your panels? Commented Nov 3, 2020 at 17:48
• Yeah, that may be true but do not answer my questions ;) I know that this is kind of a stupid project, but I really want to build it just to learn something new Commented Nov 4, 2020 at 7:08
• esp8266 has only one ADC pin and it reads 0 to 1 V. the ADC is shared with WiFi signal strength evaluation so a heavy use of A pin disrupts WiFi operation Commented Nov 4, 2020 at 9:46
• @Juraj, I got the point, but my plan was to read the pin, wait 0.1 seconds and then send the data via wifi so there won't be any distractions. Commented Nov 4, 2020 at 13:35
• and the 1 V max? Commented Nov 4, 2020 at 14:15

To measure power you need to measure both voltage and current. The maximum power a solar panel delivers depends on the resistance of the load; different measuring resistors will show different power readings.

• That said, yes, you can use a resistor to measure current, but it takes a bit of work to make it accurate.

• Shorting a single panel is OK; they normally operate at near their short-circuit current anyway. Note that if you have a measuring resistor attached, the panel won't be short-circuited anymore.

• The voltage won't be the same as without a load; the open voltage is higher than the normal operating voltage, and a shorted solar panel will show even less: 0 V.

You could try the following: find out the MPP of your small measuring solar panel; it should be in the specifications somewhere. It will show the voltage V and current I at maximum power, or at its normal operating point; terms used may differ.

Use those two values and $$\\small R \normalsize = {V \over I}\$$ to calculate a resistor value. This resistor will put the panel at or near its MPP. Use $$\\small P = V \cdot I\$$ to decide what wattage the resistor should be.

Use an INA260 measuring sensor module or some such in series with the resistor to measure current and voltage; it connects with the ESP8266 over I2C.

The INA260 actually uses a very small resistor to measure current, as you planned to do, but its resistance value on its own is so small it would almost short the panel which would give you useless voltage readings close to 0 V.

I wouldn't bother with the ESP8266's ADC (it's a pain to use and not very good), but just use the ESP8266 to read the values the INA260 sends over I2C, and then send them on to wherever you want them.

• So, it's not really possible to measure current and voltage at the same time without an external module due to the low/no voltage during short circuit? Commented Nov 5, 2020 at 18:05
• Not impossible, no. You could calculate a load resistor as described above, and split it up to make a voltage divider. Let's say you calculate 42Ω for the load resistor. For the current measurement, you want the maximum current the panel can deliver, say 70mA, to drop 1V for measuring with your ADC. This requires a resistor of about 14Ω. You can now put a 14Ω and a 28Ω resistor in series as the 42Ω load, and measure the voltage across the 14Ω resistor to calculate the current, and to calculate the voltage across the total resistance of 42Ω. Commented Nov 5, 2020 at 19:25