0% found this document useful (0 votes)
175 views8 pages

Arduino Sunflower Project Report

This document describes an Arduino-based sunflower project created by Muhammad Talha Abid, Khawaja Muhammad Mushood, and Zeeshan Ali for their Digital Logic and Design Group. The sunflower uses two photo resistors and a servo motor connected to an Arduino UNO to track the movement of a light source by rotating its petals. The project aims to optimize the exposure of solar cells to sunlight and provide automatic outdoor lighting by having the sunflower follow the sun's movement across the sky.

Uploaded by

ZEESHAN ALI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
175 views8 pages

Arduino Sunflower Project Report

This document describes an Arduino-based sunflower project created by Muhammad Talha Abid, Khawaja Muhammad Mushood, and Zeeshan Ali for their Digital Logic and Design Group. The sunflower uses two photo resistors and a servo motor connected to an Arduino UNO to track the movement of a light source by rotating its petals. The project aims to optimize the exposure of solar cells to sunlight and provide automatic outdoor lighting by having the sunflower follow the sun's movement across the sky.

Uploaded by

ZEESHAN ALI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Arduino Sunflower

Subject: Digital Logic and Design Group #

Muhammad Talha Abid F2021266169


Khawaja Muhammad Mushood F2021266371
Zeeshan Ali F2021266171

Instructor: Arslan Anjum Section V3

Department of Computer Science


School of Systems and Technology (SST)
University of Management and Technology (UMT) Lahore

1|Page
2|Page
Introduction:
In this project, we present an Arduino-based sunflower that is designed to track the movement of
a light source using a servo motor and photo resistors. The sunflower is able to rotate its petals in
response to changes in the intensity of the light, allowing it to follow the sun or other light sources
as they move across the sky. The project is based on the Arduino microcontroller, which is a small
computer that can be programmed to perform a wide range of tasks, including controlling motors
and sensors, and processing data. The aim of this project was to develop Arduino based sunflower
to track the sun, we were able to optimize the angle at which the solar cells were exposed to the
sun, thereby increasing the amount of energy that was generated. In addition, the sunflower's
ability to follow the sun also makes it an effective lighting solution for outdoor spaces, as it can
automatically adjust the direction of its light source to match the position of the sun. In this report,
we will describe the design and construction of the sunflower, as well as the program that controls
its movement. We will provide a conclusion that summarizes whole project.

1. Hardware Components:
For this project we need 4 hardware components:
 Arduino UNO R3
 20mm Photo Resistors(2)
 Breadboard
 Jumper Wires

20mm Photo Resistors


Arduino UNO R3

Breadboard Jumper Wires

3|Page
2. Software Components:
We use Arduino official IDE Arduino 2.0 to program it.
In this program, the Servo library is used to control the servo motor that is connected to the
Arduino. The servo motor is used to rotate the petals of the sunflower in response to changes in
the intensity of the light, allowing the sunflower to track the movement of the light source as it
moves across the sky. The Servo library is included at the top of the program with the following
line of code:
#include Servo.h

3. Code and Configuration:

4. #include <Servo.h>
5.
6. int sensorPin = A0;
7. int servoPin = 9;
8.
9. int sensorValue = 0;
10. int servoGrad = 90;
11. int tolerance = 40;
12.
13. Servo myservo;
14.
15. void setup() {
16. pinMode( sensorPin, INPUT);
17. myservo.attach( servoPin );
18. myservo.write( servoGrad );
19. }
20.
21. void loop() {
22. sensorValue = analogRead(sensorPin);
23. if ( sensorValue <= (400-tolerance) )
24. {
25. if (servoGrad < 180)
26. servoGrad++;
27. }
28.
29. if ( sensorValue >= (400+tolerance) )
30. {
31. if (servoGrad > 0)
32. servoGrad--;
33. }
34.
35. myservo.write( servoGrad );

4|Page
37. delay(100);
38. }

EXPLANATION:
This is an Arduino sketch that controls a servo motor using an analog sensor. The servo is
connected to pin 9 and the sensor is connected to pin A0. The servo is set to an initial position of
90 degrees. The tolerance variable is used to set a range around the reference value of 400. If the
sensor value is below 400 - tolerance, the servo angle is incremented. If the sensor value is above
400 + tolerance, the servo angle is decremented. The servo angle is then written to the servo and
the loop delays for 100 milliseconds before repeating.

5: CIRCUIT DIAGRAM:

FIGURE (1)

5.2. BLOCK DIAGRAM:


5|Page
BATTERY

BREADBOARD
PHOTO-
ARDUINO UNO RESISTOR

SERVO
MOTOR

Loop
FIGURE (2)

6. Working: FIGURE (3)


Working of Arduino Sunflower:
 First, the necessary hardware components are gathered, including an Arduino UNO R3, two
20mm photo resistors, a breadboard, and jumper wires.
 The photo resistors are connected to the breadboard, and the breadboard is connected to the
Arduino UNO R3 using jumper wires. The photo resistors are used to detect changes in the
intensity of the light, and the breadboard is used to connect the photo resistors to the Arduino.
 The servo motor is connected to the breadboard using jumper wires, and the breadboard is
connected to the Arduino UNO R3 using jumper wires. The servo motor is used to rotate the
petals of the sunflower in response to changes in the intensity of the light.
 The Arduino IDE is used to write and upload the code to the Arduino UNO R3. The code uses
the Servo library to control the servo motor, and it reads the values from the photo resistors
using the analogRead () function.
 The Arduino sunflower is powered on and the code is executed. The servo motor is set to an
initial position of 90 degrees, and the photo resistors are used to detect changes in the intensity
of the light.

6|Page
 If the intensity of the light decreases (as detected by the photo resistors), the servo motor is
rotated to a higher angle, causing the petals of the sunflower to move in the direction of the
light source.
 If the intensity of the light increases (as detected by the photo resistors), the servo motor is
rotated to a lower angle, causing the petals of the sunflower to move away from the light
source.
 The servo motor is continuously adjusted based on the values from the photo resistors, allowing
the sunflower to track the movement of the light source as it moves across the sky.

7. Configuration:
Hardware Configuration:
 Connect the Arduino UNO R3 to the computer using a USB cable.
 Connect the breadboard to the Arduino using jumper wires.
 Connect the two photo resistors to the breadboard using jumper wires. Connect one end of each
photo resistor to analog input pin on the Arduino (A0). Connect the other end of each photo
resistor to a different power pin on the breadboard (e.g. 5V and GND).
 Connect the servo motor to the breadboard using jumper wires. Connect one end of the servo
motor to a digital output pin on the Arduino (e.g. 9). Connect the other end of the servo motor
to a different power pin on the breadboard (e.g. 5V and GND).

Software Configuration:
 Open the Arduino IDE and create a new sketch.
 Include the Servo library by adding the following line of code at the top of the sketch: #include
 Declare the necessary variables for the sensor pin, servo pin, sensor value, servo angle, and
tolerance.
 Initialize the servo object using the Servo library.
 In the setup function, set the sensor pin to INPUT and attach the servo to the servo pin. Set the
initial servo angle using the servo.write () function.
 In the loop function, read the sensor value using the analogRead () function and store it in the
sensor Value variable.
 Use An-If statement to check if the sensor value is less than or equal to the reference value
minus the tolerance. If it is, increment the servo angle.
 Use another if statement to check if the sensor value is greater than or equal to the reference
value plus the tolerance. If it is, decrement the servo angle.
 Write the servo angle to the servo using the servo.write() function.
 Add a delay at the end of the loop function to control the speed at which the servo moves.
 Upload the sketch to the Arduino using the upload button in the Arduino IDE.

7|Page
 Once the sketch is uploaded, the servo motor should start rotating the petals of the sunflower
in response to changes in the intensity of the light. The sunflower should be able to track the
movement of the light source as it moves across the sky.

8. Summary:
In summary, the Arduino Sunflower project involves the design and construction of an Arduino-based
sunflower that is able to track the movement of a light source using a servo motor and photo resistors. The
sunflower is able to rotate its petals in response to changes in the intensity of the light, allowing it to follow
the sun or other light sources as they move across the sky. The project was successful in demonstrating the
ability of the sunflower to optimize the angle at which the solar cells were exposed to the sun, thereby
increasing the amount of energy that was generated. In addition, the sunflower's ability to follow the sun
also makes it an effective lighting solution for outdoor spaces, as it can automatically adjust the direction
of its light source to match the position of the sun. The project involved the use of the Arduino
microcontroller and the Servo library, as well as hardware components such as photo resistors and a
breadboard. Overall, the project was a successful demonstration of the capabilities of the Arduino platform
for controlling motors and sensors, and processing data.

8|Page

You might also like