Sitemap / Advertise

Introduction

Evaluate the possible magnitude of solar energy by the light intensity in a given direction to charge batteries efficiently.


Tags

Share

Light Intensity and Solar Energy Detector with Tilt Sensor

Advertisement:


read_later

Read Later



read_later

Read Later

Introduction

Evaluate the possible magnitude of solar energy by the light intensity in a given direction to charge batteries efficiently.

Tags

Share





Advertisement

Advertisement




    Components :
  • [1]JLCPCB Custom PCB
  • [1]Arduino Nano v3
  • [4]10mm Photoresistor
  • [1]Tilt Sensor (Mercury Sensor)
  • [1]Buzzer
  • [4]5mm Red LED
  • [4]5mm Yellow LED
  • [4]5mm Green LED
  • [13]220Ω Resistor
  • [5]1K Resistor
  • [1]Power Jack

Description

For charging batteries with solar panels to run some devices in my home office, I have placed the solar panels according to my predictions on the best possible location without gathering reliable data. Therefore, I pondered a cheap and easy-to-use mechanism to determine the perfect location for solar panel charging depending on the light intensity in a given direction. I am able to charge batteries more efficiently and sustainably with this device than before because the amount of energy generated by a solar panel is closely related to the amount of solar radiation. Hence, I used light intensity values as a substitute to calculate the magnitude of solar energy approximately. You can inspect the formula I used to calculate solar energy below.

After running the code to calculate solar energy with light intensity values gathered by 10mm photoresistors, I conducted experiments with batteries and my solar panel to determine thresholds for performance levels of solar charging: Low, Moderate, High. And, to show the performance levels, I used different LED colors - red (Low), yellow (Moderate), green (High) - for each direction.

Not surprisingly, it is crucial to place the device perpendicular to detect light intensity accurately, so I used a tilt sensor (mercury sensor) to check if the device moves into a tilted position. And, to notify the user, when the device moves into a sloping position, I added a buzzer to the device.

After completing my design on a breadboard and testing the code, I designed a PCB (Light Intensity and Solar Energy Detector with Tilt Sensor) with a unique circular shape to create a flexible and easy-to-use device supporting four directions.

Huge thanks to JLCPCB for sponsoring this project.

project-image
Figure - 49.1

Step 1: Designing and Soldering the Light Intensity and Solar Energy Detector with Tilt Sensor PCB

I designed the Light Intensity and Solar Energy Detector with Tilt Sensor PCB by using KiCad. I attached the Gerber file of the PCB below, so if you want, you can order this PCB from JLCPCB to use your solar panels more efficiently and sustainably as I did :)

project-image
Figure - 49.2

First of all, by using a soldering iron, I attached headers, 220Ω resistors, 1K resistors, 10mm photoresistors, the power jack, 5mm red LEDs, 5mm yellow LEDs, 5mm green LEDs, buzzer, and the tilt sensor (mercury sensor).

Component list on the PCB:

A1 (Headers for Arduino Nano)

P1, P2, P3, P4 (10mm Photoresistors)

Buzzer (Buzzer)

Tilt Sensor (Tilt Sensor)

R (5mm red LEDs)

Y (5mm yellow LEDs)

G (5mm green LEDs)

R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13 (220Ω resistors)

R14, R15, R16, R17, R18 (1K Resistors)

J1 (Power Jack)

project-image
Figure - 49.3


project-image
Figure - 49.4


project-image
Figure - 49.5

Step 2: Calculating Solar Energy Approximately

[ E = A * r * H * PR ] is the formula I used for calculating the magnitude of solar energy approximately, where:

A is the area of the solar panel,

r is the efficiency,

H is the average solar radiation,

and PR is the performance ratio or coefficient (generally 0.75).


// Define the solar panel (SP) specifications which differ amid different brands. So, change these variables with that of your solar panel.
#define SP_area 0.0088
#define SP_efficiency 6.2
#define SP_coefficient 0.75

float Solar_Panel_Energy(float Area, float Efficiency, int Radiation, float Coefficient){
  // Calculate the possible magnitude of solar energy by using the light intensity values as a substitute for radiation. 
  float Energy = Area * Efficiency * Radiation * Coefficient;
  return Energy;
}

Do not forget to change solar panel specifications - area, efficiency, and performance ratio - which may differ amid solar panel brands.

To calculate the possible magnitude of solar energy, I used light intensity values as a substitute for solar radiation in the formula.

Of course, this method does not provide exact solar energy values but an indicator to determine thresholds (Low, Moderate, High) for detecting solar charging performance in a given direction.

Note: I determine the thresholds for each level by conducting tests with my solar panel: I observed time passed in given light intensity and estimated solar energy values to full-charge a 3.7V LiPo battery.

Step 3: Programming the Arduino Nano

- Define indicators (red, yellow, green) for each direction.

- Define LDR pins for each direction to gather light intensity values.

- Define the buzzer pin and the tilt sensor pin.

- Define the solar panel (SP) specifications, which differ amid different brands. So, change these variables with that of your solar panel.

- Define thresholds by experimenting.

- In the get_Light_Intensity() function, gather light intensity data from photoresistors.

- In the Tilt() function, get notified if the device moves into a sloping position.

- Initiate threshold detection (Low, Moderate, High) for each direction.

- In the Indicate_Thresholds() function:

- Print the selected direction with its solar energy value.

- Adjust threshold indicators (LEDs) according to solar energy values for each direction.

project-image
Figure - 49.6


project-image
Figure - 49.7


project-image
Figure - 49.8

Connections and Adjustments


// Connections
// Arduino Nano :           
//                                direction_1_LOW
// D4  ---------------------------
//                                direction_1_MODERATE
// D3  ---------------------------
//                                direction_1_HIGH
// D2  ---------------------------
//                                direction_2_LOW
// D7  ---------------------------
//                                direction_2_MODERATE
// D6  ---------------------------
//                                direction_2_HIGH
// D5  ---------------------------
//                                direction_3_LOW
// D8  ---------------------------
//                                direction_3_MODERATE
// D9  ---------------------------
//                                direction_3_HIGH
// D10 ---------------------------
//                                direction_4_LOW
// D13 ---------------------------
//                                direction_4_MODERATE
// A4  ---------------------------
//                                direction_4_HIGH
// A5  ---------------------------
//                                Buzzer
// D11 ---------------------------
//                                Tilt Sensor
// D12 ---------------------------
//                                direction_1_LDR
// A0  ---------------------------
//                                direction_2_LDR
// A1  ---------------------------
//                                direction_3_LDR
// A2  ---------------------------
//                                direction_4_LDR
// A3  ---------------------------

After finishing and uploading the code to the Arduino Nano, I attached it to the board through headers.

project-image
Figure - 49.9

Features

1) Display the estimated magnitude of solar energy for each direction on the serial monitor.

project-image
Figure - 49.10

2) For each direction, observe the performance of solar charging via indicators adjusted according to solar energy thresholds (levels):

Red - Low

Yellow - Moderate

Green - High

project-image
Figure - 49.11

3) Get notified if the device moves into a sloping position to charge batteries more efficiently with perpendicular beams.

project-image
Figure - 49.12

Videos and Conclusion

Code

Light_Intensity_and_Solar_Energy_Detector.ino

Download



         /////////////////////////////////////////////  
        //    Light Intensity and Solar Energy     //
       //        Detector with Tilt Sensor        //
      //             ---------------             //
     //             (Arduino Nano)              //           
    //             by Kutluhan Aktar           // 
   //                                         //
  /////////////////////////////////////////////

// Evaluate the possible magnitude of solar energy by the light intensity in a given direction to charge batteries efficiently.
//
// The amount of energy generated by a solar panel is related to the amount of solar radiation. Which is why, I used light intensity values as a substitute to calculate it approximately.
//
// Threshold indicators for each direction:
//
// Red - Low
// Yellow - Moderate
// Green - High 
//
// I determine the thresholds for each level by conducting tests with my solar panel: I observed time passed in a given light intensity value to full-charge a 3.7V Li-Po battery.
//
// So, do not forget to change the thresholds according to your experiments with your battery and solar panel.
//
// Connections
// Arduino Nano :           
//                                direction_1_LOW
// D4  ---------------------------
//                                direction_1_MODERATE
// D3  ---------------------------
//                                direction_1_HIGH
// D2  ---------------------------
//                                direction_2_LOW
// D7  ---------------------------
//                                direction_2_MODERATE
// D6  ---------------------------
//                                direction_2_HIGH
// D5  ---------------------------
//                                direction_3_LOW
// D8  ---------------------------
//                                direction_3_MODERATE
// D9  ---------------------------
//                                direction_3_HIGH
// D10 ---------------------------
//                                direction_4_LOW
// D13 ---------------------------
//                                direction_4_MODERATE
// A4  ---------------------------
//                                direction_4_HIGH
// A5  ---------------------------
//                                Buzzer
// D11 ---------------------------
//                                Tilt Sensor
// D12 ---------------------------
//                                direction_1_LDR
// A0  ---------------------------
//                                direction_2_LDR
// A1  ---------------------------
//                                direction_3_LDR
// A2  ---------------------------
//                                direction_4_LDR
// A3  ---------------------------


// Define indicators (red, yellow, green) for each direction.
#define direction_1_LOW 4
#define direction_1_MODERATE 3
#define direction_1_HIGH 2
#define direction_2_LOW 7
#define direction_2_MODERATE 6
#define direction_2_HIGH 5
#define direction_3_LOW 8
#define direction_3_MODERATE 9
#define direction_3_HIGH 10
#define direction_4_LOW 13
#define direction_4_MODERATE 18
#define direction_4_HIGH 19

// Define LDR pins for each direction to gather light intensity values.
#define direction_1_LDR A0
#define direction_2_LDR A1
#define direction_3_LDR A2
#define direction_4_LDR A3

// Define the buzzer pin and the tilt sensor pin.
#define buzzerPin 11 
#define tiltPin 12

// Define the solar panel (SP) specifications which differ amid different brands. So, change these variables with that of your solar panel.
#define SP_area 0.0088
#define SP_efficiency 6.2
#define SP_coefficient 0.75

// Define thresholds by experimenting.
#define low 9.15
#define moderate 19.48 
  
// Define data holders:
int LDR_1, LDR_2, LDR_3, LDR_4;


void setup() {
  Serial.begin(9600);
  Serial.print("\nDevice Activated:\n");
  Serial.print("Do not forget to change solar panel specifications and thresholds!\n");
  
  pinMode(direction_1_LOW, OUTPUT);
  pinMode(direction_1_MODERATE, OUTPUT);
  pinMode(direction_1_HIGH, OUTPUT);
  pinMode(direction_2_LOW, OUTPUT);
  pinMode(direction_2_MODERATE, OUTPUT);
  pinMode(direction_2_HIGH, OUTPUT);
  pinMode(direction_3_LOW, OUTPUT);
  pinMode(direction_3_MODERATE, OUTPUT);
  pinMode(direction_3_HIGH, OUTPUT);
  pinMode(direction_4_LOW, OUTPUT);
  pinMode(direction_4_MODERATE, OUTPUT);
  pinMode(direction_4_HIGH, OUTPUT);
  
  pinMode(tiltPin, INPUT);

}

void loop() {
  // Gather light intensity data from photoresistors.
  get_Light_Intensity();

  // Activate the tilt sensor to get accurate results with photoresistors.
  Tilt(digitalRead(tiltPin));

  // Initiate threshold detection for each direction:

  // Direction (1):
  Indicate_Thresholds(Solar_Panel_Energy(SP_area, SP_efficiency, LDR_1, SP_coefficient), direction_1_LOW, direction_1_MODERATE, direction_1_HIGH, 1);
  
  // Direction (2):
  Indicate_Thresholds(Solar_Panel_Energy(SP_area, SP_efficiency, LDR_2, SP_coefficient), direction_2_LOW, direction_2_MODERATE, direction_2_HIGH, 2);
  
  // Direction (3):
  Indicate_Thresholds(Solar_Panel_Energy(SP_area, SP_efficiency, LDR_3, SP_coefficient), direction_3_LOW, direction_3_MODERATE, direction_3_HIGH, 3);
  
  // Direction (4):
  Indicate_Thresholds(Solar_Panel_Energy(SP_area, SP_efficiency, LDR_4, SP_coefficient), direction_4_LOW, direction_4_MODERATE, direction_4_HIGH, 4);
 
}

void get_Light_Intensity(){
  LDR_1 = analogRead(direction_1_LDR);
  LDR_2 = analogRead(direction_2_LDR);
  LDR_3 = analogRead(direction_3_LDR);
  LDR_4 = analogRead(direction_4_LDR);

}

void Tilt(int tilt){
  // Get notified if the device moves into a sloping position.
  if(tilt == HIGH){
    tone(buzzerPin, 350);
  }else if(tilt == LOW){
    noTone(buzzerPin);
  }
}
  
float Solar_Panel_Energy(float Area, float Efficiency, int Radiation, float Coefficient){
  // Calculate the possible magnitude of solar energy by using the light intensity values as a substitute for radiation. 
  float Energy = Area * Efficiency * Radiation * Coefficient;
  return Energy;
}

void Indicate_Thresholds(float predictedEnergy, int red, int yellow, int green, int direction){
  // Print the selected direction.
  Serial.print("Direction ("); 
  Serial.print(direction); 
  Serial.print(") = \t");
  Serial.print(predictedEnergy);
  Serial.print("\n");
  // THRESHOLDS:       
  if(predictedEnergy < low){
    digitalWrite(red, HIGH);
    digitalWrite(yellow, LOW);
    digitalWrite(green, LOW);
  }else if(low <= predictedEnergy && predictedEnergy < moderate){
    digitalWrite(red, HIGH);
    digitalWrite(yellow,HIGH);
    digitalWrite(green, LOW);
  }else if(predictedEnergy >= moderate){
    digitalWrite(red, HIGH);
    digitalWrite(yellow, HIGH);
    digitalWrite(green, HIGH);
  }
          
}
     


Schematics

project-image
Schematic - 49.1


project-image
Schematic - 49.2


project-image
Schematic - 49.3

Downloads

Gerber Files

Download


Fabrication Files

Download