You are on page 1of 66

POLITEKNIK SULTAN AZLAN SHAH

SMART TILT SOLAR PANEL TRACKING WITH


ONLINE MONITORING

MUHAMMAD DANISH AISY BIN NOOR IZWAN


(15DTK20F1009)

ELECTRICAL ENGINEERING DEPARTMENT

SESSION 1 2022/2023
POLITEKNIK SULTAN AZLAN SHAH

SMART TILT SOLAR PANEL TRACKING WITH


ONLINE MONITORING

MUHAMMAD DANISH AISY BIN NOOR IZWAN


(15DTK20F1009)

This report was submitted to the Electrical Engineering Department


in fulfillment of the requirement for a Diploma in Electrical
Engineering

ELECTRICAL ENGINEERING DEPARTMENT

SESSION 1 2022/2023
This project is dedicated to my beloved mother, Noor Azzura, and my late father, Noor Izwan
also, my warm hearts grandparents

For their endless love, kind support and encouragement


DECLARATION OF ORIGINALITY AND OWNERSHIP

SMART TILT SOLAR PANEL TRACKING WITH ONLINE


MONITORING

1. I, MUHAMMAD DANISH AISY BIN NOOR IZWAN (15DTK20F1009),


am a student of Diploma in Electronic Engineering(Computer), Politeknik
Sultan Azlan Shah, whose address is at Behrang Stesen, 35950 Behrang,
Perak.

2. I acknowledge that the 'Project above' and its intellectual property are the result
of my original work/design without taking or copying any intellectual property
from other parties.

3. I agree to release the ownership of the project intellectual property to the


Politeknik Sultan Azlan Shah to meet the requirements for awarding me a
Diploma in Electrical Engineering.

Made and in truth that is recognised by;


Muhammad Danish Aisy Bin Noor Izwan )
(Identification card No: 020314140961) .....………………………….
) Muhammad Danish Aisy
Bin Noor Izwan

In front of me, Puan Ruhaida Binti Nural Anuar. ) .....………………………..


As a project supervisor, on the date: ) Puan Ruhaida Binti Nural
Anuar

iv
ACKNOWLEDGEMENTS

I would like to express my sincere gratitude to several individuals and


organizations for supporting me throughout my Final Year Project. First, I wish to
express my sincere gratitude to my supervisor, Puan Ruhaida Binti Nural Anuar, for
her enthusiasm, patience, insightful comments, helpful information, practical advice
and unceasing ideas that have helped me tremendously at all times in my research and
writing of this final report. Her immense knowledge, profound experience and
professional expertise in the Electronic & IoT field has enabled me to complete this
research successfully. Without her support and guidance, this Project would not have
been possible. I could not have imagined having a better supervisor in my study.

I would want to thank my lecturers and my friend for their wonderful


encouragement and cooperation, which helped me finish this Project. I want to offer
my sincere appreciation and thanks to those in the profession who took the time to give
me such close attention.

My gratitude and appreciations also go out to my colleagues who helped me


develop the Project and those who volunteered their skills in order to assist me.

v
ABSTRACT

The generation of power by reducing fossil fuels will be the most difficult
challenge for the next half-century. The idea of converting solar energy into electrical
energy using photovoltaic panels is in the front row compared to other renewable
sources. But the continuous change in the relative angle of the sun with reference to
the earth reduces the watts delivered by the solar panel. In this context, a solar panel
tracking system is the best alternative to increase the efficiency of the photovoltaic
panel. Solar trackers move the frame towards the sun throughout the day. The main
control circuit is based on an ESP32 microcontroller. The programming of this device
is done in such a manner that the BH1750 sensor, following the detection of the sun's
rays, will provide direction to the stepper motor in which way the solar panel will
revolve. In this Project, the Grafana application and Node-Red were used to visualize
the reading of light irradiance and the position of a stepper motor as an Internet of
Things (IoT) element. From the analysis, the voltage reading of charging capacity for
Smart Tilt Solar Panel Tracking showed that at the maximum power rating, more hours
compared to the fixed solar panel.

vi
ABSTRAK

Penjanaan tenaga dari pengurangan bahan bakar fosil akan menjadi cabaran
paling sukar untuk setengah abad akan datang. Idea untuk menukar tenaga suria menjadi
tenaga elektrik menggunakan panel fotovolta memegang tempatnya di barisan depan
berbanding dengan sumber lain yang boleh diperbaharui. Tetapi perubahan berterusan
pada sudut relatif matahari dengan merujuk ke bumi mengurangkan watt yang dihantar
oleh panel suria. Dalam konteks ini, sistem penjejakan panel solar adalah alternatif
terbaik untuk meningkatkan kecekapan panel fotovolta. Penjejak solar menggerakkan
bingkai ke arah matahari sepanjang hari. Litar kawalan utama berdasarkan
mikropengawal ESP32. Pengaturcaraan peranti ini dilakukan sedemikian melalui
penderia BH1750, yang bersesuaian dengan pengesanan sinar matahari, akan memberi
arahan kepada motor stepper ke arah mana panel solar akan berputar. Dalam projek ini,
aplikasi Grafana dan Node-Red digunakan untuk memvisualisasikan pembacaan cahaya
cahaya dan kedudukan motor stepper, yang merupakan elemen Internet of Things ( IoT
). Daripada analisis, bacaan voltan kapasiti pengecasan untuk Penjejakan Panel Suria
Smart Tilt menunjukkan bahawa pada penarafan kuasa maksimum, lebih lama
berbanding dengan panel solar tetap.

vii
TABLE OF CONTENTS

DECLARATION OF ORIGINALITY AND OWNERSHIP iv


ACKNOWLEDGEMENTS v
ABSTRACT vi
ABSTRAK vii
LIST OF TABLES x
LIST OF FIGURES xi
LIST OF SYMBOLS xiii
LIST OF ABBREVIATIONS xiv
CHAPTER 1 1
INTRODUCTION 1
1.1 INTRODUCTION 1
1.2 PROJECT BACKGROUND 1
1.3 PROBLEM STATEMENT 1
1.4 PROJECT OBJECTIVES 2
1.5 SCOPE OF PROJECT 2
1.6 PROJECT SIGNIFICANCE 3
1.7 DEFINITION OF TERMS 3
1.8 CHAPTER SUMMARY 4
CHAPTER 2 5
LITERATURE REVIEW 5
2.1 INTRODUCTION 5
2.2 COMPARISON BETWEEN SOLAR PANEL TRACKER AND FIXED
SOLAR PANEL 5
2.3 THE EXISTING CONCEPT OF THE SOLAR PANEL TRACKER SYSTEM 6
2.4 TYPE OF PV SOLAR TRACKER 7
2.4.1 SINGLE AXIS SOLAR TRACKER 7
2.4.2 DUAL AXIS SOLAR TRACKER 9
2.6 ROTATION MECHANISM 11
2.6.1 STEPPER MOTOR 11
2.6.2 SERVO MOTOR 12
2.6.3 DC MOTOR 12
2.7 LIGHT SENSOR 14
2.8 CHAPTER SUMMARY 15
CHAPTER 3 16
RESEARCH METHODOLOGY 16

viii
3.1 INTRODUCTION 16
3.2 COMPONENTS & SOFTWARE USED 16
3.3 PROJECT OVERVIEW 17
3.4 BLOCK DIAGRAM 17
3.5 SOLAR FRAME SYSTEM HARDWARE 21
3.6 CHAPTER SUMMARY 22
CHAPTER 4 23
RESULT AND DISCUSSION 23
4.0 INTRODUCTION 23
4.1 THE PERFORMANCE OF SMART TILT SOLAR PANEL TRACKING WITH
ONLINE MONITORING 23
4.2 DISCUSSION 24
4.3 CHAPTER SUMMARY 24
CHAPTER 5 25
CONCLUSIONS AND RECOMMENDATIONS 25
5.1 INTRODUCTION 25
5.2 CONCLUSIONS 25
5.3 FUTURE RECOMMENDATIONS 26
5.4 PROJECT LIMITATIONS 26
5.5 SUSTAINABILITY 26
5.6 CHAPTER SUMMARY 27
REFERENCES 28
APPENDIX A: MILESTONE xiv
APPENDIX B: ACTUAL COST xv
APPENDIX C: DATA SHEET/SPECIFICATION OF COMPONENT xvi
APPENDIX D: PROGRAMMING CODES xx
APPENDIX E: USER MANUAL xxxii
APPENDIX F: 3D DESIGNS xxxiv

ix
LIST OF TABLES

TABLE NO. TITLE PAGE

2.1 Ability of Solar Panel Tracker against Fixed Solar Panel 6


2.2 Comparison between the light sensor of BH1750 and LDR 14
2.3 The Light Intensity of Different Situations (Mst Jesmin 15
Nahar, 2021)
4.1 The Voltage output obtained by PV Panel at Selected Time 23
Interval

x
LIST OF FIGURES

FIGURE NO. TITLE PAGE

2.1 Flowchart of existing solar panel tracker that uses 7


different components

2.2 Block Diagram of Single Axis Tracker System (Dr. 8


Dhanabal Rengasamy, 2013)

2.3 Single-axis Tracking System Design by (Deekshith K, 8


2015)

2.4 Block Diagram of Tracking Solar System by (Mst Jesmin 9


Nahar, 2021)

2.5 Process of IoT Monitoring of Dual Axis Solar Tracker 10


(Muhammad Shafiq Mohd Nazri, 2013)

2.6 Interfacing Dual Axis Solar Tracker Arduino Project 10


Using LDR & Servo Motors

2.7 Connection of stepper motor with ESP32 11

2.8 The block diagram of Dual Axis Solar Tracking System 12


(Amit Chakraborty Chhoton, 2017)

2.9 The DC Motor Torque Speed and Torque Current Curve 13

2.10 The DC Motor mounted at the shaft to control the rotation 13


angle of the PV panel

3.1 Block diagram of Smart Tilt Solar Panel Tracking with 17


Online Monitoring

3.2 NodeRed Flow 18

3.3 InfluxDB accessible using RaspberryPi 19

xi
3.4 Grafana Dashboard using IP address of RaspberryPi 19

3.5 Flowchart for Rotated Motor Respective to BH1750 20


Sensor Reading of Smart Tilt Solar Panel Tracking with
Online Monitoring

3.6 Prototype model of Smart Tilt Solar Panel Tracking with 21


Online Monitoring

xii
LIST OF SYMBOLS

Symbols

lx Illuminance

xiii
LIST OF ABBREVIATIONS

IoT Internet Of Things


MQTT Message Queuing Telemetry Transport
PV Photovoltaic
DC Direct Current
RPM Rotation per Minute

xiv
CHAPTER 1
INTRODUCTION

1.1 INTRODUCTION

Smart Tilt Solar Panel Tracking with Online Monitoring will improve
electricity production from the solar panels. This is because the solar panel will tilt to
exposure of light intensity from sunlight. Besides, it included online monitoring to
check light intensity reading and rotation pose. This online monitoring included the
element of IoT, which is one of Industry 4.0 elements.

1.2 PROJECT BACKGROUND

The background of this Project is renewable energy that can reduce greenhouse
gas emissions. The weakness of fixed or static solar panels as they cannot rotate or tilt
according to the movement of light intensity. Thus, this Project will improve the fixed
solar panel system by innovating it to tilt by a single axis that will track light intensity.
Thus, solar panels will produce the optimum amount of electricity because they get the
best light intensity exposure. (Dr. Dhanabal Rengasamy, 2013) in their research, the
flexible axis of PV will generate more energy than the fixed mount system.

1.3 PROBLEM STATEMENT

Solar energy is one of the preferable generating energy sources due to the reliable
renewable energy sources since it is sustainable and clean (environmentally friendly). The
problem with PV panel installation was the occupied space with an unshaded area to

1
produce efficient electrical energy. In that case, the vast unshaded area of PV solar space
must be provided to produce efficient electrical energy to yield a higher return on
investment. The unshaded area was usually done by cutting down the trees in a particular
area before the PV panels installation work had been done. Furthermore, the performance
of the energy generation is highly affected by the tilt and perpendicular angle of the PV
solar towards the sun's position throughout the day. A recent study shows Malaysia's
potential energy solar production is only around 4.5 to 8 hours of free bountiful sunshine
daily. This study was conducted to analyze the potential energy on the fixed angle of PV
panels. Adjusting the angle of the panels will track the light intensity to maintain the right
angle for a long time to produce maximum electrical energy without consuming the large
unshaded area to save the trees.

Besides solar panel exposure to light intensity, fixed solar panels are not efficient
enough to receive light intensity and this will affect electricity production by PV panel
system. On top of that, some of the PV panel systems do not have an online monitoring
system to get related data to create research and analysis.

1.4 PROJECT OBJECTIVES

The objectives of this Project were:


i. To design a flexible tilt of PV panel system that can track the light
intensity
ii. To develop a database and online performance monitoring system of a
flexible tilt PV panel system
iii. To analyze the output voltage of a flexible tilt PV panel

1.5 SCOPE OF PROJECT

The purpose of this Project was to tilt a solar PV frame based on light intensity
with online monitoring. This Project's components and elements included an ESP32
microcontroller that directed a stepper motor to rotate perpendicular to the maximum
light intensity at 130 degrees. Furthermore, two BH1750 sensors can detect light

2
intensities up to 65536 lux. On top of that, the stepper motor NEMA 17 for the solar
tilt frame is the most robust bipolar motor. The A4988 motor driver controls the stepper
motor's direction and speed; the direction is left or right, and the speed (steps per
revolution) is 70. Next, a DC battery with a capacity of 12 volts and 1.2 amps was used
to supply power for the A4988 motor driver. Limit Switch to reset the pose of the
stepper motor. Furthermore, Raspberry Pi was used to act as a native server. The IoT
element has been applied by using Grafana, InfluxDB and NodeRed.

1.6 PROJECT SIGNIFICANCE

One of the Project's significances is sustainable energy, as solar is one of the


renewable energies that provide clean energy for all while reducing greenhouse gas
emissions produced by the sector. By utilizing renewable energy technologies as a key
technology for producing clean electricity.

1.7 DEFINITION OF TERMS

a) Electronics: Electronics is the study of electricity (the flow of electrons) and


how to use that to build things like computers. It uses circuits that are made
with parts called components and connecting wires to do useful things.
b) Mechanical: Objects that operated by machine or machinery
c) Electrical: Electricity is the flow of electrical power or charge. Electricity is
both a basic part of nature and one of the most widely used forms of energy.
d) Renewable energy: Renewable energy is energy derived from natural sources
that are replenished at a higher rate than they are consumed
e) Internet of things: The group of connected devices communicate using internet
to share the meaningful information or data which could be returned to
beneficial analysis for better decision value.

3
1.8 CHAPTER SUMMARY

From the problem arising from the recent study for fixed solar panels issue, the
objectives were created, inspiring the project aims to design a flexible tilt PV panel
system that can track light intensity. This project also developed the database and
online performance monitoring system of a flexible tilt PV panel and analyzed the
output voltage of a flexible tilt PV panel.

4
CHAPTER 2
LITERATURE REVIEW

2.1 INTRODUCTION

This chapter covers the project's background research and literature review.
The research on portal usability and a comparison of the current systems are the main
topics of this chapter. A successful system must include a literature review because it
can be used to highlight issues with the current system. In addition, it aids in
determining the optimal strategy for achieving the Project's goal considering the
research.

2.2 COMPARISON BETWEEN SOLAR PANEL TRACKER AND FIXED


SOLAR PANEL

There was a slightly different performance compared to both PV panels (fixed


and tracking systems) in energy generation. The research has been done to find out the
comparison of the solar panel tracker compared to the fixed-mounted system. Research
has been done by (Dr. Dhanabal Rengasamy, 2013) shows that the performance of
tracking PV solar was better compared to fixed PV solar, around 32.17% of producing
energy. Furthermore, the research also has been done by (Baraa Mahmoud Dawoud,
2021) to determine the performance of the large-scale Single Axis Tracker in Malaysia
found that the variation of around 15.08% increase of the Single Axis System
outperforms the fixed PV panels in first-year operation. Several more comparisons can
be made for fixed and tracking solar panels shown in Table 2.1.

5
Table 2.1: Ability of Solar Panel Tracker against Fixed Solar Panel

Fixed Solar Panel Solar Panel Tracker

Misses a portion of available light due to Faces directly at the sun all day, every
indirect angle with the sun. When light day. It receives the maximum potential
hits the panel at an indirect angle, some light intensity. Because of the
of it is reflected away perpendicular angle, no light intensity is
lost as glare

During the snow season, a fixed solar During the snow season, the solar tracker
panel is fully covered in snow and does not have any issues because it
produces zero energy moves throughout the day and vertically
at night. The snow tends to fall off

2.3 THE EXISTING CONCEPT OF THE SOLAR PANEL TRACKER


SYSTEM

The concept of solar panel tracker system, as researched by, (Asmarashid


Ponniran, 2011), (Deekshith K, 2015), (Ei Ei Aung, 2019) and (Hussain S. Akbar,
2017) was similar. The motor, which functions as the rotating element of the PV panel,
will operate according to the capacity of sunlight. The microcontroller, the heart of the
system, will receive the data from the sensor and control the motor rotation. Figure 2.1
shows the basic process flow of the solar panel tracking system, as suggested by the
researcher.

6
Figure 2.1: Flowchart of existing solar panel tracker that uses different components

2.4 TYPE OF PV SOLAR TRACKER

The Solar Panel Tracking System can be divided into Single Axis Solar Tracker
and Dual Axis Solar Tracker. The significant difference between both Solar Tracker
systems is the ability of the angle of the PV solar to track the sunlight. Dual Axis Solar
Tracker can track the sunlight with more angles than Single Axis Solar Tracker.

2.4.1 SINGLE AXIS SOLAR TRACKER

The research was done by (Dr. Dhanabal Rengasamy, 2013), showing the
single-axis solar tracker consisting of the PV panel controlled by the PIC18F877A
microcontroller. The input of LDR, which can detect light intensity, determines the
DC motor's rotation, resulting in the solar panel tilt accordingly. Figure 2.2 shows the
block diagram of the single-axis tracker system.

7
Figure 2.2: Block Diagram of Single Axis Tracker System (Dr. Dhanabal Rengasamy, 2013)

The block diagram shows the PV panel rotating using the DC motor control, resulting
in the solar panel tilt according to the position of the sunlight intensity. Two sensors
were used to collect the data on light intensity. Regardless, the Single Axis Tracking
system developed by (Deekshith K, 2015) uses the PIC microcontroller as a controller
and electro-optical sensor to detect the light intensity of the sunlight. Figure 2.3 shows
the single-axis tracking system design of their project.

Figure 2.3: Single-axis Tracking System Design by (Deekshith K, 2015)

The experimental setup of (Mst Jesmin Nahar, 2021) project used the initial angle of
PV solar setting up perpendicular to the sunlight. The project used LDR as a tracking
sensor, detects the sun's position and sends it to the PIC16F877A as the main
controller. The stepper motor was used in this project, rotated respectively to the data
8
from the sun tracking sensor. Figure 2.4 shows the block diagram of the Tracking Solar
System set up by (Mst Jesmin Nahar, 2021).

Figure 2.4: Block Diagram of Tracking Solar System by (Mst Jesmin Nahar, 2021)

From the experimental result of several projects related to the Single Axis Tracker
System, the overall increased performance output power gain was around eighteen
percent to thirty percent (18% to 25%) compared to fix-mounted PV solar. The
variation of the result depends upon the experimental location's geography and climate.

2.4.2 DUAL AXIS SOLAR TRACKER

Dual Axis Solar Tracker was developed by (Muhammad Shafiq Mohd Nazri,
2013), showing the ability of PV solar to track the sunlight more dynamically than
single-axis tracking. The system consists of four light sensors to detect the light in four
directions. As a result, the solar panel will revolve around tracking the solar to increase
the output power gain. Based on their experimental result, the Dual Axis Solar Tracker
might increase the power gain by around 27.4% compared to the fixed-mounted PV
solar. The Project also provides a monitoring system via the Internet of Things (IoT)
platform Blynk and Thingspeak. The IoT platforms' dashboard will show the system's
real-time charging capacity performance. Figure 2.5 shows the process flow of IoT
Monitoring for the Dual Axis Solar Tracker developed by (Muhammad Shafiq Mohd
Nazri, 2013).

9
Figure 2.5: Process of IoT Monitoring of Dual Axis Solar Tracker (Muhammad
Shafiq Mohd Nazri, 2013)

Figure 2.6 shows the circuit connection of the Dual Axis Solar Tracker using Arduino,
four Light Depending Resistors and a Servo Motor. Two potentiometers were used to
optimize the servo motor performance based on the LDR sensors' data.

Figure 2.6: Interfacing Dual Axis Solar Tracker Arduino Project Using LDR & Servo
Motors

10
2.6 ROTATION MECHANISM

2.6.1 STEPPER MOTOR

Stepper motors are motors that move in slow, precise and discrete steps. The
advantage of a stepper motor is that it has a high pole count that can produce precise
positioning steps. It has a control system that sends electrical pulses to a driver,
interprets them, and sends a proportional voltage to the motor to determine the rotation
angle. Stepper motor also has maximum torque at low speeds, making them suitable
for application that needs low speed with high precision. One stepper motor commonly
used with microcontroller ESP32 or Arduino is Nema-17. Nema-17 have a changeable
torque speed if applying different operating speed. The driver module is compulsorily
needed when working with Nema-17 purposely to control the speed and direction of
the stepper motor. Figure 2.7 shows the connection of the stepper motor with the
microcontroller ESP32 and the stepper driver module (A4988).

Figure 2.7: Connection of stepper motor with ESP32

(Mst Jesmin Nahar, 2021) in their research, they used the stepper motor to move their

Single Axis Solar Tracker according to the LDR data.

11
2.6.2 SERVO MOTOR

Servo motors are capable of providing very precise motion control. The Servo
motor is equipped with a feedback circuit capable of sensing the difference between
the actual and desired speed or position as the controller and will adjust the output to
correct any drift from the target position. There are advantages of using the servo motor
compared to the stepper, where the servo motor operates in a closed loop with feedback
while the stepper operates in an open loop with no feedback. At high speeds, servo
motors have high torque and are best suited for applications that involve dynamic load
changes. The limitation of servo motors is that they can only make the positional
around 180° motions. In solar tracker systems, some researchers used servo motors as
their rotation element to tilt their PV panels while tracking the sunlight, as shown in
the block diagram in Figure 2.8.

Figure 2.8: The block diagram of Dual Axis Solar Tracking System (Amit

Chakraborty Chhoton, 2017)

2.6.3 DC MOTOR

DC motor is a typical motor that use the interaction of magnetic fields and
conductor to convert electrical to mechanical energy for rotation. The most common
types of DC motors are brushed and brushless. The advantage of a DC motor is that it
can control the movement of the motor as simply as a switch; by applying the voltage,
the motor will be rotated forward or reverse. DC motor has high torque at low speed,
but at high speed, the torque value will gradually decrease. Figure 2.9 shows the DC
motor torque speed and torque current curve.
12
Figure 2.9: The DC Motor Torque Speed and Torque Current Curve

Usually, a DC motor is used for anything that needs to spin at high RPM since it can
provide fast and continuous rotation in no load conditions. Figure 2.10 shows the DC
motor used to control the rotation of the PV panel in (Deekshith K, 2015) Single Axis
Sun Tracker for PV system application.

Figure 2.10: The DC Motor mounted at the shaft to control the rotation angle of the

PV panel

13
2.7 LIGHT SENSOR

The research by Barsoum & Vasant (Devendra Pratap Singh, 2020) shows that
the PV solar system can be developed by using a light sensor to detect the sun's
radiation to give the angle of the motor rotation to tilt the PV panel. Their research
shows the result of increasing energy generated by PV solar by around 20% using a
single-axis solar tracking system.
There are various types of light sensors in the market with different ranges and
characteristics. Table 2.2 compares the light sensor of BH1750 and the Light
Depending Resistor (LDR).

Table 2.2: Comparison between the light sensor of BH1750 and LDR

BH1750 sensor was used to detect light as it does not require calibration. BH1750 does
not require external parts and can select two types of I2C addresses. It is a wide range
and has high light intensity resolution (1- 65535 lux). (Mst Jesmin Nahar, 2021) in
their research, the LDR was a photoresistor that can vary the resistance based on the
light intensity. The relationship between the resistance and the amount of light can be
expressed as:
Resistance = 500/ Light Intensity

From the equation, they suggested the findings of their research of the resistance of
sensors respective to the light intensity of the sunlight in different situations.

14
Table 2.3: The Light Intensity of Different Situations (Mst Jesmin Nahar, 2021)
Situation Light (Lux)
Direct Sunlight 100,000
In direct Sunlight 20,000
Cloudy Day 10,000
Office 350
Room with Candle 50

2.8 CHAPTER SUMMARY

This literature review indicates a tilt PV panel system is better than a fixed one
for maximum energy production. The solar tracking system can be divided into two
types, Single-Axis Solar Tracking and Dual-Axis Solar Tracking. Based on the
performance of both solar tracking systems, Dual-Axis Solar Tracking was better in
energy production since it can tilt more angles than Single-Axis Solar Tracking.
Meanwhile, in terms of cost, Dual-Axis Solar Tracking will yield more cost to be
developed compared to Single-Axis Solar Tracking. From the underpinning study,
most of the sensors for the tracking system were light sensors. The light sensor can
detect the light intensity at a certain angle to determine the rotation of the motor.
Various light sensors can be used in the solar tracking system, such as LDR and
BH1750. BH1750 detects light intensity more precisely than LDR without the
necessary calibration. The data from the light sensors can be used as the system's input,
and it will then compare the reading by ESP32 Microcontroller. Once it meets, the
conditioned motor will move. With the aid of motors (Stepper Motor, Servo Motor or
DC Motor), the PV panel can tilt according to the sunlight. This progress will visualize
in the IoT platform.

15
CHAPTER 3
RESEARCH METHODOLOGY

3.1 INTRODUCTION

Methodology is a method and technique for designing, collecting and analyzing


data to produce evidence that supports a study. Methodology describes how a problem
is studied and why a method and technique is used. This chapter will provide a wealth
of information regarding the methods and journey that led to the creation of my Project.
There is a flow chart and block diagram that illustrates how the Project works.

3.2 COMPONENTS & SOFTWARE USED

The components used were :


a) ESP32
b) Stepper motor Nema-17
c) A4988 motor driver
d) BH1750 light intensity sensor
e) Limit switch
f) DC battery 12V/1.2A
g) Voltage sensor
h) Raspberry-Pi

The software used was:


a) Autodesk Inventor Professional to design 3d model
b) Arduino IDE to create and modify assemble

16
Middleware used were:
a) Grafana Cloud as the online operational dashboard
b) NodeRed is interfacing between hardware and software
c) InfluxDB for database

3.3 PROJECT OVERVIEW

Smart Tilt Solar Panel Tracking with Online Monitoring was equipped with
two light-intensity sensors to track the movement of the sunlight. The BH1750 sensors
were used as light-intensity sensors. The sensor data will determine the stepper motor's
rotation angle, resulting in the tilting of the PV panel. The voltage sensor was used to
determine the performance of the energy produced by the PV panel.

3.4 BLOCK DIAGRAM

Figure 3.1: Block diagram of Smart Tilt Solar Panel Tracking with Online Monitoring

From the block diagram in Figure 3.4, the DC battery (power supply) was
connected to A4988 (stepper motor driver). Then, connect ESP32 to the power supply
to start to operate. Two BH1750 (light intensity sensors) connected to ESP32 will

17
compare which to each other to get the lightest intensity. Once it captures which one
gets the lightest intensity exposure, the stepper motor will tilt the solar frame
perpendicular to the light intensity. Stepper will hold the solar frame to a fixed position
once it gets the most light-intensity exposure.

NodeRed was used to deliver the motor's rotation angle according to the light
intensity sensor data. Figure 3.2 shows the NodeRed flow. This NodeRed flow is the
development tool to wire the hardware devices, such as sensors and motors, to give
and act according to the data. Since this project uses Message Queuing Telemetry
Transport (MQTT) as the protocol, it will work on a publish-and-subscribe data basis.
The Topic must be determined in the NodeRed flow as it will be the node for the system
to subscribe to if new data arrives from the sensors. Topics used were
esp32/bh1750/lux0, esp32/bh1750/lux1, esp32/pose and esp32/vout.

Figure 3.2: NodeRed Flow

When the PV panel is tilted according to the light intensity, the voltage sensors
will sense the energy produced accordingly based on the movement. These data also
will display on the NodeRed dashboard for analysis purposes. Apart from that, all data,
including voltage produced by PV solar and the motor's rotation angle, will
automatically be kept in the online database, InfluxdB. With the aid of a local server
such as Raspberry Pi, the real-time data will be kept and can be called if necessary.
Figure 3.3 shows the influxDB database accessible in the Raspberry Pi environment.

18
Figure 3.3 : InfluxDB accessible using RaspberryPi

Since NodeRed only serves as the local host, the data was floated online by
integrating the Grafana Cloud and NodeRed. By using the MQTT as the protocol to
communicate the software and middleware, the sensors' data will accumulate with
NodeRed and send to the influxDB for storage. The data then will be subscribed by
Grafana for display in gauge form as it will be more understandable by a user, as shown
in Figure 3.4. Grafana was to visualize the data from InfluxDB. It will visualize two
readings of the BH1750 light intensity sensor, the position of the motors and the output
voltage from the solar PV panel.

Figure 3.4: Grafana Dashboard using IP address of RaspberryPi

19
Figure 3.5: Flowchart for Rotated Motor Respective to BH1750 Sensor Reading of Smart
Tilt Solar Panel Tracking with Online Monitoring

20
3.5 SOLAR FRAME SYSTEM HARDWARE

The design and development of the Smart Tilt Solar Panel Tracking with Online
Monitoring started with the drafting of hand sketches. Then, the exact design was
drawn using Autodesk Inventor Professional to design a 3D model with detailed
dimensions as suitable for the sensor, especially for placing the sensors on the PV
panel. The detailed designs using Autodesk Inventor Professional for this project are
shown in Appendix F.

From the software designed for the case of the sensor, it was finally printed in 3D
using a 3D printer. The sensors with the casing were mounted after they were ready.
For PV panel which can be dynamically rotated based on the movement of sunlight, it
was designed using these materials:
a) 8 mm iron rod
b) Bearing two units
c) Aluminum-based as its supporter
d) Coupling Gear

Figure 3.6 shows the assembly form for all the 3D-designed and the dynamic
of PV panel.

Figure 3.6: Prototype model of Smart Tilt Solar Panel Tracking with Online Monitoring

21
3.6 CHAPTER SUMMARY

Smart Tilt Solar Panel Tracking with Online Monitoring was developed using
hardware, software and IOT Middleware. The interfacing using hardware and software
used the Arduino IDE as the basic programming tool to communicate with the
hardware, especially the ESP32 microcontroller. With the aid of the flow-based
programming NodeRed, the stepper motor's rotation will be determined according to
the light intensity sensors, BH1750. The data from the sensors (BH1750 and voltage
sensor) and the stepper motors' rotation angle were kept in the influxDB database,
which is accessible using Raspberry Pi. The Grafana platform, which serves as the IOT
middleware, was used to send the data online using the MQTT protocol that allows the
data to be viewed online. The prototype development used Autodesk Inventor
Professional and a 3D printer to produce unique sensor cases for this project. The
prototype also used the aluminum frame as well as the iron rod to grant the robustness
of this project prototype.

22
CHAPTER 4
RESULT AND DISCUSSION

4.0 INTRODUCTION

In this chapter, output voltage is shown as it results in a comparison of the


efficiency of using a tilt PV panel system over a fixed PV panel system. The voltage
readings were measured using a voltage sensor that has been connected to the panel.
A voltage sensor will monitor the amount of voltage in an object.

4.1 THE PERFORMANCE OF SMART TILT SOLAR PANEL


TRACKING WITH ONLINE MONITORING

Table 4.1 shows the performance of Smart Tilt Solat Panel Tracking with
Online Monitoring (Flexible Solar Panel) compare to the fixed one in terms of
voltage reading.

Table 4.1: The Voltage output obtained by PV Panel at Selected Time Interval

23
4.2 DISCUSSION

Based on the result, the tilt PV panel system's output voltage is higher than the
fixed PV panel system. This data is due to the tilt PV panel system's efficiency that can
track light intensity. With this ability, solar PV panels will get better exposure to light
intensity to generate electricity. Based on the results, the analysis was created by
placing this project in certain areas. By this method, we can decide the best area to
place and apply this Project

4.3 CHAPTER SUMMARY

In this chapter, the results were successfully obtained and analyzed using
Grafana and the NodeRed platform. The results proved that this Project had achieved
its objective. All the results were in real-time, with no delay, depending on the internet
connection. The BH1750 and voltage sensor successfully detect light intensity and
calculate the voltage. It will then visualize its reading on the IoT platform.

24
CHAPTER 5
CONCLUSIONS AND RECOMMENDATIONS

5.1 INTRODUCTION

This Project was successful because it achieved its objective. The research was
done based on solar tracker projects, which led to this objective: get optimum
electricity production from sunlight rays. The financial resource, the equipment, and
the components were all crucial for this project to work. I have explained the Project's
purpose, weaknesses, and functionality in the previous chapter.

5.2 CONCLUSIONS

This project proved that a tilt PV panel system could achieve better optimum
charging than a fixed one. The reading of a voltage sensor test for a tilt and fixed PV
panel system supported these results. A stepper motor also rotated the PV panel system
according to light intensity. RaspberryPi, which acted as a native server, also operated
perfectly for NodeRed, InfluxDb and Grafana.

25
5.3 FUTURE RECOMMENDATIONS

It is recommended that this Project use an additional two units of the BH1750
light intensity sensor in the future, bringing the total number of BH1750 light intensity
sensors to 4. Thus, the reading of the light intensity is more precise and accurate. This
will improve the ability of the tilt PV panel system to track light intensity as it gets
better readings from the light intensity sensor. Next, creating another angle of the axis
(a dual angle of the axis) is also one of the future recommendations. This Project can
currently only tilt on one axis.

5.4 PROJECT LIMITATIONS

Some of the project limitations for Smart Tilt Solar Panel Tracking With Online
Monitoring is that the design was not stiff enough to hold a stepper motor. Next, the
placement of the BH1750 light intensity sensors was too close, which made the
reading of 2 units of BH1750 only reach a minimum comparison as both readings were
quite similar. Next, in the absence of a proper case for the PCB board, by using a proper
case, the circuit could be better and look neater. Furthermore, the solar PV used could
only produce a maximum power of 50 watts.

5.5 SUSTAINABILITY

This Project achieved some of the Sustainability Development Goals (SDGs).


The SDGs globally have set 17 goals to change our world. They are a call to action to
end poverty and inequality, protect the planet, and ensure that all people enjoy health,
justice and prosperity (refer to SDGs in the figure below). Solar Energy is one of the
preferable generating energy due to the reliable renewable energy sources since it is
sustainable and clean (environmentally friendly). The performance of the energy
generation is highly affected by the tilt and perpendicular angle of the PV solar towards
the sun's position throughout the day. The problem with PV panel installation was the
occupied space with an unshaded area. In that case, the vast unshaded area of solar

26
space, usually by cutting down the trees, must be provided to produce efficient
electrical energy to yield a higher investment return. Adjusting the angle of the panels
will track the light intensity to maintain the right angle for a long time to produce
maximum electrical energy generation without consuming the large unshaded area to
save the trees as well as the environment.

5.6 CHAPTER SUMMARY

Smart Tilt Solar Panel Tracking with Online Monitoring was designed to
generate efficient energy using solar energy while consuming the limited unshaded
space. It is due to the ability of the PV panel only generate efficient electrical energy
at a perpendicular angle of the light intensity. This Project's primary control circuit is
based on an ESP32 microcontroller. The programming of this device is done so that
the BH1750 sensor will detect the sun's rays and provide direction to the rotating
stepper motor, tracking the light intensity. And so the PV panel will tilt and adjust
accordingly. This system uses the Node-Red as middleware to integrate the hardware
and accommodate the Grafana dashboard to show the performance of the voltage
output and the degree angle of the rotating stepper motor. Raspberry Pi 4 was used as
a native server, and InfluxDB as the database system to keep the data from the sensor.

27
REFERENCES

Amit Chakraborty Chhoton, N. R. (2017). Dual Axis Solar Tracking System-A Comprehensive Study:
Bangladesh Context. 4th Int ernational C onferenc e on Adv ances in Electric al Engineering
(pp. 421-426). Dhaka, Bangladesh: IEEE.

Asmarashid Ponniran, A. H. (2011). A Design of Low Power Single Axis Solar Tracking System
Regardless of Motor Speed. International Journal of Integrated Engineering, 5-9.

Baraa Mahmoud Dawoud, S. C. (2021). Performance comparison of fixed and single axis tracker
photovoltaic system in large scale solar power plants in Malaysia . Indonesian Journal of
Electrical Engineering and Computer Science , 10-17.

Control Stepper Motor with A4988 Driver Module and ESP32. (2022, September 16). Retrieved
December 6, 2022, from Microcontrollers Lab: https://microcontrollerslab.com/stepper-motor-
a4988-driver-module-esp32/

Deekshith K, D. A. (2015). Solar Tracking System. International Journal of Scientific & Engineering
Research, Volume 6, Issue 9, 994-999.

Devendra Pratap Singh, S. S. (2020). Performance Comparison of Fixed and Tracking Type Solar Plant.
International Journal of Innovative Technology and Exploring Engineering (IJITEE), 612-620.

Dr. Dhanabal Rengasamy, V. B. (2013). Comparison of efficiencies of solar tracker systems with static
panel single-axis tracking system and dual-axis tracking system with fixed mount.
International Journal of Engineering Science and Innovative Technology (IJESIT), 425- 430.

Ei Ei Aung. (2019). Single Axis Solar Tracking System. International Journal of Science and
Engineering Applications, 2319–7560.

Hussain S. Akbar, M. N. (2017). Efficient Single Axis Sun Tracker Design for Photovoltaic System.
IOSR Journal of Applied Physics (IOSR-JAP), 53-60.

Kapse Sagar Sudhakar, A. A. (2013). Automatic Street Light Control System. International Journal of
Emerging Technology and Advanced Engineering, 188-189.

M. A. Wazed, N. N. (2010). Design and Fabrication of Automatic Street Light Control System.
Engineering e-Transaction , 27-34.

M. Mahendran, H. O. (n.d.). An Experimental comparison study between Single-Axis Tracking and


Fixed Photovoltaic Solar Panel Efficiency and Power Output: Case Study in East Coast
Malaysia.

Mst Jesmin Nahar, M. R. (2021). Single Axis Solar Tracker for Maximizing Power Production and
Sunlight Overlapping Removal on the Sensors of Tracker. Internatioanl Journal of Robotics
and Control System, 186-197.

Muhamad Zaki Amin Marzuki, A. A. (2015). Fault Monitoring System for Traffic Light. Jurnal
Teknologi, 59-64.

Muhammad Shafiq Mohd Nazri, M. H. (2013). Development of Dual Axis Solar Tracker with IoT
Monitoring System. Journal of Engineering Technology, 156-162.

R H P Putra*, D. W. (2014). Designing Energy and Power Monitoring System on Solar Power Plant
Using Raspberry Pi. International Symposium on Materials and Electrical Engineering
(ISMEE) 2017 (p. 384). Creative Commons Attribution 3.0.

28
Radhi Priyasree, R. K. (2012). Automatic Street Light Intensity Control and Road Safety Module Using
Embedded System . International Conference on Computing and Control Engineering (ICCCE
2012). Coimbatore Institute of Information Technology .

YUEN, C. K. (May 2020). HIGH-RESOLUTION TEMPORAL SOLAR IRRADIANCE


MEASUREMENT. Kuala Lumpur: Universiti Tunku Abdul Rahman.

29
APPENDIX A: MILESTONE

xiv
APPENDIX B: ACTUAL COST

No. Component and materials The unit Quantity Total


price
1 BH1750 RM7.00 2 RM 14.00
2 ESP32 RM 20.00 1 RM 20.00
3 Limit Switch RM 3.10 1 RM 3.10
4 A4988 Motor Driver RM 9.00 1 RM 9.00
9 Capacitor RM 2.00 1 RM 2.00
10 DC battery 12 V , 1.2 A RM 50.00 1 RM 50.00
11 Solar PV panel RM 45.00 1 RM 45.00
12 RaspberryPi 4 8Gb RM 350.00 1 RM350.00
13 Stepper motor Nema17 RM 60.00 1 RM 60.00
14 Custom aluminium hardware RM 60.00 1 RM 60.00
15 Voltage sensor RM 3.00 1 RM 3.00
16 DC battery charger RM 40.00 1 RM 40.00
Total : RM 656.10
List of other costing
2 Postage RM 25.00
3 IoT Platform RM 20.00
4 Internet RM 35.00
Total : RM 80.00
Overall total RM 736.10

xv
APPENDIX C: DATA SHEET/SPECIFICATION OF COMPONENT

xvi
xvii
xviii
xix
APPENDIX D: PROGRAMMING CODES

Stepper motor

1 const int DIR = 4;


2 const int STEP = 2;
3 const int steps_per_rev = 70;
4
5 void setup()
6 {
7 Serial.begin(115200);
8 pinMode(STEP, OUTPUT);
9 pinMode(DIR, OUTPUT);
10 }
11 void loop()
12 {
13 digitalWrite(DIR, LOW);
14 Serial.println("Spinning CCW...");
15
16 for(int i = 0; i<steps_per_rev; i++)
17 {
18 digitalWrite(STEP, HIGH);
19 delay(250);
20 digitalWrite(STEP, LOW);
21 delay(250);
22 Serial.print("CCW pose: ");
23 Serial.println(i);
24 }
25 delay(1000);
26
27 digitalWrite(DIR, HIGH);
28 Serial.println("Spinning CW...");
29

xx
30 for(int i = 0; i<steps_per_rev; i++)
31 {
32 digitalWrite(STEP, HIGH);
33 delay(250);
34 digitalWrite(STEP, LOW);
35 delay(250);
36 Serial.print("CW pose: ");
37 Serial.println(i);
38 }
39 delay(1000);
40 }

xxi
2 units of BH1750 light intensity sensor

1 #include <Wire.h>
2 #include <BH1750_WE.h>
3 #define BH1750_0 0x23
4 #define BH1750_1 0x5C
5
6 BH1750_WE myBH1750_0 =
7 BH1750_WE(BH1750_0);
8 BH1750_WE myBH1750_1 =
9 BH1750_WE(BH1750_1);
10
11 void setup() {
12 Serial.begin(115200);
13 Wire.begin();
14 myBH1750_0.init();
15 myBH1750_1.init();
16
17 }
18
19 void loop() {
20 float lightIntensity0 = myBH1750_0.getLux();
21 Serial.print("Light intensity 0: ");
22 Serial.print(lightIntensity0);
23 Serial.print(" Lux");
24 Serial.print("\t");
25 float lightIntensity1 = myBH1750_1.getLux();
26 Serial.print("Light intensity 1: ");
27 Serial.print(lightIntensity1);
Serial.println(" Lux");
delay(1000);
}

xxii
Final coding

1 #define BLYNK_TEMPLATE_ID "TMPLhd62qxQe"


2 #define BLYNK_DEVICE_NAME "FYP"
3 #define BLYNK_AUTH_TOKEN
4 "94iI8PheqECRzrFWYf0tFEFjPW4QkkZl"
5 #include <Wire.h>
6 #include <AsyncMqttClient.h>
7 #include <WiFi.h>
8 #include <BH1750_WE.h>
9 #include <Blynk.h>
10 #include <BlynkSimpleEsp32.h>
11 #define BH1750_0 0x23
12 #define BH1750_1 0x5C
13 #define WIFI_SSID "Galaxy Tab A86067"
14 #define WIFI_PASSWORD "den123456"
15 #define MQTT_HOST IPAddress(192,168,186,208)
16 #define MQTT_PORT 1883
17 #define MQTT_PUB_BH1750_0 "esp32/bh1750/lux0"
18 #define MQTT_PUB_BH1750_1 "esp32/bh1750/lux1"
19 #define MQTT_PUB_Pose "esp32/pose"
20 #define MQTT_PUB_Vout "esp32/vout"
21 #define SIGNAL_PIN 33
22
23
24 BH1750_WE myBH1750_0 = BH1750_WE(BH1750_0);
25 BH1750_WE myBH1750_1 = BH1750_WE(BH1750_1);
26
27 const int DIR = 4;
28 const int STEP = 2;
29 const int SW = 34;
30 const int steps_per_rev = 70;
31 float adc_voltage = 0.0;
32 float in_voltage = 0.0;

xxiii
33 float R1 = 30000.0;
34 float R2 = 7500.0;
35 float tolerance = 1000.0; //ALWAYS CHANGE
36 float ref_voltage = 3.3;
37 int adc_value = 0;
38 int pose = 0;
39
40 char auth[] = BLYNK_AUTH_TOKEN; // You should get Auth Token
41 in the Blynk App.
42 char ssid[] = "Galaxy Tab A86067"; // Your WiFi credentials.
43 char pass[] = "den123456";
44 AsyncMqttClient mqttClient;
45 TimerHandle_t mqttReconnectTimer;
46 TimerHandle_t wifiReconnectTimer;
47
48 unsigned long previousMillis = 0;
49 const long interval = 10000;
50
51 void connectToWifi() {
52 Serial.println("Connecting to Wi-Fi...");
53 WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
54 }
55
56 void connectToMqtt() {
57 Serial.println("Connecting to MQTT...");
58 mqttClient.connect();
59 }
60
61 void WiFiEvent(WiFiEvent_t event) {
62 Serial.printf("[WiFi-event] event: %dn", event);
63 switch (event) {
64 case SYSTEM_EVENT_STA_GOT_IP:
65 Serial.println("WiFi connected");

xxiv
66 Serial.println("IP address: ");
67 Serial.println(WiFi.localIP());
68 connectToMqtt();
69 break;
70 case SYSTEM_EVENT_STA_DISCONNECTED:
71 Serial.println("WiFi lost connection");
72 xTimerStop(mqttReconnectTimer, 0);
73 xTimerStart(wifiReconnectTimer, 0);
74 break;
75 }
76 }
77
78 void onMqttConnect(bool sessionPresent) {
79 Serial.println("Connected to MQTT.");
80 Serial.print("Session present: ");
81 Serial.println(sessionPresent);
82 }
83
84 void onMqttDisconnect(AsyncMqttClientDisconnectReason reason) {
85 Serial.println("Disconnected from MQTT.");
86 if (WiFi.isConnected()) {
87 xTimerStart(mqttReconnectTimer, 0);
88 }
89 }
90
91 void onMqttPublish(uint16_t packetId) {
92 Serial.print("Publish acknowledged.");
93 Serial.print(" packetId: ");
94 Serial.println(packetId);
95 }
96
97
98

xxv
99 void setup()
100 {
101 mqttReconnectTimer = xTimerCreate("mqttTimer",
102 pdMS_TO_TICKS(2000), pdFALSE, (void*)0,
103 reinterpret_cast<TimerCallbackFunction_t>(connectToMqtt));
104 wifiReconnectTimer = xTimerCreate("wifiTimer",
105 pdMS_TO_TICKS(2000), pdFALSE, (void*)0,
106 reinterpret_cast<TimerCallbackFunction_t>(connectToWifi));
107 WiFi.onEvent(WiFiEvent);
108 mqttClient.onConnect(onMqttConnect);
109 mqttClient.onDisconnect(onMqttDisconnect);
110 mqttClient.onPublish(onMqttPublish);
111 mqttClient.setServer(MQTT_HOST, MQTT_PORT);
112 connectToWifi();
113 Serial.begin(115200);
114 Wire.begin();
115 myBH1750_0.init();
116 myBH1750_1.init();
117 pinMode(STEP, OUTPUT);
118 pinMode(DIR, OUTPUT);
119 pinMode(SW, INPUT);
120 Blynk.begin(auth, ssid, pass);
121
122 while (1) {
123 int state = digitalRead(SW);
124 digitalWrite(DIR, HIGH);
125 digitalWrite(STEP, HIGH);
126 delay(25);
127 digitalWrite(STEP, LOW);
128 delay(25);
129 Serial.print("CW pose continue");
130 Serial.print("\t");
131 Serial.println(state);

xxvi
132 if (state == HIGH) {
133 digitalWrite(STEP, LOW);
134 delay(250);
135 digitalWrite(STEP, LOW);
136 delay(250);
137 Serial.println("REACH!!!");
138 break;
139 }
140 }
141 }
142 void loop()
143 {
144 float lightIntensity0 = myBH1750_0.getLux();
145 float lightIntensity1 = myBH1750_1.getLux();
146
147 float diff_1 = lightIntensity0 - lightIntensity1;
148 float diff_2 = lightIntensity1 - lightIntensity0;
149 Serial.print("LUX_0: ");
150 Serial.print(lightIntensity0);
151 Serial.print("\t");
152 Serial.print("LUX_1: ");
153 Serial.print(lightIntensity1);
154 Serial.print("\t");
155 Serial.print("Diff_1: ");
156 Serial.print(diff_1);
157 Serial.print("\t");
158 Serial.print("Diff_2: ");
159 Serial.print(diff_2);
160 Serial.print("\t");
161 Serial.print("Pose: ");
162 Serial.println(pose);
163
164 if (diff_1 > tolerance) {

xxvii
165 //CCW
166 while (1) {
167 float lightIntensity0 = myBH1750_0.getLux();
168 float lightIntensity1 = myBH1750_1.getLux();
169
170 float diff_1 = lightIntensity0 - lightIntensity1;
171 float diff_2 = lightIntensity1 - lightIntensity0;
172
173 Serial.print("LUX_0: ");
174 Serial.print(lightIntensity0);
175 Serial.print("\t");
176 Serial.print("LUX_1: ");
177 Serial.print(lightIntensity1);
178 Serial.print("\t");
179 Serial.print("Diff_1: ");
180 Serial.print(diff_1);
181 Serial.print("\t");
182 Serial.print("Diff_2: ");
183 Serial.print(diff_2);
184 Serial.print("\t");
185 Serial.print("Pose: ");
186 Serial.println(pose);
187
188 digitalWrite(DIR, LOW);
189 digitalWrite(STEP, HIGH);
190 delay(25);
191 digitalWrite(STEP, LOW);
192 delay(25);
193 pose = pose + 1;
194 if (diff_1 <= tolerance) {
195 digitalWrite(STEP, LOW);
196 delay(25);
197 digitalWrite(STEP, LOW);

xxviii
198 delay(25);
199 Serial.println("STAY");
200 break;
201 }
202 }
203 }
204 if (diff_2 > tolerance) {
205 //CW
206 while (1) {
207 float lightIntensity0 = myBH1750_0.getLux();
208 float lightIntensity1 = myBH1750_1.getLux();
209
210 float diff_1 = lightIntensity0 - lightIntensity1;
211 float diff_2 = lightIntensity1 - lightIntensity0;
212 Serial.print("LUX_0: ");
213 Serial.print(lightIntensity0);
214 Serial.print("\t");
215 Serial.print("LUX_1: ");
216 Serial.print(lightIntensity1);
217 Serial.print("\t");
218 Serial.print("Diff_1: ");
219 Serial.print(diff_1);
220 Serial.print("\t");
221 Serial.print("Diff_2: ");
222 Serial.print(diff_2);
223 Serial.print("\t");
224 Serial.print("Pose: ");
225 Serial.println(pose);
226 digitalWrite(DIR, HIGH);
227 digitalWrite(STEP, HIGH);
228 delay(25);
229 digitalWrite(STEP, LOW);
230 delay(25);

xxix
231 pose = pose - 1;
232 if (diff_2 <= tolerance) {
233 digitalWrite(STEP, LOW);
234 delay(25);
235 digitalWrite(STEP, LOW);
236 delay(25);
237 Serial.println("STAY");
238 break;
239 }
240 }
241 }
242
243 Blynk.run();
244 Blynk.virtualWrite(V0 , lightIntensity0);
245 Blynk.virtualWrite(V1 , lightIntensity1);
246 Blynk.virtualWrite(V2 , pose);
247 // delay(250);
248
249 unsigned long currentMillis = millis();
250
251 if (currentMillis - previousMillis >= interval) {
252 previousMillis = currentMillis;
253 float lightIntensity0 = myBH1750_0.getLux();
254 float lightIntensity1 = myBH1750_1.getLux();
255 char lightStr0[8];
256 char lightStr1[8];
257 dtostrf (lightIntensity0, 1, 2, lightStr0);
258 dtostrf (lightIntensity1, 1, 2, lightStr1);
259 uint16_t packetIdPub1 = mqttClient.publish(MQTT_PUB_BH1750_0, 1,
260 true, String(lightStr0).c_str());
261 uint16_t packetIdPub2 = mqttClient.publish(MQTT_PUB_BH1750_1, 1,
262 true, String(lightStr1).c_str());
263 uint16_t packetIdPub3 = mqttClient.publish(MQTT_PUB_Pose, 1, true,

xxx
264 String(pose).c_str());
265 uint16_t packetIdPub4 = mqttClient.publish(MQTT_PUB_Vout, 1, true,
266 String(in_voltage).c_str());
267 }
268 adc_value = analogRead(SIGNAL_PIN);
269 adc_voltage = (adc_value * ref_voltage) / 4096.0;
270 in_voltage = adc_voltage / (R2 / (R1 + R2)) ;
271 Serial.print("Input Voltage = ");
272 Serial.println(in_voltage, 2);
273 // delay(500);
274 }

xxxi
APPENDIX E: USER MANUAL

xxxii
xxxiii
APPENDIX F: 3D DESIGNS
3D Designs
Version 1 (Sketch of 3d design)

Version 2(3D model)

xxxiv
Version 3(3D model + hardware)
Solar panel frame holder with two units of BH1750 slots

Stepper motor holder

xxxv
Solar panel frame holder

xxxvi

You might also like