Professional Documents
Culture Documents
SESSION 1 2022/2023
POLITEKNIK SULTAN AZLAN SHAH
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
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.
iv
ACKNOWLEDGEMENTS
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
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
x
LIST OF FIGURES
xi
3.4 Grafana Dashboard using IP address of RaspberryPi 19
xii
LIST OF SYMBOLS
Symbols
lx Illuminance
xiii
LIST OF ABBREVIATIONS
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.
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.
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.
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.
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.
5
Table 2.1: Ability of Solar Panel Tracker against Fixed Solar Panel
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
6
Figure 2.1: Flowchart of existing solar panel tracker that uses different components
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.
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.
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.
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
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).
(Mst Jesmin Nahar, 2021) in their research, they used the stepper motor to move their
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
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
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
16
Middleware used were:
a) Grafana Cloud as the online operational dashboard
b) NodeRed is interfacing between hardware and software
c) InfluxDB for database
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.
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.
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.
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
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
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.
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
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.
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.
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 .
29
APPENDIX A: MILESTONE
xiv
APPENDIX B: ACTUAL COST
xv
APPENDIX C: DATA SHEET/SPECIFICATION OF COMPONENT
xvi
xvii
xviii
xix
APPENDIX D: PROGRAMMING CODES
Stepper motor
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
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)
xxxiv
Version 3(3D model + hardware)
Solar panel frame holder with two units of BH1750 slots
xxxv
Solar panel frame holder
xxxvi