Introduction: Arduino Controlled Solar Charger and Camping Light /Arduino電路板控制的太陽能充電器和露營燈

About: I'm a maker and engineer... I make mad stuff... check out Dubious Engineering on YouTube

I have had enough of buying cheap solar phone chargers that do not work, and have developed my own.


  • Clear plastic PELI case available on eBay.
  • Arduino NANO available on eBay.
  • 0.96 inch OLED Display - available on ebay and adafruit
  • Simple SPST Switch
  • 2.5v High power 3 watt LEDs
  • Solar panel (approx 6v 100mA) that fits the PELI case lid
  • 4.3volt Zenner diode
  • 1N4148 silicon diode
  • 18650 holders, 18650 batteries available on eBay
  • 5 volt 2 amp USB regulator charger available on eBay.

Please read-on for instructions on how to make this! Also, the code for the arduino for this project can be downloaded from GitHub and is included in the following pages.

Once the switch is turned on, the OLED display shows On-Time, Battery Voltage and % charged.

Overcharge is prevented by the 1N4148 and the 4.3v Zenner diode.

This has also been translated into Chinese by my wonderful wife-to-be!

I have a YouTube channel that includes a video overview - please see below... Please subscribe to my Instructables site and my YouTube channel (link below) to see more mad maker projects in the future!



  • 透明的PELI盒
  • Arduino電路板
  • 開關鍵
  • 二個高功率LED燈
  • 太陽能板 (需能置入 PELI盒蓋)
  • 一些18650電池座
  • 一個5伏特的USB調節器充電器


Step 1: Fit the Solar Panel and Diodes 安裝太陽能板和二極管

Glue the solar panel in place on the inside of the Pelicase. Following the circuit diagram, make sure you fit a 1N4148 diode to eliminate the possibility of reverse charging, also, fit the 4.3v Zenner diode according to the circuit diagram to ensure the 18650 batteries do not over-charge (it will shorten their life!).

將太陽能板黏貼在防水密封盒內部的適當位置。 遵循電路圖,確保使用1N4148二極管,以消除反向充電的可能性,同時根據電路圖配置4.3v Zenner二極管,以確保18650電池不會充電過頭(這將縮短其壽命!)。

Step 2: Fit the Battery Holders, Switch and Lighting

As can be seen in the pictures, using hot glue, fit the 18650 Holders, the on/off switch and the LED lighting. Please follow the circuit diagram carefully paying close attention to the polarity of the red and black wires of the battery holders and the high-power led lighting!

如圖所示,使用熱溶膠,安裝18650電池盒、開/關按鍵和LED燈。 請仔細按照電路圖,特別注意電池座上紅黑線的極性和高功率LED燈!

Step 3: Fit the USB Power Regulator, the OLED and the Arduino Nano

Connect up the OLED and Arduino as per the schematic and pictures...

Again, pay careful attention to the wiring of the OLED and 5 volt USB regulator making sure you follow pin numbers correctly. I found that carefully wrapping all these component parts up with electrical insulation tape saved some space in the peli-case and allowed me to include charge cables for various phones/accessories etc!

The code for this project can be found on GitHub as below

A youtube video offering more information can be found below...

將太陽能板粘貼在盒蓋內部,確認安裝一個二極體以消除反向充電的可能性。 安裝18650電池座,接通電源,並安裝開關和高功率LED燈。 連接OLED燈和Arduino電路板... 此項目的代碼可以在以下方連結中的GitHub上找到 更多信息請見以下Youtube視頻

Step 4: Arduino CODE

The following code displays on the OLED the title of the project, the on-time, the charge voltage, the charge percentage. Modify as you see fit. This is available in a more downloadable format on git-hub.

#include "U8glib.h" // U8glib library for the OLED

U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NONE|U8G_I2C_OPT_DEV_0);

// I2C / TWI setup OLED

int analogInput = 0; //Declare global vsriables

float vin = 0.0;

int value = 0;

int percent = 0;

int timedays = 0;

float ontime = 0;

float ontimeminutes = 0;

float vadjusted = 0;

void draw(void) {

u8g.drawFrame(0, 0, 128, 64); // Draws frame with rounded edges u8g.setFont(u8g_font_profont12); // Select font

u8g.drawStr(10, 12, "HTEC SOLAR CHARGER"); // Print Title


u8g.println("Battery ");

u8g.println(vadjusted); //Prints the voltage

u8g.println(" volts");

if (percent>=100) percent = 100;

u8g.setPrintPos(10,34); //Prints percentage

u8g.println("Cells ");


u8g.println("% charged");

if (timedays >=0) { u8g.setPrintPos(10,46); //Prints estimated charge time remaining

u8g.println(" Full in ");


u8g.println(" days!");


else { u8g.setPrintPos(8,46);

u8g.println(" -CHARGE COMPLETE-");


u8g.setPrintPos(10,58); //On time data

u8g.println("Ontime ");


u8g.println(" min");


void setup()


pinMode(analogInput, INPUT); //Setup analogue pins


void loop()


//Main Loop

// read the value at analog input

value = analogRead(analogInput);

vin = (value *5) / 1024.0; // math compensate voltage

vadjusted = vin * 0.84;

percent = value / 11.2;

timedays = (4.2 - vadjusted) / 0.04;

ontimeminutes = (ontime / 600); //Maths for displayed estimations



do {



while( u8g.nextPage() );