Accurate measurement of solar irradiance is one of the most critical steps in solar photovoltaic system design, performance evaluation, and educational experimentation. Solar irradiance directly determines how much electrical power a solar panel can generate at a given location, tilt, and orientation. While professional irradiance meters and pyranometers provide high accuracy, they are often expensive, bulky, and inaccessible to students, hobbyists, and small-scale solar installers.
The DIY Solar Power Meter was developed to address this gap by offering a compact, low cost, and portable solution that can be used for quick field measurements, educational demonstrations, and experimental solar studies. The project focuses on practicality rather than laboratory-grade precision, providing sufficiently accurate readings for comparative analysis, panel alignment, and real-world learning.
This device combines a calibrated solar cell for irradiance estimation with orientation sensing for tilt and azimuth, all integrated into a handheld, battery-powered unit with a real-time OLED display. The complete system is built using widely available components and programmed using the Arduino platform, making it easy to understand, modify, and reproduce.
System Overview:The DIY Solar Power Meter is built around an ESP32 microcontroller, which serves as the central processing unit for sensor data acquisition, calculations, and display control. The ESP32 was selected for its low power consumption, strong processing capability, and wide support within the Arduino ecosystem.
A precision current and voltage monitoring IC measures the electrical output of the solar cell. The short-circuit current is calculated from these measurements and converted into an irradiance value using a calibration constant derived from real outdoor testing.
To support proper solar panel alignment, the system also includes a combined accelerometer and magnetometer module. This sensor provides real-time tilt and azimuth readings, allowing the user to orient the device toward the sun or align solar panels accurately.
All data is displayed on a compact OLED screen, ensuring excellent readability even under bright outdoor conditions. A single button interface allows the user to navigate between display modes, keeping the user interaction simple and intuitive.
Solar Irradiance MeasurementThis irradiance meter works on the short-circuit current (Isc) principle.
A silicon solar cell produces current proportional to the sunlight falling on it. At Standard Test Conditions (STC), 1000 W/m² of irradiance produces a known short-circuit current.
The irradiance is calculated using:
Irradiance (W/m²) = (Measured Isc / Rated Isc) × 1000
Because this method directly uses a solar cell, it naturally:
- Matches the solar spectrum
- Exhibits good cosine response
- Correlates well with actual PV performance
In this irradiance meter, a silicon solar cell is used as the primary sensing element to measure solar irradiance by exploiting the direct relationship between incident sunlight and the short-circuit current generated by the cell. Unlike optical light sensors, this method closely represents the behavior of actual photovoltaic modules and therefore provides physically meaningful measurements for solar applications.
The solar cell is operated under controlled short-circuit conditions using a MOSFET-based switching arrangement. The MOSFET is placed in the current path between the solar cell and the current sensing circuit, allowing the microcontroller to electrically connect or disconnect the solar cell as required. When the MOSFET is turned ON, the solar cell terminals are effectively shorted through the shunt resistor and the INA226 current measurement input, enabling accurate measurement of the short-circuit current. When the MOSFET is turned OFF, the solar cell is electrically isolated, preventing unnecessary current flow and reducing idle power consumption.
The generated short-circuit current flows through the INA226 current sensor and send to MCU for further processing. The electrical connection of the solar cell, MOSFET, and INA226 is shown in the schematic.
At Standard Test Conditions (STC), an irradiance of 1000 W/m² corresponds to the rated short-circuit current of the solar cell. By comparing the measured short-circuit current with the rated Isc value, the incident irradiance is computed in firmware.
Short Circuit Current Measurement
The short-circuit current flowing from the solar cell passes through a precision shunt resistor, across which a small differential voltage is developed. This voltage is measured by the INA226 current sensor, which measures high-resolution digital current data via the I2C interface. The current value is internally calculated by the INA226 using the measured shunt voltage and the known shunt resistance. The corresponding solar cell, MOSFET, and INA226 connections are shown in the schematic.
At Standard Test Conditions, an irradiance of 1000 W/m² corresponds to the rated short-circuit current of the selected solar cell. The firmware computes irradiance by normalizing the measured Isc against this rated value. Because the measurement is performed under controlled short-circuit conditions and with precision current sensing, the resulting irradiance values are stable, repeatable, and closely correlated with real photovoltaic module behavior.
Tilt and Azimuth Measurement
In this design, both tilt and azimuth are measured using the GY-511 sensor module, which is based on the LSM303DLHC. This module combines a 3-axis accelerometer and a 3-axis magnetometer, allowing the device to determine its inclination as well as its compass direction.
Tilt MeasurementWhen the device is stationary, the accelerometer mainly senses gravity. The sensor provides three acceleration values:
ax, ay, and az, representing gravity components along the X, Y, and Z axes.
From these values, the program calculates pitch and roll using trigonometric relationships (as shown in the diagram above).
- Pitch represents forward or backward tilt
- Roll represents left or right tilt
During calibration, the device is placed flat and the corresponding pitch and roll values are stored as zero references. These offsets are subtracted from future readings to remove mounting and alignment errors. A second reference angle, such as 90 degrees, is then used to calculate a scale factor to improve accuracy.
The final tilt angle displayed on the OLED is calculated by combining pitch and roll into a single value:
Tilt Angle = sqrt( Pitch*Pitch + Roll*Roll )
This gives a clear indication of how much the device deviates from a perfectly level position.
Azimuth (Compass Direction)The magnetometer inside the GY-511 measures the Earth’s magnetic field along the X and Y axes. From these values, the program calculates the azimuth angle, which represents the direction the device is facing relative to magnetic north.
The azimuth value is displayed like a digital compass, helping the user align the irradiance meter toward the desired direction, such as true south or true north, depending on the installation practice.
PCB Design
The PCB for the solar irradiance meter is designed to be compact and low-noise to ensure accurate measurement of the solar cell short-circuit current.
- The layout is divided into functional blocks: power supply, current measurement, microcontroller, and I2C peripherals, which helps reduce noise and simplifies routing.
- The solar current path from the solar cell through the MOSFET, and INA226 is kept short with wide copper traces to minimize unwanted resistance.
- The XC6220 LDO regulator and its capacitors are placed close together to provide a clean and stable 3.3 V supply.
- I2C lines for the OLED and accelerometer are kept short and routed away from the current path to ensure reliable communication.
- The battery voltage sensing divider is placed near the MCU ADC pin for stable battery readings.
- Push button, and mounting holes are positioned to align with the enclosure and allow easy access.
The PCB assembly includes a combination of SMD components, through-hole (TH) components, and header pins for mounting external modules. Small resistors, capacitors, and other parts such as the LDO regulator and MOSFET are implemented as SMD components to keep the board compact and neat.
Modules such as the INA226 current sensor and LIS3DH tilt sensor are mounted on the PCB using header pins, which allows easy replacement, testing, and future upgrades.
The SMD components were soldered using a Miniware MH50 hot plate, which provides precise temperature control and is well suited for soldering small pads and fine components.
After completing the SMD assembly, a standard soldering iron was used to solder the through-hole components, including the header pins and the power switch.
Prepare the INA226 Current SensorOn the INA226 module, desolder the pre-soldered R100 (0.1 Ω) shunt resistor carefully using a soldering iron or hot air.
Solder an R500 (0.5 Ω) shunt resistor in place of the original R100. Ensure the resistor is firmly seated and the solder joints are clean.
Cut two short pieces of 22 AWG wire and solder them to the IN+ and IN− terminals of the INA226 module. These wires will carry the short-circuit current from the solar cell.
Solder the free ends of these two wires to the corresponding pads on the main PCB.
Finally, mount the INA226 module onto the PCB, making sure the orientation is correct and all pins are properly seated.
3D Printed EnclosureThe enclosure for this irradiance meter is designed in Autodesk Fusion 360 and fully customized to fit the PCB, solar cell, and user interface ( Button and OLED display). To keep the design modular and easy to assemble, the enclosure is split into four 3D printed parts, along with a separate acrylic visor.
Bottom Body:
The bottom body is the main housing that holds the PCB. It includes mounting pillars and screw holes so the PCB can be fixed securely without movement. Cutouts are provided on the sides for the power switch and USB port.
Top Cover:
The top cover forms the front face of the device. It includes openings for the OLED display, the push button, and the solar sensor area. The display window is recessed slightly to give a clean finish and protect the screen from scratches during use.
Solar Cell Holder:
A dedicated solar cell holder is used to position the solar cell correctly on the top surface. This ensures the solar cell sits flat and aligned, which is important for consistent irradiance measurement. The holder also helps isolate the cell from mechanical stress.
Button:
The button was printed as separate part and fit into the top cover. This gives a smooth button press and a neat external appearance without exposing the switch directly.
Acrylic Visor:
To protect the solar cell, a 2 mm thick clear acrylic visor (56 x 38mm) is placed above it. This visor protects the cell from dust, scratches, and accidental contact, while still allowing sunlight to pass through with minimal loss. \
Software & LibrariesThe firmware for this project is developed on the Arduino platform using the Arduino IDE.
To ensure proper communication with the connected sensors and display, a set of standard and third-party Arduino libraries must be installed before compiling the code. These libraries handle I²C communication, current measurement, motion sensing, and OLED graphics.
The required libraries are:
- Wire
- INA226
- Adafruit_LSM303_Accel
- Adafruit_LSM303DLH_Mag
- Adafruit_LSM303DLHC
- Adafruit_Sensor
- Adafruit_GFX
- Adafruit_SSD1306
The complete firmware, along with the calibration procedure and full source code, is provided in the subsequent steps.
Calibration Methods
Calibration of the irradiance meter can be done in two practical ways, depending on the tools available. Both methods are valid, and they can also be used together for best results.
1. Calibration Using the Solar Cell Datasheet
In this method, calibration is based on the electrical characteristics of the solar cell used as the irradiance sensor. The solar cell datasheet specifies the short-circuit current (Isc) at Standard Test Conditions (STC), which correspond to an irradiance of 1000 W/m².
From the datasheet, the short-circuit current at 1000 W/m² is taken as the reference value. Since the short-circuit current of a solar cell is approximately proportional to irradiance, a linear relationship is assumed between measured current and irradiance.
The firmware measures the short-circuit current of the solar cell and converts it into irradiance using a calibration constant derived from the datasheet value.
Irradiance (W/m²) = Isc(measured) × K
Where K is the calibration constant derived from the datasheet value:
K = 1000 W/m² / Isc(STC)
K ≈ 1000 / 84 ≈ 11.9 W/m² per mA
In practice, small losses due to acrylic cover, cell temperature, enclosure shading, and wiring resistance slightly reduce the measured current. To account for this, the calibration constant is fine-tuned experimentally.
This method is simple and does not require any external equipment. It provides reasonably accurate results for general measurements and learning purposes.
2. Calibration Using a Reference Irradiance Meter
For higher accuracy, calibration can be performed using a commercial reference irradiance meter along with a linear regression method. In this approach, the DIY irradiance meter and the reference meter are placed side by side under uniform sunlight, with both sensors aligned to the same tilt and orientation.
Multiple measurements are taken at different irradiance levels throughout the day. For each measurement point, the DIY meter records the short-circuit current, and the reference meter provides the corresponding irradiance value.
These paired values are then used to perform linear regression using the relationship:
G = k × Isc + c
Where:
G is the irradiance in W/m²
Isc is the measured short-circuit current in mA
k is the calibration constant
c is a small offset term
In most practical cases, the offset term c is very small and can be ignored, simplifying the relationship to:
G ≈ k × Isc
The regression-based value of k accounts for optical losses, temperature effects, and enclosure influences. Once determined, this calibration constant is updated in the firmware so that the DIY meter closely matches the reference meter across a wide irradiance range.
Firmware SummaryWhen the device is powered ON, it initializes the I2C bus and loads all required drivers for the OLED display, INA226 current sensor, and the GY-511 sensor module, which provides both tilt and azimuth information. Calibration data is stored in non-volatile memory, so once calibrated, the device retains its settings even after being switched off.
During startup, the device performs a quick self-check and displays the status of the OLED, current sensor, and GY-511 sensor. If calibration data is missing, or if the push button is held during power-up, the firmware automatically enters a guided calibration mode.
Tilt calibration is performed using a two-point method. First, the user places the device on a flat surface to record the 0-degree reference. Next, the device is tilted to a known reference angle, typically 90 degree, and confirmed using the button.
Current calibration is then performed by asking the user to cover the solar cell, allowing the system to measure and store a dark current offset for zero-current correction.
In normal operation, the microcontroller briefly switches ON a MOSFET to safely short the solar cell through the shunt resistor. Multiple current samples are taken using the INA226 and averaged to improve accuracy. The stored offset is applied, and the corrected current is converted into solar irradiance (W/m²) using a calibration constant. A small digital filter smooths the reading, and a stability check indicates when the measurement has settled.
The GY-511 magnetometer continuously provides azimuth (compass direction), allowing the user to understand the orientation of the device while taking measurements.
The OLED display shows solar irradiance, tilt, compass pointer and battery percentage on the main screen. A second screen displays the minimum and maximum irradiance values recorded during the measurement. A third screen displays the tilt angle and azimuth (compass direction) obtained from the GY-511 sensor, allowing the user to check the orientation of the device.
A single push button is used to control all functions.
Step-by-Step Calibration Procedure
1.Power ON the device using the power switch. The OLED display will turn on and the device will perform a quick self check.
2.Place the device under open sunlight. Make sure there are no shadows from your hand, nearby objects, or buildings falling on the solar cell.
3.Hold the device flat or place it on a level surface. Check the tilt angle shown on the display and adjust the position until the tilt is close to zero for best accuracy.
4.Wait a few seconds for the reading to stabilize. The irradiance value will settle automatically once sunlight conditions become steady.
5.Read the irradiance value displayed in W/m² on the screen. This represents the available solar energy at that location and time.
6.Use the push button for additional functions:
- Short press to switch between the main screen and the min–max screen
- Long press to hold the current reading
- Very long press to reset the min and max values
7.Check battery level on the display. Recharge the device when the battery percentage becomes low.
8.Power OFF the device after use to save battery.












Comments