top of page
IMG_20170503_173438.jpg

Post

Scientist activity for 6th grade: How to make a sun tracker with a servo motor and Arduino



Introduction


Hello! Welcome to our blog.


At Makersgeneration, we provide kids with resources to carry out easy science experiments. We also provide project ideas you can carry out using some electronic kits with Arduino, one of which we will look at in this post.


In today's lesson, we will be learning how to make a sun or solar tracker using Arduino and other electronic components, such as servomotor and Light Dependent Resistor (LDR). Sounds interesting right?!! follow us as we discuss how.



What is a Solar tracker?


A solar tracker is a device that automatically adjusts the orientation of a payload towards the sun. This payload can be anything, but for the sake of this project, our payload will be the solar panel.


A solar panel is a device that converts sunlight into electricity and needs to be constantly facing toward the Sun to get as much energy as possible. But the Sun doesn't stay in one position the whole day: it rises in the East in the morning and sets in the West in the evening. So to capture solar energy throughout the day, we need a solar tracker to continuously track and point our panel in the current direction of the Sun.


Our solar tracker will consist majorly of three components:

  1. Light sensors (LDR) - This tracks the intensity of sunlight from any given direction.

  2. Motors (Servomotor) - This handles the movement of the panel from one direction to the other.

  3. The controller (Arduino) - This is the brain of the system. It takes the readings from the light sensors and then activates the motors accordingly.



Now, let's get busy learning how to make our model of a solar tracker. But first, let's run through the list of materials we will need:


Required materials



  • Arduino Uno board

  • 1 Servo motor

  • 11 Male-Male jumper wires

  • Cardboard paper

  • Pencil

  • Ruler

  • Scissors

  • Glue / Tape

  • Toothpick (or any round object of similar size like a screw)



Building the Solar tracker


Step 1:

Cut out a rectangle from the cardboard measuring 10x6 inches. This will serve as the base of the tracking system.




Step 2:

Cut out two other portions from the cardboard measuring 2x6 inches. This will serve as the pillar to hold the solar panel in place.



Step 3:

Close to the end of one of the pillars, cut out a horizontal rectangle the size of the servo motor. On the same spot in the second pillar, mark a point to make a hole later.





Step 4:

Attach the solar panel pillars to the base cardboard with glue with spacing of 6 inches between them. Add additional cardboard cutouts to the base of the pillars to support as shown.




Step 5:

Next, cut out a square from the cardboard paper with dimensions 5x5 inches. This will serve as a model for the solar panel.



Step 6:

Now, let's go into the electronics starting with the LDR connection. Assemble and connect your as shown below:






Step 7:

Make a hole on two opposite ends of the solar panel cardboard cutout, pass the heads of the two LDRs through the holes then secure the wired sections to the other side with tape.






Step 8:

Adjacent to the sides with LDRs, attach the servomotor in the middle with glue or tape (or both).



Step 9:

Make a tiny hole in the pillar that was previously marked with a point and fix a toothpick or screw as shown:




Step 10:

Next, fix the servomotor through the previously cut hole in the pillar (with the motor wires facing away from you), then attach the opposite side of the panel to the screw or toothpick attached to the other pillar. Secure the screw/toothpick to the panel with glue.





Step 11 - Circuit


Let's complete the circuit wiring:


  • Red wires (5V)

  • Black wires (GND)

  • Purple wire (analog Pin A1)

  • Blue wire (analog Pin A2)

  • Green wire (Pin 9)









Code


// import servomotor library
#include <Servo.h>

Servo myservo;  // create servo object to control a servo

// select the input pins for the LDRs
int LDR_pin1 = A1;    
int LDR_pin2 = A2;  

// variable to store the values from the LDR sensors
int LDR_value1 = 0;    
int LDR_value2 = 0;  

void setup() {
  Serial.begin(9600);   // initialize serial monitor
  myservo.attach(9);    // attaches the servo on pin 9 to the servo object
}

void loop() {

  // read the value from the sensor:
  LDR_value1 = analogRead(LDR_pin1);    
  LDR_value2 = analogRead(LDR_pin2);   

  // calibrate sensor reading from 0 - 1023 to 0 - 100 (%)
  LDR_value1 = map(LDR_value1, 0, 1023, 0, 100);
  LDR_value2 = map(LDR_value2, 0, 1023, 0, 100);

  // print LDR values (in %) on serial monitor
  Serial.print("LDR_1: ");        
  Serial.print(LDR_value1);
  Serial.println(" %"); 
  Serial.print("LDR_2: "); 
  Serial.print(LDR_value2);
  Serial.println(" %");
  Serial.println("");

  // control servomotor direction according to light intensity
  // edit the LDR values according to the light intensity of your environment.
  if (LDR_value1 > 80){
    myservo.write(150); 
  }
  else if ((LDR_value1 < 40) && (LDR_value2 < 40)){
    myservo.write(100);
  }
  else if (LDR_value2 > 80){
    myservo.write(50); 
  }
  
  delay(1000);
}


Video Demo




If your solar panel is tilting in the direction with the most light, Congratulations you did it!!


Thanks for staying till the end, we hope to see you next time!



If you enjoyed working on this project like I did, keep visiting this platform for more ideas on science at home for kids. In the meantime, you can check out what we have in store for you below:




Online after-school focused on STEM


You and your children are looking for nice activities to have fun and learn new things and skills. Come join us for online classes such as:


  • Python coding for kids and teens

  • Coding for elementary school students

  • Make video games

  • Electronics

  • Digital modeling (Create cars, rockets, rings, etc) for 3D printing and much more with the following link: Online after-schools 



Other cute things to make and hand-crafts for kids (tutorials)



If you are looking for more cool Arduino and STEM project ideas to do with your kids, take a look at these other activities:




Newsletter, follow, subscribe, and like the social media


If you like online STEM activities, consider subscribing to the newsletter and social media for updates, and don't miss any STEM events. Don't forget to subscribe to the newsletter at the bottom of our website ''www.makersgeneration.net'' for more events, tutorials, and freebies.



Subscribe to the Facebook group if you have yet registered. Content and tutorials are shared daily: Create and build STEM projects for kids 



We can be reached at: contact@makersgeneration.net if any questions.



See you on soon.

Comments