Solar Energy and Power Systems¶
Summary¶
This chapter covers solar energy as the most economically and environmentally compelling power source for hydroponic operations: the photovoltaic effect, solar cell types and efficiencies, MPPT charge controllers, battery storage technologies (lead-acid vs. LiFePO₄), off-grid and grid-tie system design, net metering, power monitoring with the INA219 sensor, energy audits for grow rooms, real-time energy dashboards with Plotly, and levelized cost of energy calculations — giving students the tools to evaluate whether solar makes economic sense for a specific grow operation.
Concepts Covered¶
This chapter covers the following 29 concepts from the learning graph:
- Solar Energy Basics
- Photovoltaic (PV) Effect
- Solar Cell Types
- Solar Panel Efficiency
- Solar Panel Watt-Peak (Wp)
- Solar Irradiance W/m²
- Peak Sun Hours
- Solar Panel Output Calculation
- Solar Panel Cost Trends
- Levelized Cost of Energy (LCOE)
- MPPT Max Power Point Tracking
- Charge Controller PWM vs MPPT
- Battery Storage Basics
- Lead-Acid Battery
- Lithium Iron Phosphate LiFePO4
- Battery State of Charge
- Battery Sizing for Grow Room
- Inverter Selection Off-Grid
- Grid-Tie Solar System
- Net Metering
- Off-Grid Solar System Design
- Hybrid Grid and Battery System
- Solar for Grow Lights
- Solar for Pumps and Sensors
- Power Monitoring With INA219
- Energy Audit for Grow Room
- Energy Dashboard With Plotly
- Carbon Footprint Indoor Growing
- Microinverter Technology
Prerequisites¶
This chapter builds on concepts from:
- Chapter 10: Lighting Science
- Chapter 15: Sensors and Electronics Hardware
- Chapter 17: Data Visualization and Process Control
Cress harnesses the sun
Welcome to Chapter 19, growers! Energy is the hidden cost of indoor growing — grow lights, pumps, and climate control can make electricity the largest operating expense in a controlled-environment farm. This chapter shows you how to measure your energy use, reduce it, and potentially power your entire operation with sunlight. We'll go from the physics of the photovoltaic effect to the engineering of an off-grid system to the economics of LCOE — and build a real-time energy dashboard along the way. Let's grow something amazing — powered by the sun!
Solar Energy Basics and the Photovoltaic Effect¶
The sun delivers energy to Earth's surface at an average rate of approximately 1000 W/m² on a clear day at solar noon — this is called the solar irradiance or insolation at standard test conditions. A square meter of Earth's surface receives about as much power as a toaster oven.
Solar energy in the context of electricity generation refers to converting this radiant energy to electrical energy using the photovoltaic (PV) effect: when photons (light particles) with sufficient energy strike a semiconductor material, they knock electrons free from their atomic bonds, creating an electron flow — direct current (DC) electricity.
The PV effect occurs at the junction between two types of semiconductor material (typically silicon):
- n-type silicon: doped with phosphorus to create excess electrons
- p-type silicon: doped with boron to create excess "holes" (electron vacancies)
At the p-n junction, an electric field forms that drives freed electrons in one direction when photons strike — creating a voltage difference. A single silicon solar cell produces approximately 0.5–0.6 V. Multiple cells connected in series form a solar panel (also called a solar module) producing useful voltages of 12 V, 24 V, or 48 V.
Solar Cell Types and Efficiency¶
Three solar cell technologies dominate the market, each with different efficiency, cost, and manufacturing processes. Efficiency is the fraction of incident solar energy converted to electricity. Before comparing them, note that all efficiency values are measured at Standard Test Conditions (STC): 1000 W/m² irradiance, 25 °C cell temperature.
| Cell Type | Efficiency Range | Cost (2024) | Advantages |
|---|---|---|---|
| Monocrystalline silicon | 20–24% | ~$0.25/Wp | Highest efficiency, longest lifespan |
| Polycrystalline silicon | 16–19% | ~$0.20/Wp | Lower cost, slightly lower efficiency |
| Thin-film (CdTe, CIS) | 10–13% | ~$0.18/Wp | Flexible, lower energy to manufacture, performs better in diffuse light |
For most hydroponic installations, monocrystalline panels are the best value — the higher efficiency means fewer panels are needed for the same power output, reducing mounting hardware and space requirements.
Solar Panel Watt-Peak (Wp) and Output Calculation¶
Watt-peak (Wp) is the rated output power of a solar panel at STC. A "300 Wp panel" produces 300 W under STC. In real-world conditions, output is lower due to:
- Temperature: panels lose ~0.4% efficiency per °C above 25 °C. In summer, a panel at 65 °C produces ~16% less than its STC rating.
- Shading: even partial shading of one cell significantly reduces output (bypass diodes mitigate this in modern panels)
- Dust and soiling: 2–5% loss without periodic cleaning
- Wire losses: typically 2–3%
Solar panel output calculation:
To estimate daily energy production, the key concept is peak sun hours (PSH) — the equivalent number of hours per day at 1000 W/m² that represents the actual daily solar irradiance at a location. A location that receives 4 PSH means the total daily irradiance is equivalent to 4 full hours at maximum sun.
Where:
| Symbol | Unit | Definition |
|---|---|---|
| E_daily | Wh (watt-hours) | Estimated daily electrical energy produced by the solar panel array |
| P_panel | Wp (watts-peak) | Panel rated peak power at standard test conditions (1000 W/m², 25 °C) |
| PSH | hours | Peak sun hours; daily solar irradiance expressed as equivalent hours at 1000 W/m²; varies by location and season |
| η_system | dimensionless (0–1) | Total system efficiency; accounts for inverter, battery, and wiring losses; typically 0.75–0.85 |
Example: A 400 Wp panel in Minneapolis (4.2 PSH annual average) with 80% system efficiency:
Solar Panel Cost Trends¶
Solar panel costs have fallen approximately 90% since 2010, from ~\(2.50/Wp to ~\)0.25/Wp in 2024. This cost trajectory makes solar compelling for new hydroponic installations: the panel cost for a 1 kWp system has dropped from \(2,500 to ~\)250. The remaining system costs (inverter, mounting, wiring, labor) are now the dominant cost, not the panels themselves.
MPPT and Charge Controllers¶
MPPT: Maximum Power Point Tracking¶
A solar panel's power output is not constant with changing load — it has a maximum power point (MPP) where the product of current × voltage is maximized. An MPPT controller continuously adjusts the electrical load seen by the panel to keep it operating at its MPP regardless of changing sunlight, temperature, or battery state.
Before we compare MPPT to PWM, two terms: PWM (Pulse Width Modulation) charge controllers simply switch the panel connection on and off rapidly to control average charging current — they waste the voltage difference between the panel's open-circuit voltage and the battery voltage. MPPT controllers convert the panel's higher voltage to a lower voltage at proportionally higher current, extracting 15–30% more energy than PWM controllers.
Charge Controller Comparison¶
| Feature | PWM Controller | MPPT Controller |
|---|---|---|
| Efficiency | ~70–80% | ~93–99% |
| Panel flexibility | Must match battery voltage | Panel voltage independent of battery |
| Cost | \(15–\)50 | \(50–\)300+ |
| Best for | Small systems (<200 Wp) | Larger systems or high-voltage panels |
| Energy harvest gain | Baseline | 15–30% more than PWM |
For hydroponic grow room applications — even small ones — an MPPT controller is recommended. The increased energy harvest pays for the additional cost within the first year.
Battery Storage¶
Battery Technology Overview¶
Solar power is intermittent — the sun doesn't shine at night. Battery storage is required for any system that must operate continuously (pumps, sensors, climate control). Two battery chemistries dominate for solar storage in hydroponic applications.
Lead-Acid Battery¶
Lead-acid batteries are the oldest rechargeable battery technology (invented 1859) and remain the lowest cost option:
- Energy density: 30–40 Wh/kg (heavy for their energy content)
- Cycle life: 300–1000 deep discharge cycles (depending on depth of discharge)
- Depth of discharge (DoD): Should not be regularly discharged below 50% — deeper discharge accelerates plate sulfation and reduces lifespan dramatically
- Cost: ~$100–150/kWh installed
- Self-discharge: 3–5% per month
- Temperature sensitivity: Significant capacity loss below 0 °C
For small-scale hydroponic systems in temperature-controlled environments, AGM (Absorbent Glass Mat) sealed lead-acid batteries are practical: maintenance-free, spill-proof, and widely available.
Lithium Iron Phosphate (LiFePO4)¶
LiFePO4 (Lithium Iron Phosphate, sometimes written LFP) is the emerging standard for solar storage due to its exceptional cycle life and safety profile:
- Energy density: 90–120 Wh/kg (significantly lighter than lead-acid)
- Cycle life: 2000–4000+ cycles at 80% DoD
- Depth of discharge: Can safely discharge to 90–100% without lifespan damage
- Cost: ~$250–400/kWh (2024); falling rapidly
- Self-discharge: <3% per month
- Safety: No thermal runaway risk (unlike NMC lithium); no toxic hydrogen gas venting like lead-acid
- Temperature sensitivity: Moderate; must not be charged below 0 °C without heated BMS
LiFePO4 batteries cost 2–3× more than lead-acid upfront but last 4–10× longer and deliver 90% of rated capacity vs. 50% for lead-acid. Total cost of ownership over 10 years strongly favors LiFePO4 for any system used regularly.
Battery State of Charge and Sizing¶
State of Charge (SoC) is the percentage of battery capacity currently available. Monitoring SoC prevents over-discharge (damaging for lead-acid) and allows the controller to manage loads intelligently.
Battery sizing for a grow room requires knowing the daily energy consumption (the energy audit, covered below) and the desired days of autonomy — how many cloudy days the system should run without solar input.
Battery sizing formula:
Where:
| Symbol | Unit | Definition |
|---|---|---|
| C_battery | Ah (ampere-hours) | Required battery bank capacity at the system voltage |
| E_daily | Wh | Daily energy consumption of all loads (pumps, lights, sensors, climate) |
| D_autonomy | days | Desired days of operation without solar input; typically 1–3 days for a grow room |
| DoD | dimensionless (0–1) | Maximum depth of discharge; 0.5 for lead-acid (50%), 0.9 for LiFePO4 (90%) |
| V_system | V (volts) | System bus voltage; typically 12, 24, or 48 V |
| η_battery | dimensionless (0–1) | Battery round-trip efficiency; ~0.85 for LiFePO4, ~0.80 for lead-acid |
Example: A grow room consuming 1,500 Wh/day, with 2 days autonomy, LiFePO4 at 24 V:
A 200 Ah 24 V LiFePO4 bank provides adequate margin.
Grid-Connected and Off-Grid Systems¶
Off-Grid Solar System Design¶
An off-grid system has no utility grid connection — it relies entirely on solar panels and battery storage. This is appropriate for hydroponic operations in rural areas, greenhouses away from grid infrastructure, or systems designed for energy independence.
Off-grid design checklist:
- Complete energy audit (see below)
- Size battery bank (formula above)
- Size solar array: \( P_{array} = E_{daily} / (PSH \times \eta_{system}) \)
- Select MPPT charge controller rated for array voltage and current
- Select inverter: pure sine wave at 1.5–2× peak load power
- Wire protection: fuses or circuit breakers on all battery connections
Grid-Tie Solar System¶
A grid-tie system connects to the utility grid and uses the grid as an "infinite battery" — excess solar production exports to the grid, and the grid supplies power when solar is insufficient. Grid-tie systems do not require battery storage for normal operation.
Net Metering¶
Net metering is the billing arrangement that allows grid-tie solar customers to "bank" excess production. When your panels produce more than you consume, the excess feeds the grid and runs your electricity meter backwards — you receive credit at the retail electricity rate.
Net metering economics depend heavily on local utility policy. In states with full retail net metering, payback periods for grid-tie systems are typically 5–8 years. In states that compensate excess production at the much lower wholesale rate, payback periods can be 10–15 years.
Hybrid Grid and Battery System¶
A hybrid system combines grid connection with battery storage. In normal operation, solar charges the battery and powers loads; when solar is insufficient, grid power supplements. During a grid outage, the battery provides backup power for critical loads (pumps, sensors, lighting). This is the optimal configuration for commercial hydroponic operations that cannot tolerate outages.
Microinverter Technology¶
Traditional string inverters connect all panels in series — if one panel is shaded, the output of the entire string is reduced. Microinverters attach to each panel individually, converting that panel's DC output to AC independently. Benefits:
- Each panel operates at its own MPP regardless of shading on other panels
- Per-panel monitoring reveals underperforming panels immediately
- System can expand one panel at a time
- Higher cost per watt but better performance in partially-shaded installations
For indoor grow room installations with consistent, unshaded lighting, string inverters are adequate. For rooftop arrays with potential shading from chimneys, trees, or other obstructions, microinverters or DC power optimizers are worth the additional cost.
Solar for Hydroponic Loads¶
Solar for Grow Lights¶
Grow lights are the dominant electrical load in most indoor hydroponic operations — typically 40–70% of total energy consumption. A single 600 W LED grow light running 16 hours/day consumes 9.6 kWh/day. At $0.15/kWh (US average retail electricity), this costs $1.44/day or $43/month per light.
Solar can offset this cost, but the panel area required is substantial. Using our earlier formula:
- To supply 9.6 kWh/day of lighting in Minneapolis (4.2 PSH, 80% efficiency): requires approximately 2,857 Wp of panels — roughly 8–10 standard 300 Wp panels.
This is the economic case for choosing efficient LED fixtures (Chapter 10): a fixture with 50% higher efficiency requires 50% fewer solar panels to offset — a multiplied benefit.
Solar for Pumps and Sensors¶
Pumps and sensors are a much smaller load than grow lights. A typical hydroponic pump system (water pump + air pumps + sensor node) might consume 50–100 W continuously, or 1.2–2.4 kWh/day. A single 400 Wp panel in a 4 PSH location can supply this comfortably.
For off-grid sensor nodes or remote monitoring stations, low-power design is critical: - Use deep sleep cycles on the microcontroller (Chapter 14) - Select efficient water pumps (DC brushless motors draw 10–30 W vs. 40–80 W for AC pumps) - Use LED indicator lights, not incandescent
Power Monitoring with INA219¶
The INA219 is a high-side DC power monitor — a small I2C-connected chip that measures voltage, current, and power simultaneously. For a solar-powered hydroponic system, the INA219 provides real-time visibility into energy flows: how much power the solar panels are generating, how much the grow lights are consuming, and the battery's charge state.
The INA219 uses a precision shunt resistor (0.1 Ω typical) in series with the load. It measures the voltage drop across the shunt and computes current: \( I = V_{shunt} / R_{shunt} \). The chip then reports current (mA), bus voltage (V), and power (mW) over I2C.
from machine import I2C, Pin
import utime
class INA219:
def __init__(self, i2c, address=0x40):
self.i2c = i2c
self.addr = address
self._configure()
def _configure(self):
# Configure for 32V bus, ±2A range, 12-bit resolution
config = 0x3FFF
self.i2c.writeto_mem(self.addr, 0x00,
bytes([config >> 8, config & 0xFF]))
def read_voltage(self):
data = self.i2c.readfrom_mem(self.addr, 0x02, 2)
raw = (data[0] << 8 | data[1]) >> 3
return raw * 0.004 # 4 mV per LSB
def read_current_ma(self):
data = self.i2c.readfrom_mem(self.addr, 0x04, 2)
raw = data[0] << 8 | data[1]
if raw > 32767:
raw -= 65536
return raw * 0.1 # 0.1 mA per LSB (with 0.1 Ω shunt)
def read_power_mw(self):
return self.read_voltage() * self.read_current_ma()
i2c = I2C(0, sda=Pin(4), scl=Pin(5))
ina = INA219(i2c)
voltage = ina.read_voltage()
current_ma = ina.read_current_ma()
power_mw = ina.read_power_mw()
print(f"Solar input: {voltage:.2f}V, {current_ma:.0f}mA, {power_mw/1000:.2f}W")
Energy Audit for Grow Room¶
An energy audit inventories every electrical load in the grow room, estimates its operating hours per day, and calculates daily energy consumption. This is the foundation for solar sizing and cost calculations.
| Load | Rated Power (W) | Hours/Day | Daily Energy (Wh) |
|---|---|---|---|
| LED grow light (600W) | 600 | 16 | 9,600 |
| Water pump (recirculating) | 30 | 24 | 720 |
| Air pump (2×) | 10 | 24 | 240 |
| Circulation fan | 15 | 20 | 300 |
| Exhaust fan | 50 | 12 | 600 |
| Sensor node (Pico W) | 2 | 24 | 48 |
| OLED display | 0.5 | 24 | 12 |
| Total | 11,520 Wh/day |
This audit shows that the grow light dominates at 83% of total energy. Replacing a 600 W LED fixture with a 300 W equivalent (same PPFD, higher efficiency) cuts total energy consumption by approximately 40%.
Levelized Cost of Energy (LCOE)¶
LCOE (Levelized Cost of Energy) expresses the lifetime cost of a power generation system as a cost per kWh of electricity produced, accounting for capital cost, operating cost, and system lifespan. LCOE allows apples-to-apples comparison between solar and grid electricity.
Before the formula, key terms: CapEx (capital expenditure) is the upfront system cost; OpEx (operating expenditure) is the annual maintenance cost; lifetime is the system lifespan in years; annual production is the yearly energy output.
Where:
| Symbol | Unit | Definition |
|---|---|---|
| LCOE | $/kWh | Levelized Cost of Energy; lifetime cost per kilowatt-hour of electricity produced |
| CapEx | $ | Capital expenditure; total upfront cost of the solar system (panels, inverter, mounting, wiring) |
| OpEx_t | $/year | Operating expenditure in year t; annual maintenance, insurance, and replacement costs |
| E_t | kWh/year | Actual energy production in year t |
| r | dimensionless (decimal) | Discount rate; the opportunity cost of capital; e.g., 0.06 for 6% per year |
| n | years | System lifetime; typically 25–30 years for photovoltaic systems |
| t | years | Year index in the summation (1 to n) |
For a simplified estimate (ignoring discount rate):
Where:
| Symbol | Unit | Definition |
|---|---|---|
| LCOE | $/kWh | Approximate levelized cost of energy (ignores time value of money) |
| CapEx | $ | Total upfront system cost |
| OpEx | $/year | Annual operating and maintenance cost (assumed constant across all years) |
| n | years | System lifetime |
| E_annual | kWh/year | Average annual energy production |
Example: A 3 kWp solar system for a grow room: - CapEx: $3,000 (panels) + $1,000 (inverter/controller/battery) = $4,000 - Annual OpEx: $50 (minimal maintenance) - System lifetime: 25 years - Annual production: 3,000 Wp × 4.2 PSH × 0.80 × 365 = 3,679 kWh/year
At $0.057/kWh, this solar system produces electricity at less than half the US average retail grid price of $0.15/kWh — a compelling economic case.
Energy Dashboard With Plotly¶
Building on Chapter 17's Dash framework, a real-time energy dashboard displays solar generation, load consumption, battery state, and cumulative energy cost savings:
from dash import Dash, dcc, html, Input, Output
import plotly.graph_objects as go
import pandas as pd
app = Dash(__name__)
app.layout = html.Div([
html.H2("Grow Room Energy Dashboard"),
dcc.Graph(id="energy-chart"),
dcc.Graph(id="power-gauge"),
dcc.Interval(id="interval", interval=30_000)
])
@app.callback(
Output("energy-chart", "figure"),
Input("interval", "n_intervals")
)
def update_energy(n):
df = pd.read_csv("energy_log.csv",
names=["timestamp", "solar_w", "load_w", "battery_v"])
df["datetime"] = pd.to_datetime(df["timestamp"], unit="s")
df["net_w"] = df["solar_w"] - df["load_w"]
fig = go.Figure()
fig.add_trace(go.Scatter(x=df["datetime"], y=df["solar_w"],
name="Solar Generation (W)", fill="tozeroy",
line=dict(color="orange")))
fig.add_trace(go.Scatter(x=df["datetime"], y=df["load_w"],
name="Load Consumption (W)",
line=dict(color="steelblue")))
fig.update_layout(title="Real-Time Energy Flow", yaxis_title="Power (W)")
return fig
Carbon Footprint of Indoor Growing¶
The carbon footprint of electricity-powered indoor growing depends entirely on the carbon intensity of the electrical grid in your region. In the US, the average grid emits approximately 0.4 kg CO₂ per kWh. A grow room consuming 11.5 kWh/day would emit:
A solar-powered grow room producing that electricity with near-zero carbon intensity (PV manufacturing lifecycle: ~0.02–0.04 kg CO₂/kWh) reduces the per-cycle footprint from 161 kg to approximately 10–14 kg CO₂ — a 90%+ reduction. This is the environmental case for solar-powered hydroponics.
Diagram: Solar Power System Designer¶
Interactive Solar Power System Designer for Hydroponics
Type: engineering-calculator
sim-id: solar-power-designer
Library: p5.js
Status: Specified
Purpose: Allow students to design a solar power system for their specific hydroponic operation by entering energy loads, location (peak sun hours), and battery preferences, then see panel count, battery size, estimated cost, and LCOE automatically calculated.
Bloom Level: Apply (L3) and Evaluate (L5) Bloom Verb: Design — students iteratively modify system parameters and observe how each decision affects sizing, cost, and LCOE.
Layout: Canvas 900×540. Three-column layout:
Left column (Energy Audit): - Table with editable rows: Load name | Watts | Hours/Day - Pre-populated with: LED Light, Water Pump, Air Pump, Circulation Fan, Sensor Node - "Add Load" button adds a new row - Total daily Wh shown at bottom
Center column (System Parameters): - Location: dropdown (Miami 5.6 PSH, Los Angeles 5.5, Denver 5.1, Minneapolis 4.2, Seattle 3.2, Custom) - Battery type: Lead-Acid / LiFePO4 toggle - Days of autonomy: slider (1–5) - System voltage: radio buttons (12V / 24V / 48V) - Panel watt-peak: slider (200–600 Wp)
Right column (Results): - Required panel count (integer, rounded up) - Required battery capacity (Ah at selected voltage) - Estimated system cost (US \() - LCOE (\)/kWh) - Payback period vs. grid at \(0.15/kWh (years) - Monthly cost savings (\))
Below all columns: Stacked bar chart showing energy load breakdown by category (lighting, pumping, sensing, climate) in Wh/day.
Interactivity: All inputs update the right column results and chart in real-time. Hovering the stacked bar chart shows the exact Wh and percentage for each category. "Export Report" button downloads a plain-text system design summary.
Key Takeaways¶
- Solar irradiance reaches approximately 1000 W/m² at Earth's surface at solar noon; peak sun hours (PSH) quantify the daily energy equivalent and vary from 3 (overcast climates) to 6+ (desert climates).
- Monocrystalline silicon panels (20–24% efficiency) offer the best value for fixed installations; panel costs have fallen 90% since 2010 to ~$0.25/Wp.
- MPPT charge controllers extract 15–30% more energy from panels than PWM controllers by continuously tracking the maximum power point.
- LiFePO4 batteries offer 4–10× longer cycle life than lead-acid at comparable or lower total cost of ownership, and can safely discharge to 90% vs. 50% for lead-acid.
- Battery sizing requires knowing daily energy consumption, desired days of autonomy, maximum depth of discharge, and system voltage.
- Off-grid systems rely entirely on solar + battery; grid-tie systems use the utility as a backup and net metering to bank excess production.
- Microinverters improve performance in partially shaded arrays; string inverters are adequate for unshaded indoor or rooftop arrays.
- Grow lights dominate hydroponic energy consumption (40–70%); selecting efficient LED fixtures directly reduces the solar array and battery size required.
- INA219 (I2C, MicroPython) monitors real-time solar generation and load consumption with milliamp accuracy on any DC circuit up to 32 V, 3.2 A.
- LCOE for a well-designed residential solar system is typically \(0.05–\)0.08/kWh — significantly lower than retail grid electricity in most US states.
Chapter 19 complete — your grow room runs on sunshine!
You've designed, sized, and costed a solar power system for a real hydroponic operation — and built the energy dashboard to monitor it live. Chapter 20 scales everything up: multi-tier vertical farms, robotics, AI crop management, container farms, food mile calculations, and the commercial operations that are reshaping urban food supply chains. The future of food is vertical — let's build it!