addicttux
Published © GPL3+

Architectural Model of a Bus Stop with Automatic Sunshade

Architectural model of a bus stop with automatic sunshade according to the position of the sun. It is also sensitive to rain.

IntermediateShowcase (no instructions)20,114
Architectural Model of a Bus Stop with Automatic Sunshade

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
Because we are creating an Architectural model, we needed something small, easy to hide.
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
For controlling the expansion / contraction of the sunshade
×1
Photo resistor
Photo resistor
One would be facing East, and the other, West.
×2
Rain Sensor
×1
High Brightness LED, White
High Brightness LED, White
×6
Resistor 220 ohm
Resistor 220 ohm
×2
Through Hole Resistor, 10 ohm
Through Hole Resistor, 10 ohm
×1
Breadboard (generic)
Breadboard (generic)
×1
Male/Male Jumper Wires
×27

Software apps and online services

Tinkercad
Autodesk Tinkercad
Used to design the circuit and simulate its operation
Arduino IDE
Arduino IDE
Used for fine tuning the code

Story

Read more

Schematics

Architectural model of a bus stop with automatic sunshade

Architectural model of a bus stop with automatic sunshade

Code

Architectural model of a bus stop with automatic sunshade

C/C++
Architectural model of a bus stop with automatic sunshade according to the position of the sun. It is also sensitive to ra
#include <Servo.h>

int easternLight = 0;
int westernLight = 0;
int rainSensed = 0;
int sunshadePosition = 0;
int rainRhreshold = 512;
int sunshadeExpanded = 120;
int sunshadeContracted = 60;
int ambientLighting = 0;
int turnOnLightsOn = 150;
int ledIntensity = 0;
int ledPower = 0;
Servo servo;

void setup()
{
  pinMode(A4, OUTPUT); // Interior lighting of the bus stop
  pinMode(A5, OUTPUT); // Street light
  pinMode(A1, INPUT); // Western light
  pinMode(A2, INPUT); // Eastern light
  pinMode(A3, INPUT); // Rain sensor analog
  pinMode(2, INPUT); // Rain sensor digital
  servo.attach(A0); // Servo
  servo.write(sunshadeContracted);
}

void loop()
{
  // Get sensor values
  easternLight = analogRead(A2);
  westernLight = analogRead(A1);
  rainSensed = analogRead(A3);
  sunshadePosition = servo.read();
  ambientLighting = ((easternLight + westernLight) / 2); // Average the brightness of the east and west
  // Find out if it is raining?
  if (rainSensed < rainRhreshold) {
    // It is raining
    if (sunshadePosition != sunshadeExpanded) {
      servo.write(sunshadeExpanded);
    }
  } else {
    // It is not raining
    if (ambientLighting <= turnOnLightsOn) {
      // It's getting dark, turn on the lights
      ledPower = ((turnOnLightsOn - ambientLighting) * 4);
      analogWrite(A5, ledPower);
      analogWrite(A4, ledPower);
    } else {
      // There is a lot of sun light
      analogWrite(A5, 0);
      analogWrite(A4, 0);
      if (easternLight <= westernLight) {
        // It's sunset
        if (sunshadePosition != sunshadeExpanded) {
          servo.write(sunshadeExpanded);
        }
      }
      if (easternLight > westernLight) {
        // It's down
        if (sunshadePosition != sunshadeContracted) {
          servo.write(sunshadeContracted);
        }
      }
    }
  }
  delay(100);
}

Credits

addicttux

addicttux

2 projects • 21 followers

Comments