A compact handheld solar irradiance meter built using the Seeed XIAO ESP32-C3, INA226, LSM303AGR, and either a Waveshare 1.54 inch 240x240 ST7789 TFT LCD or a 128x64 OLED display.
This project is designed for measuring solar irradiance in the field and also displaying tilt, azimuth, and battery level in a compact handheld device.
This project is developed by Open Green Energy.
Step by step build guide is available here:
https://www.instructables.com/DIY-Solar-Power-Meter/
Download the 3D printable enclosure files here:
https://www.printables.com/model/1603265-diy-solar-power-meter
π Website
https://opengreenenergy.com
βΆ YouTube Channel
https://www.youtube.com/c/opengreenenergy
π· Instagram
https://instagram.com/opengreenenergy
β€οΈ Support Open Green Energy
If you like this project and want to support development of more open hardware tools:
https://www.patreon.com/opengreenenergy
This repository contains two firmware versions of the same project.
This version uses a Waveshare 1.54 inch 240x240 ST7789 TFT LCD and offers a more graphical user interface.
Location:
firmware/LCD_Version/
Main features:
- 4 page UI
- Professional graphical display
- Boot screen with logo
- Weather style irradiance icon
- Home, Min/Max, Tilt/Azimuth/Isc, and Compass pages
- EEPROM based calibration
This version uses a 128x64 OLED display and provides a simpler, low power interface.
Location:
firmware/OLED_Version/
Main features:
- Compact monochrome UI
- 4 pages
- Battery display
- Irradiance, tilt, azimuth, and compass page
- Full calibration with EEPROM storage
- Display suitable for minimal hardware builds
- Measures solar irradiance in W/m2
- Measures tilt angle using accelerometer
- Measures azimuth / heading using magnetometer
- Battery voltage and battery percentage display
- Single button navigation
- Long press calibration
- EEPROM based calibration storage
- Two firmware variants for different displays
- Portable field measurement tool
- MCU: Seeed XIAO ESP32-C3
- Current Sensor: INA226
- Accelerometer / Magnetometer: LSM303AGR
- Display Option 1: Waveshare 1.54 inch LCD, 240x240, ST7789 SPI
- Display Option 2: 128x64 OLED display
The meter estimates solar irradiance by measuring the short circuit current of a small reference solar panel through a shunt based current sensing arrangement using INA226.
The measured Isc value is corrected using a stored dark offset and then converted into irradiance using a calibration factor:
Irradiance = Corrected Isc Γ Calibration Constant
In the LCD firmware:
- Calibration constant =
15.05 W/m2 per mA
In the OLED firmware, the calibration constant can be adjusted in code based on the reference panel used.
Tilt and azimuth are measured using accelerometer and magnetometer data, then filtered for stable display.
| Function | XIAO ESP32-C3 Pin |
|---|---|
| Battery Sense | D0 |
| MOSFET Gate | D1 |
| Push Button | D2 |
| Function | XIAO ESP32-C3 Pin |
|---|---|
| LCD Reset | D3 |
| LCD CS | D6 |
| LCD DC | D7 |
| LCD SCK | D8 |
| LCD Backlight | D9 |
| LCD MOSI | D10 |
| Function | Connection |
|---|---|
| SDA | I2C SDA |
| SCL | I2C SCL |
| LCD Pin | XIAO ESP32-C3 |
|---|---|
| VCC | 3V3 |
| GND | GND |
| DIN | D10 |
| CLK | D8 |
| CS | D6 |
| DC | D7 |
| RST | D3 |
| BL | D9 |
| INA226 Pin | Connection |
|---|---|
| VCC | 3V3 |
| GND | GND |
| SDA | SDA |
| SCL | SCL |
| ADDR | 0x44 |
Battery voltage is measured through a resistor divider:
- Top resistor = 200k
- Bottom resistor = 100k
Connection:
VBAT -> 200k -> ADC pin D0 -> 100k -> GND
- Short Press β Next page
- Long Press for 2 seconds β Calibration wizard
- Short Press β Next page
- Long Press for 2 seconds β Full calibration
Shows:
- Irradiance
- Tilt
- Azimuth
- Battery level
Shows:
- Live irradiance
- Minimum irradiance
- Maximum irradiance
Shows:
- Tilt angle
- Azimuth angle
- Isc current
Shows:
- Compass style direction display
- Azimuth in degrees
- N / E / S / W direction
Shows:
- Battery percentage
- Irradiance
- Tilt
Shows:
- Live irradiance
- Minimum irradiance
- Maximum irradiance
Shows:
- Tilt angle
- Azimuth angle
Shows:
- Compass circle
- Needle direction
- Azimuth value
Both firmware versions support calibration and store values in EEPROM.
Cover the reference panel and save the dark current offset.
Keep the device level and save the zero tilt position.
Keep the device vertical and save the tilt reference position.
Rotate the device slowly so the magnetometer offset can be calculated.
Install these libraries from Arduino Library Manager:
Adafruit GFX LibraryAdafruit SSD1306Adafruit ST7735 and ST7789 LibraryAdafruit LIS2MDLAdafruit LSM303 AccelerometerAdafruit Unified SensorEEPROMWireSPIINA226.h
DIY-Solar-Power-Meter
β
βββ firmware
β βββ LCD_Version
β β βββ solar_meter_lcd_v1.1.ino
β β βββ oge_logo.h
β β
β βββ OLED_Version
β β βββ solar_meter_oled_v1.0.ino
β β
β βββ README.md
β
βββ images
β
βββ README.md
β
βββ LICENSE