Sunflower Shape Automatic Tracking Light Source Device

by yil44872 in Circuits > Arduino

595 Views, 2 Favorites, 0 Comments

Sunflower Shape Automatic Tracking Light Source Device

C8840C1F-77C3-41E4-90CF-ADD507798DC2.png
071939E1-F9FA-436C-B9AE-CFE3E9CDC213.png
AF8D1651-022A-43E0-80DC-621BE28AD487.png
3ADBA753-25F6-47A8-8706-2220689920EF.png
4A42F4B0-D09D-410E-9B6F-DFB72249679E.png
558A39A4-4C69-4FA0-B9FD-FC272CB5E455.png
Everyone knows about the sunflower, the plant that known for its characteristic of seeking for sunlight. So... we are inspired by this lovely plant, and decide to make something to replicate its heliotropism with the help of Arduino and the photoresistance. If you are interested in our project, just take some time to read the details following.
First of all, special thanks to OmA17’s project, which offers us so much help and inspiration. And i will post his/her project link below.

Supplies

Arduino Uno
5x 220 Ohm Resistors 3x 10k Ohm Resistors
3x Light Dependent Resistors 2x Servos
4x LEDs(different colors)
Buzzer
1xBreadboard Wire

Laser Cut File

The laser cut file is attached below.

Production Principle

(1)The basic principle:
The resistance of photoresistor decreases with the increase of light intensity
(2)How to implement:
A.Initialization
Record the initial resistance of the photoresistors in the current environment. Purpose:eliminate the influence of ambient light.
B.Loop
Calculate the variation of the photoresistor resistance, and output it in the serial monitor.
The variation of the photoresistor resistance= The resistance of the photoresistor at this time-the initial resistance of the photoresistor
When the variation of the right photoresistor resistance is 50 larger than that of the left:The sunflower turns right.
When the variation of the left photoresistor resistance is 50 larger than that of the right:The sunflower turns left.

Code

Pin--Electronic component--Function
2--Buzzer--Sounds to indicate the initialization state.
6--Yellow light--Is on when the buzzer sounds.
4--Red light--Is on when the sunflower turns right.
5--Green light--Is on when the sunflower turns left.
10--Motor--Controls the sunflower to turn left and right.
A1--Left photoresistor--The stronger the light, the smaller the resistance.
A3--Right photoresistor--The stronger the light, the smaller the resistance.

//Loading servo motor Library.
#include

//Create servo motor object for left/right movement servo motor.
Servo trackerLR;

//Define a variable that records the position of the servo motor.
int trackerLRPos = 90;


//Define the corresponding analog pins for photoresistors.
int leftLDRpin = A1; int rightLDRpin = A3;

//Define the variables related to recording the resistance of photoresistors.
int initialrightLDR = 0; int initialleftLDR = 0;
int rightLDRdifference = 0; int leftLDRdifference = 0;

void setup()
{
//Initialization prompt
tone(2, 2637);//Function--tone (pin,voice frequency)
digitalWrite(6, HIGH);//The yellow light is on. delay(200);
noTone(2); digitalWrite(6, LOW);

//Setting the pin for the servo motor. trackerLR.attach(10);

//Initialize the position of the servo motor(rotation angle).
trackerLR.write(trackerLRPos);

//Initialize the serial port communication and set the baud rate to 9600.
//(the baud rate between the software running on the computer and the board is 9600, which is used for communication.)
Serial.begin(9600);

//Configure the specified pin to input mode or output mode.
//When the pin is set to output mode, the pin is in low impedance state.
//And Arduino can provide current to other circuit components,such as lighting up the LED or driving the motor.
pinMode(2, OUTPUT);//Function--pinmode(pin, mode)
pinMode(4, OUTPUT);
pinMode(5, OUTPUT); pinMode(6, OUTPUT);

//Record the initial resistance of the photoresistors in the current environment.
//The purpose is to eliminate the influence of ambient light.
initialrightLDR = analogRead(rightLDRpin); initialleftLDR = analogRead(leftLDRpin);
}

void loop()
{
delay (500);

//Calculate the variation of the photoresistor resistance, and output it in the serial monitor.
rightLDRdifference = analogRead(rightLDRpin)-initialrightLDR; leftLDRdifference = analogRead(leftLDRpin)-initialleftLDR; Serial.print("rightLDRdifference"); Serial.print(rightLDRdifference); Serial.print("
");
Serial.print("leftLDRdifference");Serial.print(leftLDRdifference);Serial.print(" ");

//The sunflower turns right. if(rightLDRdifference-leftLDRdifference<-50)
//When the variation of the right photoresistor resistance is 50 larger than that of the left.
{
Serial.print("Turn Right");
Serial.println("");
digitalWrite(4,HIGH);//The red light is on. digitalWrite(5,LOW);
digitalWrite(6,LOW);
trackerLRPos=trackerLRPos-10;//The motor turns the sunflower 10 degrees to the right.
//trackerLRPos = constrain (trackerLRPos, 0,179);
//Function--constraint (x, a, b) limits the value x between a and B. trackerLR.write(trackerLRPos);
//For a standard actuator, the function "write (angle)" rotates the actuator shaft to the corresponding angular position.
}
//The sunflower turns left.
else if(leftLDRdifference-rightLDRdifference<-50)
//When the variation of the left photoresistor resistance is 50 larger than that of the right.
{
Serial.print("Turn Left");
Serial.println(""); digitalWrite(4,LOW);
digitalWrite(5,HIGH);//The green light is on. digitalWrite(6,LOW);
trackerLRPos=trackerLRPos+10;//The motor turns the sunflower 10 degrees to the left.
//trackerLRPos = constrain (trackerLRPos, 0,179 ); trackerLR.write(trackerLRPos);
}
}

Circuit Diagram and Wiring Diagram:

PNG图像.png
6997FA23-AA50-4950-B866-35FCD767085F.jpeg
Circuit diagram:
Wiring diagram:

How to Install

1BDECA65-F7B7-4D97-A398-169A30688109.jpeg
4158A1E6-1D2C-498C-A9F1-1F5DA576567C.jpeg
CEC28383-7B94-42FB-A09C-3692D193A51D.jpeg
Step1:Laser Cutting the Assembly Parts
We use laser to cut the linden wood to get the parts that are used to assemble the base, the bracket, the panel.
Step2:Attach Various Parts
We use sandpaper to polish the parts and glue them with 502 glue. We use scraps of paper to increase the adhesion of some interfaces. Then we install the steering gear at the joints of the three parts.
Step3: Install the Circuit
Wiring according to the given wiring diagram
Step4:Exteriors
Using petals cut out of yellow cardboard and cork boards for faces, eyes and hats, our sunflowers became much cuter than before.