Beruflich Dokumente
Kultur Dokumente
Abstract
In the following project, we designed and built a solar tracker which senses ambient light and
rotates to maintain direct alignment with the sun as it moves across the sky. The system is composed
of four light dependent resistors, an Arduino Due, a motor control shield, and two motors. The
resistance of each LDR varies based on the ambient light level, and the voltage across each of these
components acts as an analog input to the Arduino Due. By comparing the voltage from opposing
LDRs, the direction in which the tracker should rotate is computed. The motor shield then outputs a
voltage signal to start the motors. The system constantly polls the voltage difference between
opposing LDRs until it is zero, at which point the motors stop. The solar tracker also utilizes a Seeed
bluetooth shield to send data regarding system functioning to an Android phone. Dummy solar data
for system performance and energy production is also logged. This data is determined based on the
average kilowatt hour generation from a 6 kW solar system in Sydney, assuming 7 hours of direct
sunlight. The solar tracker was successfully tested first using a flashlight and then with ambient light.
Further work that could have been done to the system include mechanical design changes to decrease
gear belt failure, as well as the addition of a miniature solar array on the tilting panel to log real time
energy data.
2
1. Project Aims
The aim of this project was to design and build a mechanical device which uses a digital
microcontroller and light dependent resistors to track the movement of the sun across the sky, while
simultaneously rotating to directly face the sun [1]. It was also required that data regarding system
functioning be logged using bluetooth connection to a mobile device. It was chosen that motor angle,
number of rotations, north-south voltage, east-west voltage, response time, performance, and
projected energy generation data would be sent from the microcontroller when requested by a slave
device. Therefore, the solar tracker had both a considerable software and hardware component.
2. Performance Goals
The initial goal of this project is to build a sensor that would track changes in the direction
and angle of the sun. This was done by placing four light dependent resistors around a rectangular
opaque object, evenly spaced from one another [1]. As the sun rotates around this stationary sensor,
the ambient light casts a shadow from the opaque object across one or more of the light dependent
resistors. A light dependent resistor is comprised of an exposed semiconductor that alters its resistance
based on the amount of light it is exposed to. The resistance of one such resistor will be much greater
when it is placed in darkness, as compared to when it is in light due to the creation of electron-hole
pairs in the semiconductor material [2]. By placing a regular resistor in series with each light
dependent resistor and applying a single DC voltage across the two, the change in electrical resistance
will be converted to a voltage value. This voltage value will then change for different levels of light
along with the resistance. Thereby, a voltage divider is created. The voltage levels from the shaded
LDR and its opposite LDR are compared to find a difference, indicating the current direction of the
sun.
The next goal of this project was to use a digital microcontroller, the Arduino Due. The
Arduino Due possesses several analog input pins. Using these, the four sensor outputs were connected
to the Due. The program written for the Due then converted the analog inputs to a voltage difference
for the two pairs of opposing resistors. The Arduino program will maintain constant rotation of both
motors whilst the absolute value of the calculated voltage difference is greater than 0.1 Volts. The
direction of the rotations is dependent on the polarity of the voltage difference. To prevent the motors
from exceeding the rotational limit and the belts from slipping, a maximum and minimum angle was
created. When these thresholds are reached, the servo returns to the centre position and continues
rotating.
The third goal was to build the mechanical device to rotate the sensor according to the
calculated voltage difference so that the sensor is consistently facing the sun directly. When the
voltage difference is nonzero, an voltage signal is output by the motor shield to rotate the motors in a
specified direction. The device stops rotating, or is delayed, when no shadow is cast by the opaque
object across the four light dependent resistors. Tilting of the sensor panel is primarily dependent
upon a ball-and-socket joint, as well as a set of drive belts and two motors that move the top panel in
either a north-south direction or an east-west one.
After testing both the sensor and mechanical device separately, the two were integrated.
Successful integration of the hardware and software components of this project was the final goal of
this project. Once these two portions were successfully tested, a bluetooth shield could be used to send
system performance data to a mobile device. Dummy solar production data, based off of average solar
production for 6 kW home arrays in Sydney and the responsiveness of the tracker to the sun’s
movement across the sky, is calculated by the Arduino Due. An Android phone can connect then to
the Arduino Due master and send the character ‘s’ to receive this data as well as information regarding
3
the tracker’s functioning like motor angle and analog voltage readings. An summary of the
implementation of the solar tracker can be found in Appendix 2.
3. Design
The sensor circuit was connected to the Arduino’s analog pins. The values read by the pins
range from 0 to 1023, which corresponds to a floating point voltage value between 0 and 3.3. The
Arduino program compares the east and west voltages with each other and the north and south
voltages. The resulting comparison values inform the behaviour of the servo motors. The motors
rotate towards to light dependent resistor with the higher voltage value. If both values are equal, the
rotation is delayed. The Arduino library possesses a digitalWrite function which is used to control the
motor’s direction and whether or not the servo is rotating.
The Arduino Due possesses multiple UART’s. This allows the Due to maintain a serial
connection with a connected PC and a bluetooth device. The implemented embedded system writes
data to the connected system, and when toggled, sends the data to a connected master bluetooth
device. The program keeps track of the voltage values, the position of the servo, number of rotations
and estimated power generated.
3.5 12 V 1 A Motors
The solar tracker uses two motors for adjusting the top panel. Each motor has a positive and a
negative pole, which connect to the DFRobot motor shield through screw terminals. One motor
controls tilting in the north-south direction, while another motor controls tilting in the east-west
direction. When the voltage difference between two opposing LDRs is nonzero, the corresponding
motor will rotate to equalize the ambient light across the two LDRs. Once the voltage difference
becomes zero, the rotation will stop. For example, if the north LDR is more shaded than the south
LDR, the north-south motor will rotate counterclockwise until both LDRs are experiencing the same
light level. The opposite would occur if the south LDR was experiencing more shading.
At the end of each motor shaft is a large plastic gear with a tooth ratio and sizing which
matches the kinks in the gear belt attached to it. Therefore, when a motor rotates, the gear teeth pull
the gear belt more taught in the direction of rotation.
Rotation was achieved using the Arduino library digitalWrite function. Parsing ‘high’ to the
function initiated rotation. The servo rotates until it receives a ‘low’ signal. Hence, with the use of a
delay, it is possible to track the angle the servo has rotated. After trialling the servo’s rotational
velocity, it was found that it takes 345ms for the servo to rotate 15 degrees, with the speed control set
to ‘high’ using the digitalWrite function. Hence, after rotating the servo for 345ms, we can increment
a variable keeping track of the servo motor angle. Using this added functionality, it is possible to
prevent the motor from exceeding 180 degrees in rotation. When the servo reaches 180 degrees, it
rotates in the opposite direction for 4140 ms, which corresponds to 180 degrees of rotation, thus
returning to the central position.
4. Function Analysis
The designed embedded system successfully combined the implemented hardware and
software components. The design relies on the voltage divider created by the LDR’s. The voltage
across each light dependent resistor is compared using the Arduino Due. Using the comparison values,
the servos are either rotated clockwise, counter-clockwise or delayed, with the DFRobot Motor Shield
and the Due. Each servo’s position and the number of successful rotations were recorded. In addition,
dummy data was used to estimate the power generated should a solar panel be affixed to the tracker.
This data is transmitted to a paired master device using a bluetooth shield and the Arduino’s UART
capability. Thus, the solar tracker fulfilled the design objectives, with the software and hardware
working in tandem.
5. Testing Methodology
The solar tracker was tested rigorously. Various testing procedures were implemented for
both the hardware and software. Each motor was tested independently to ensure they worked and were
compatible with the motor shield. The program which was initially written simply rotated the motors
in various directions. It was found that using the analogWrite function, as recommended by the motor
shield documentation caused the motors to stall. Further functionality was added to the initial program
to test motor delays. The sensor circuit was tested using the Analog Discovery 2, in particular the
multimeter and oscilloscope. Theoretical voltage values were determined for nodes in the sensor
circuit using DC circuit analysis. These values were compared to the actual values read using the
multimeter to ensure the circuit was working correctly. Once it was confirmed that the sensor circuit
and servo motors were working correctly, the two were combined. Print statements were used to
7
verify that voltage values being read by the Arduino correctly corresponded to current the ambient
light levels. Similarly, the assert.h library was used to verify that values such as the servo position and
number of rotations were being incremented correctly.
6. Results
The design worked as expected. Using the Analog Discovery 2, it was verified that the servo
motors rotate towards the LDR with the highest voltage, under both ambient light and a flashlight.
The measured voltage values also corresponded to the theoretical values calculated using LTSpice, as
seen in Appendix 3. The Analog Discovery 2 was also utilised to ensure that the voltage mapping
equation used to ensure that analog inputs were correctly converted to a voltage value. As expected,
each servo only rotated a maximum of 180 degrees. The tracker successfully paired with a master
bluetooth device. An Android phone, using ‘Serial Bluetooth Terminal’ was able to receive the
computed data from the solar tracker, as seen in Figure 3. The complete labor and parts costs for the
solar tracker are described in Appendix 5. The final solar tracker looks very similar to what was
initially proposed, as there were no design changes made to the physical structure. The completed
solar tracker is shown in Figure 4 below.
7. Proposed Improvements
If another iteration of the solar tracker were to be built, there are three main improvements
that would be made. First, in addition to the Bluetooth connectivity, the solar and performance data
would be stored in a cloud-based server. This way, users could not only receive real-time data from
the Arduino, but they could also analyse historical data. It would also be interesting to feed that
historical data back to the Arduino Due and use it in conjunction with an algorithm to optimize
efficiency. For example, the solar tracker could use rotation data from previous days with similar
weather conditions as the current day and use it to rotate proactively rather than responsively. In
theory, this would greatly improve performance as well as energy generation.
Additionally, a proper ball-and-socket joint as well as rubber gear belts to accurately match
the motor gear teeth would be made. The ball-and-socket joint could be 3D printed, whereas the gear
belts could be molded or purchased from a wholesaler. While the improvised ball-and-socket joint
rarely failed, it would be replaced for aesthetic reasons. The wire gear belts, on the other hand, failed
quite frequently due to bending or slipping. Rubber is a preferred material because of its elasticity; it
will stretch but not deform. It would also provide greater friction than the aluminum wire, which
should decrease the chances of slipping. However, it may still be necessary to rim the gears in some
way as to hold the rubber gear belts in place if slipping continues to occur.
Finally, solar panels would be added to the top panel of the tracker so that actual solar power
could be generated. This way, dummy solar data would not need to be used in Arduino computations.
An actual performance rating and daily energy generation could be computed based on real time light
levels. The addition of a solar array was tentatively proposed at the start of this project, but it was
always meant to be implemented in further iterations. The eventual installation of solar panels was
kept in mind when designing the tracker, however, so no changes would need to be made to the top
plane for it to accommodate panels. Putting solar panels on the solar tracker and beginning to generate
energy is the only thing initially proposed for this project that was not accomplished.
9
8. Conclusion
The purpose of the designed embedded system was to build a functional solar tracker using
easily obtainable materials. The design objectives were all achieved, with the tracker successfully
maintaining rotation to minimise it’s angle with sun. Whilst further improvements can be made, the
embedded system is self contained, and with a reliable power source, can be implemented in the real
world.
9. References
[1] ‘Solar Tracker’ 20 March 2018
http://sunenergy75.blogspot.com.au/2006/10/the-sun-tracker-reloaded.html
[2] ‘Light Dependent Resistors’ 20 March 2018
https://www.electronics-tutorials.ws/io/io_4.html
[3] ‘Arduino DUE Documentation’ 7 April 2018
https://store.arduino.cc/usa/arduino-due
[4] ‘Arduino Motor Shield Documentation’ 7 April 2018
https://store.arduino.cc/usa/arduino-motor-shield-rev3
[5] ‘SAM3X-Arduino Pin Mapping’ 7 April 2018
https://www.arduino.cc/en/Hacking/PinMappingSAM3X
[6] ‘Design and Construction of an Automatic Solar Tracking System’ 29 May 2018
https://www.researchgate.net/publication/236577196_Design_and_Construction_of_an_Automatic_S
olar_Tracking_System
[7] ‘Position of the Sun’ 6 April 2018
http://aa.quae.nl/en/reken/zonpositie.html
[8] ‘Design and Implementation of a Sun Tracker with a Dual-Axis Single Motor for an Optical
Sensor-Based Photovoltaic System’ 29 May 2018
http://www.mdpi.com/1424-8220/13/3/3157
[9] ‘Sunshine Hours for Australian Cities’ 2 June 2018
https://www.livingin-australia.com/sunshine-hours-australia/
[10] ‘6kW Power System Production’ 2 June 2018
https://solaray.com.au/6kw-solar-power-system-price-output-savings/
10
Block Descriptions:
1. Input to system was ambient light from the sun that affected the resistance of four light
dependent resistors.
2. Voltage divider composed of one light dependent resistor and a 10 kΩ resistor, with one
divider for each direction (north, south, east, west).
3. Motor shield for controlling and driving the two motors.
4. Main code, responsible for comparing LDR voltages, tracking motor rotation, and generating
system performance data.
5. Bluetooth shield which connects android phone as slave to send and receive tracker data.
6. Digital microcontroller for running main code and performing computations.
7. Two 12 V, 1 A motors used to tilt the main panel in two directions, north-south and east-west.
8. 12 V external battery plugged into power jack on Arduino Due to supply motors.
9. Android phone which acts as slave to Arduino due master, sends character ‘s’ to receive
tracker data over bluetooth connection.
Category List of items, with web link or page number where item is
described
Open source compliance We are not publishing our code as open source. However, various
iterations of our project code are visible on GitHub through the
following link:
Are you publishing your code as open
https://github.com/sav-ith/solar-tracker/
source? Explain what license you are
using, or link to where you have
published your project.
11
Platforms Our solar tracker uses the ARM processing architecture on the
Arduino Due. The system code is written in C and uses the
Arduino library, as well as the DFRobot motor shield library. The
List the platforms you have used,
Arduino compiler and IDE was also used for this project. The
including processor architecture (ARM,
Arduino Due platform was chosen because it was familiar and we
AVR, x86, etc.), programming languages
were most comfortable using it after completing the ELEC3607
(Python, C, C++, etc.), and IDEs. If you
laboratories.
are not using Arduino Due, justify your
choice of platform.
Sensors and inputs The solar tracker utilizes four light dependent resistors to sense
ambient light levels (i.e. brightness and darkness). Each of these
forms a voltage divider with a regular resistor, and the voltage
List your hardware inputs (push buttons,
drop across each LDR is an analog input to the Arduino Due.
analog sensors, I2C or SPI sensors
These inputs are discussed on page 4 of the report under
including accelerometers, etc.) and
subsection 3.1 Light Dependent Resistors.
mention on which page each input is
described.
Outputs The solar tracker uses a DFRobot L293 motor shield to output a
voltage to two 12 V, 1 A motors. These motors, and the
corresponding drive belts, rotate to tilt the top panel of the
List any mechanical, visual or other type
tracker. A Seeed Bluetooth shield is also connected to the
of outputs controlled by your hardware
Arduino Due and used to connect an Android phone as a slave
(motors, magnets, LED, 7-Segs, LCD,
device. Data is then sent to the phone upon request. These outputs
etc.) and mention on which page each
are discussed on pages 4 and 5 of the report under subsections
input is described.
3.3, 3.4, and 3.5 respectively.
Connectivity There are two protocols used for communicating between the
main microcontroller, the Arduino Due, and external
devices/actuators. First, USART is used to connect the Arduino
List any protocols used for
Due to the Seeed Bluetooth shield. Next, this same shield is used
communicating between your main
to establish a Bluetooth connection to an Android phone for
controller and any other microcontroller
sending data. The use of Bluetooth for this project is described on
excluding sensors or actuators (USART,
page 5 of the report in subsection 3.4. The serial monitor was also
UART over USB, Bluetooth 2,
used for testing the solar tracker before Bluetooth connectivity
Bluetooth 4, Wi-Fi, ZigBee, etc.) and
was implemented, as described on page 8 of the report under
mention on which page each input is
section 5. Testing Methodology.
described.
Graphical User Interface A Bluetooth terminal phone app is used for sending data requests
to the Arduino Due master and for receiving data. This GUI is
described on page 5 of the report in subsection 3.4.
List any GUI used for interfacing users
(local LCD, Phone app, Desktop app,
Web app, Web dashboard, etc.) and
mention on which page each input is
described.
12
Algorithms / Logic The value read by the analog pins maps to a voltage using the
following formula:
3.3
V oltage = analogRead(P IN ) × 1023
List substantial control algorithms
(state-machines, real-time operating The east and west and north and south voltage were subtracted
system, filesystems, feedback from each other respective. If the resulting voltage was positive,
algorithms, mathematical the variable parsed to the servo’s digitalWrite function was set to
transformations, etc.) and mention on ‘high’. Conversely, if the resulting voltage was negative, the
which page each input is described. variable was set to low.
Physical case and other The solar tracker is composed of cardboard for the base, the
tilting top panel, and the opaque object. The post of the tracker is
mechanical consideration made of PVC pipe, with two metal pipe saddle clips for holding
the motors. Additionally, the ball-and-socket joint is made of the
List what casing or mechanical systems open end of a PVC pipe and a bouncy ball. All of these objects
have been used in your project (3d were bonded together using a quick-setting epoxy. The gear belts
prints, pipes, cardboard mechanics, etc.) are each made of a wire that was bent to fit the tooth sizing of the
and mention on which page each input is plastic gear on each motor. The belts were attached to the top
described. panel using tape. The physical composition of the tracker is
described on page 7 of the report under subsection 3.6 Physical
Device.
Figure 6. Comparator circuit schematic; not used in final implementation of solar tracker.
10 kΩ Resistor 4 0.80
12 V, 1 A Motor 2 29.90
Gear 2 5.40
14
Epoxy 2 8.40