Automatic shelter for sunlight project with Arduino Uno

Automatic shelter for sunlight project with Arduino Uno

The automatic shelter project is designed to provide a convenient and efficient way to protect individuals from sunlight. By utilizing a photoresistor sensor, the shelter automatically activates when exposed to light. In this blog post, we’ll delve into the hardware components, the circuit diagram, and the Arduino code necessary to build this innovative shelter.

Hardware Required

To create the automatic shelter, gather the following components:

  • Arduino Uno R3: The brain of our project.
  • Resistor: Used in the circuit.
  • Jumper Wires: For connecting components.
  • Servo Motor: Controls the shelter movement.
  • Photoresistor: Detects sunlight.

Circuit Diagram

Arduino Code

#include <Servo.h>

// Declare Servo Motor
Servo servomotor;

const int photoresistor = A0;
const int motor = 9;

int photoresistorValue = 0;
int outputValue = 0;
float nice = 0.09;
float myValue;

void setup() {
  Serial.begin(9600);
  servomotor.attach(motor);
}

void loop() {
  photoresistorValue = analogRead(photoresistor);
  myValue = float(map(photoresistorValue, 0, 100, 0, 180));
  outputValue += int(myValue - outputValue) * nice;

  Serial.print("Sensor = ");
  Serial.print(photoresistorValue);
  Serial.print("\t Output = ");
  Serial.println(outputValue);

  servomotor.write(outputValue);
  delay(10);

  if (photoresistorValue > 900) {
    outputValue = 160;
  }
  if (photoresistorValue > 700) {
    outputValue = 120;
  }
}

Precautions

Here are some important precautions to keep in mind during the project:

  1. Proper Connections: Ensure that all connections are made correctly.
  2. Case Sensitivity: Remember that Arduino code is case-sensitive.
  3. Color-Coded Wires: Use different and appropriate colors for your wires.
  4. Resistors: Don’t forget to use resistors for sensors and LEDs.

By following these guidelines, you’ll be well on your way to creating an automatic shelter that responds to sunlight effectively. Happy building! 🌞🏠

Do you have questions regarding our STEM program?

Contact us anytime.

Take your first step into the magical world of coding for kids

Share:

More Posts

Send Us A Message

Coding For kids

Coding Courses for Kids Online

Our courses which are tailored for grades 1 to 12, and our hands-on curriculum seamlessly integrates, preparing students for challenges and inspiring the next generation.

STEM Labs

STEM LAB for Schools

If you are a school searching for a cutting-edge makerspace solution that goes beyond conventional education, look no further. Partner with Makers’ Muse to unlock a world of innovation and transformative learning experiences for your students. 

Coding Toys

STEM LAB for Schools

Discover a revolutionary coding journey for students with our cutting-edge educational toys. Partner with us to unlock innovative learning experiences that transcend traditional education.

Leave a Reply