DIY Solar Power Meter
This project started with a simple frustration. Most professional solar irradiance meters available in the market are too expensive for regular field use, learning, or DIY projects. Even after investing in them, they often remain closed and non-customizable — you use them as they are, without understanding or improving how they work.
While working with solar panels during site surveys and testing, I often needed a simple tool to quickly check sunlight conditions. Carrying an expensive instrument for every small task did not make sense, and low-cost alternatives based on generic light sensors were not reliable enough for real solar work.
That gap forced me to think differently.
Instead of buying another meter, I decided to build my own — something affordable, transparent, and customizable.
The idea was to measure sunlight the same way a solar panel experiences it, using a real silicon solar cell instead of a generic light sensor. Along with irradiance, I also wanted to understand how tilt and orientation (azimuth) affect the readings, because in real installations, orientation plays a major role in performance.
This DIY irradiance meter is the result of that thinking. It is about understanding the conditions behind that number. It is affordable, fully customizable, and designed for hands-on learning — making it useful for site surveys, DIY solar projects, education, and anyone curious about how sunlight turns into power.
Supplies
- XIAO ESP32C3 ( Amazon )
- Current Sensor - INA226 ( Amazon )
- OLED Display ( Amazon )
- Solar Cell ( Digikey )
- Compass Sensor - GY-511 LSM303 ( Amazon )
- 18650 Battery Holder ( Amazon )
- 18650 Battery ( Amazon )
- Capacitors - 3 x 10uF ( Amazon )
- Capacitors - 1 x 47uF / 22uF ( Amazon )
- Capacitors - 6 x 100nF ( Amazon )
- n-Channel MOSFET - AO3400 ( LCSC )
- Voltage Regulator - XC6220 ( Amazon )
- Resistor - 2 x 100K ( Amazon )
- Resistor - 1 x 200K ( Amazon )
- Resistor - 2 x 10K ( Amazon )
- Resistor - 2 x 4.7K ( Amazon )
- Resistor - 1 x 1K ( Amazon )
- Resistor - 1 x 100R ( Amazon )
- JST Connector - XH2.54 ( LCSC)
- Tactile Switch ( LCSC )
- 2mm Acrylic Sheet ( Amazon )
System Overview
Major Functional Blocks:
Power Supply
Solar cell for irradiance sensing
Current measurement using INA226
LSM303 compass sensor
XIAO ESP32-C3 microcontroller
OLED display for real-time data
The schematic diagram is attached
Power Supply
The irradiance meter is powered by a single 18650 Li-ion battery. Since accurate current measurement is required, a low-noise linear regulator is used instead of a switching regulator.
Battery Input
- Battery voltage ranges from ~3.0 V to 4.2 V
- A power switch disconnects the battery when the device is off
Voltage Regulation
- An XC6220 LDO regulator converts the battery voltage to a stable 3.3 V
- The regulator is always enabled when power is on
- Low output noise ensures stable sensor readings
Filtering and Stability
- C1 (10 µF) at the input smooths battery variations
- C2 (47 µF) and C3 (10 µF) at the output stabilize the 3.3 V rail
- 0.1 µF capacitors provide high-frequency decoupling near ICs
Battery Voltage Monitoring
- A resistor divider (R1 and R2) feeds the battery voltage to the MCU ADC
- Used for battery level display and low-battery indication
Power Flow
Battery → Switch → XC6220 LDO → 3.3 V rail → MCU, INA226, OLED, GY-511 sensor
Solar Irradiance Measurement
This 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:
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.
Selecting the Solar Panel
When selecting the solar cell, physical size was as important as electrical performance. The device is designed to be compact and handheld, so the solar cell needed to fit neatly on enclosure without making the instrument bulky or uncomfortable to use.
Using a very large solar cell would increase the short-circuit current and improve signal strength, but it would also increase the overall size of the device. This would make the meter harder to carry and less practical for quick field measurements. On the other hand, choosing a very small solar cell would keep the device compact but would produce very low current, making accurate measurement more difficult and more sensitive to noise.
To balance these constraints, the ANYSOLAR KXOB201K04F solar cell was selected, as it fits well within the available top area of the enclosure. Its compact form factor allows the cell to be mounted easily on the enclosure surface.
From an electrical point of view, the selected solar cell produces a short-circuit current of 84mA under full sunlight. This current level is high enough for stable measurement using the INA226 with a suitably chosen shunt resistor, while still remaining well within safe operating limits. As a result, the chosen cell size achieves a practical balance between device portability, mechanical design, and measurement accuracy.
Downloads
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.
Measurement Accuracy
The selected solar cell used for irradiance sensing generates a short-circuit current in the milliampere range under normal sunlight conditions. While this current level is well suited for low-power measurement, it imposes specific requirements on the current sensing circuit. The INA226 module used in this design is supplied with an onboard R100 (0.1 Ω) shunt resistor, which is primarily intended for higher-current applications. At milliampere-level currents, the voltage developed across a 0.1 Ω shunt is very small, resulting in reduced measurement resolution and increased sensitivity to noise, offset errors, and parasitic resistances.
To overcome this limitation and improve measurement accuracy, the onboard R100 (0.1 Ω) shunt resistor was removed and replaced with an R500 (0.5 Ω) resistor. This modification increases the shunt voltage proportionally for the same solar cell current, allowing the INA226 to operate in a more favorable measurement range without significantly disturbing the short-circuit condition of the solar cell.
Under Standard Test Conditions, the selected solar cell used in this design has a short-circuit current (Isc) of approximately 84 mA at 1000 W/m², as specified in the attached solar panel datasheet. This current level defines the upper operating range of the current measurement circuit. With the original R100 shunt, the shunt voltage at rated irradiance is:
Vshunt = Isc×R = 0.084 A×0.1 Ω = 8.4 mV
A shunt voltage of only a few millivolts places the measurement close to the lower end of the sensing range, where noise and offset effects have a proportionally larger impact on accuracy.
After replacing the shunt with R500 (0.5 Ω), the shunt voltage at the same current becomes:
Vshunt = 0.084 A×0.5 Ω = 42 mV
This fivefold increase in shunt voltage significantly improves measurement resolution, resulting in more stable and repeatable current readings. At the same time, the voltage drop remains small enough to maintain the solar cell close to true short-circuit operation.
Understanding Tilt and Azimuth in Solar Measurements
When measuring sunlight for solar applications, how the panel is positioned is just as important as how strong the sunlight is. This is where tilt and azimuth come in.
Tilt refers to how much the solar panel is inclined from a flat, horizontal position. If the panel is too flat or too steep, it will not receive the maximum possible sunlight. Even under the same sunlight conditions, a wrong tilt angle can reduce the effective solar energy falling on the panel.
Azimuth refers to the direction the panel is facing. In simple terms, it is like a compass direction. In most locations, solar panels should face towards the sun’s path for maximum energy. If the panel is facing the wrong direction, it will receive less sunlight, even if the tilt angle is correct.
In this irradiance meter, tilt and azimuth are shown so the user can make sure the device is properly aligned while taking measurements. This helps ensure that the measured irradiance truly represents the sunlight available to a correctly installed solar panel, making the readings more meaningful and closer to real-world solar installation conditions.
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 Measurement
When 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.
OLED Display and User Interface
The OLED display is used to show all important information in a simple and readable way. It acts as the main interface between the device and the user, allowing measurements to be understood at a glance while working outdoors.
The display shows the solar irradiance value in W/m², which is the main output of the device. Along with this, it also displays the tilt angle and azimuth, so the user can check whether the device is held flat or tilted during measurement and whether it is correctly oriented. This helps avoid errors caused by incorrect positioning. The battery voltage or battery level is also shown, so the user knows when the battery needs to be recharged.
The OLED display communicates with the microcontroller using the I2C interface, which requires only two signal wires (SDA and SCL )
The user interface is intentionally kept minimal. There are no complex menus or settings to navigate. The goal is to make the device easy to use in the field: turn it on, place it in sunlight, check that it is properly aligned, and read the values.
Push Button for User Interaction
A push button is used to allow simple user interaction. When the button is pressed, the microcontroller detects the change and performs a predefined action. The button can be used to switch display modes, hold a measurement, reset values, or wake the device from sleep.
From a user point of view, the button provides basic control without distraction. For example, the user can press the button to freeze the current irradiance reading while noting down values, or cycle between different display screens if more information is available.
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.
PCB Manufacturing
After successfully designing the prototype PCB, I placed an order with PCBWay, and to my delight, they delivered it to my doorstep within a week. The black PCB with immersion gold finish looked fantastic, giving it a professional and polished appearance.
Once I had everything in hand, I moved on to assemble the PCB using the stencil.
PCB Assembling
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 Sensor
On 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 Enclosure
The 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.
Assembling Solar Cell
The solar cell is mounted to its 3D printed holder using 3M VHB tape. This tape provides strong adhesion and is weather resistant, making it suitable for outdoor use. If VHB tape is not available, any good quality weather resistant glue or adhesive can also be used.
Before fixing the solar cell into the holder, the terminal wires should be soldered first. Once the cell is mounted, the solder pads become difficult to access
After soldering, the solar cell is carefully placed into the holder and pressed firmly to ensure proper bonding.
Mount the Solar Cell Holder to Top Cover
First, the 2 mm acrylic visor is placed into the dedicated slots provided on the back side of the top cover.
Once the acrylic visor is in place, the solar cell holder is aligned from the inside of the top cover. The holder is designed to match the visor opening exactly, ensuring that the solar cell sits flat and centered under the acrylic window. After alignment, the holder is fixed using screws, which clamp the solar cell holder and acrylic visor securely against the top cover.
Connect the solar cell terminal wires to the JST connector on the PCB.
Mounting the OLED Display
Place the OLED display into the top cover from the inside and align the screen with the display cutout on the top cover.
Match the OLED mounting holes with the mounting posts in the enclosure.
Secure the OLED using small screws. If the mounting holes do not align, apply a small amount of glue to hold the display in place.
Connect jumper wires to the OLED header pins (VCC, GND, SDA, SCL).
Route the jumper wires neatly toward the PCB.
Solder the other ends of the jumper wires to the corresponding I2C pins on the PCB for the display connection.
Mounting the PCB to Enclosure
Place the PCB into the bottom body and align the PCB mounting holes with the mounting posts.
Ensure the power switch and USB-C port are aligned with their respective cutouts in the enclosure.
Secure the PCB using screws through the PCB holes into the mounting posts.
Connect the OLED Display wires to PCB
Insert a charged 18650 battery into the battery slot.
Close the Top Cover
Insert the button into the top cover from the back side and hold it's tip from the top side so it stays in position.
Align the button carefully with the push switch on the PCB.
Bring the top cover and bottom body together carefully, making sure no wires are trapped.
Align the screw holes of the top cover with the bottom body and secure the enclosure using four screws.
Software & Libraries
The following Arduino libraries are used in this project to interface with the hardware:
- Wire
- INA226
- Adafruit LSM303
- Adafruit Sensor
- Adafruit GFX
- Adafruit SSD1306
Firmware Summary
When 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.
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.
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.