The idea of the assignment is to make a small model for a shaded device for a building that can sense the presence of the light before entering the building and can act to open, close, and move to allow the sunlight to enter a building to control the temperature of it. Enjoy!
Shaded Dvice to building
There are 1 software and 3 inspired website used:
Tinkercad: used to make a virtual circuit and simulate it before applying it to check if it is applicable or not and to make a wiring diagram for the circuit of the device.
2. Google : used to find inspirational ideas and ways to apply them and search for solutions for problems faced.
3. Pinterest: used to find inspirational ideas and ways to apply them and search for solutions for problems faced.
4. Autodesk Instructables: used to find inspirational ideas and ways to apply them and search for solutions for problems faced.
5.Arduino IDE: to verify the code and upload it to Arduino
Thinkercad
Google seach
Autodesk Instructables
Arduino ide
Rullers
Compass
Pencil
Cutter
Glue Gun
There are 2 main Material used:
1. CardBoard sheets
2. PVC Roll as transparent material for lights.
CardBoard
PVC Roll
Mini breadboard
ِAdaptor 5V
DC Geared Motor
ON/OFF switch
Resistors
Arduino uno
Dc Power Jack
Potentiometer
Servo motor
The creation of the circuit on TinkerCad:
The circuit contains many different components (LDR Sensor, Potentiometer, slider switch, LCD Screen and servomotor )
The circuit gives us 2 outputs: servomotor movement, and LCD .
The circuit gives us 3 inputs: Automatic mode by the LDR sensor and manual mode by the potentiometer. we can switch between both by a slider switch
I used color coding, red for positive and black for negative, and others to differentiate between eath functions.
The voltage of the power supply is 9 volts for Arduino.
Connecting the components in the channel as shown in the figure.
The Electrical circuit simulation on TinkerCad
1 Make a diagrammatic sketch for the device showing the outer shape of device
3. Download the library of LED LiquidCrystal_I2C
4. Write the code and modified it Arduino using Arduino IDE
// Include the Servo library to control a servo motor
#include <Servo.h>
// Variable to store the LDR sensor value
int LDR_Value = 0;
// Include the LiquidCrystal_I2C library for the LCD display
#include <LiquidCrystal_I2C.h>
// Initialize the LCD with I2C address 0x27, 16 columns, and 2 rows
LiquidCrystal_I2C lcd_1(0x27, 16, 2);
// Create a Servo object to control the servo motor on pin 9
Servo servo_9;
void setup() {
// Initialize the LCD with 16 columns and 2 rows
lcd_1.begin(16, 2);
// Set pin 13 as an input for mode selection (Automatic/Manual)
pinMode(13, INPUT);
// Set pin A0 as an input for the LDR sensor
pinMode(A0, INPUT);
// Begin serial communication at a baud rate of 9600
Serial.begin(9600);
// Attach the servo to pin 9 with a pulse range of 500 to 2500 microseconds
servo_9.attach(9, 500, 2500);
// Set pin A1 as an input for manual control of the servo
pinMode(A1, INPUT);
// Display "Solar tracker" on the LCD
lcd_1.print("Solar tracker");
}
void loop() {
// Check if pin 13 is HIGH (Automatic Mode)
if (digitalRead(13) == HIGH) {
// Reinitialize the LCD
lcd_1.init();
lcd_1.backlight(); // Turn on the LCD backlight
lcd_1.print("Automatic Mode");
lcd_1.setCursor(5, 1); // Move the cursor to the 2nd row
delay(1000); // Wait for 1000 milliseconds (1 second)
// Read the value from the LDR sensor
LDR_Value = analogRead(A0);
// Display the LDR value on the LCD
lcd_1.print("LDR=");
lcd_1.print(LDR_Value);
delay(1000); // Wait for 1000 milliseconds (1 second)
// Send the LDR value to the serial monitor
Serial.println(LDR_Value);
// If LDR value is less than 500, move the servo to 80 degrees
if (LDR_Value < 500) {
servo_9.write(80);
}
// Otherwise, move the servo to 105 degrees
else {
servo_9.write(105);
}
}
// Manual Mode
else {
lcd_1.init(); // Reinitialize the LCD
lcd_1.backlight(); // Turn on the LCD backlight
lcd_1.print("Automatic Mode");
lcd_1.clear(); // Clear the LCD screen
lcd_1.print("Manual Mode");
// Map the analog input from A1 to a value between 82 and 105 degrees for the servo
servo_9.write(map(analogRead(A1), 0, 1023, 80, 105));
delay(100); // Wait for 100 milliseconds (0.1 second)
}
}
5.verify the code and upload it to Arduino using Arduino IDE
The Electrical circuit simulation on TinkerCad
2. make a wiring diagram for the circuit on tinker CAD by :
add breadboard, Arduino,
LDR Sensor
Connect one leg of the LDR to 5V (Arduino).
Connect the other leg of the LDR A0 (Arduino).
Connect the Ground to GND (Arduino).
connect the LED
(GND (LCD) → GND (Arduino),
VCC (LCD) → 5V (Arduino)
SDA (LCD) → A4 (Arduino)
SCL (LCD) → A5 (Arduino)
connect the Servo Motor
Red Wire (Servo VCC) → 5V (Arduino)
Brown Wire (Servo GND) → GND (Arduino)
Orange Wire (Servo Signal) → Pin 9 (Arduino)
connect the Potentiometer Connections
Middle Pin (Potentiometer) → A1 (Arduino)
One Outer Pin (Potentiometer) → 5V (Arduino)
Other Outer Pin (Potentiometer) → GND (Arduino)
connect the Slide Switch
Pin 13 (Arduino) → Breadboard (Button or Switch)
alternatively and connect them to power and GND too.
6. wiring the circuit according to the sketch in thinkercad
6.make the circuit for the device (like the wiring diagram shown above on tinker CAD) and check its functionality
5. cut the cardboard to build the outer shape of the device taking into consideration the place of Arduino opening, LDR Sensor, Potentiometer, toggle switch, LCD Screen and servomotor
the device consists of 5 components: the box containing the circuit components and the upper room containing the shaded device.
7.verify the code and upload it to Arduino using Arduino IDE
9.make a place for all component then attach its .
8. build the shaded device and add the circuit to it ( LDR Sensor, Potentiometer, slider switch, LCD Screen and servomotor ).
Showcase the project and check the functionality of the code and components.
The main problem is when I add the large servo that needs more current it causes wires to burn and the servo motor not to work
system needs external source to power servo motors to work well.
The second problem is when I try to add another servo to the system not work because the same problem
so I will add external Power source to servo motor to avoid this problems.
The second challenge I face the potentiometer does not work well it changes the value, In the same position or does not change in the beginning I see fluctuation in the servo motion so I think in the beginning I had a problem with the code or the servo motor I try to check them one by one and in the end, I use avometer to check the value of the potentiometer and compares it to another one then I found the problem on it so I replace it and the circuits work well .
The third challenge I faced to detecting the correct angle for the servo motor to control the shade in the beginning I selected 45, 135 degrees to move between it, but I found it was greater than I wanted, so after many trials and errors I found the suitable
angle for the servo between 80 and 105 degrees in both manual and automatic modes so I changed it uploaded the code and tested it in the showcase video
Burning in wire so the plastic is melten
The damaged potentiometer has not given any response in any position.
The other potentiometer has given a response in all positions.
The value of the angle in both mode automatic and manual .
using the Tinkercad portal to design and simulate the final project circuit before I do it physically and I will use the experiences from this week to do the electronic circuit in the final project.
by using a servomotor I find the problem with the power source which will save time
in the final project.
checking the every component before using is very important
chose and test the actually angle you required to make the functions.