This shows you the differences between two versions of the page.
pm:prj2023:vstoica:andradacojocaru [2023/05/27 18:50] andrada.cojocaru [Concluzii] |
pm:prj2023:vstoica:andradacojocaru [2023/05/30 08:22] (current) andrada.cojocaru [Software Design] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Solar tracker - Andrada Cojocaru ====== | + | ====== Solar tracker - Andrada Cojocaru ☀️====== |
===== Proiect PM - 2023 ===== | ===== Proiect PM - 2023 ===== | ||
Student: Andrada-Ioana Cojocaru\\ | Student: Andrada-Ioana Cojocaru\\ | ||
Line 69: | Line 69: | ||
Descrierea codului aplicaţiei (firmware): | Descrierea codului aplicaţiei (firmware): | ||
* **mediu de dezvoltare**: Arduino IDE 2.1.0 | * **mediu de dezvoltare**: Arduino IDE 2.1.0 | ||
- | * **librării**: Wire.h, LiquidCrystal_I2C.h, servo.h (initial, dupa am facut propriile functii) | + | * **biblioteci**: Wire.h, LiquidCrystal_I2C.h, servo.h (initial, dupa am facut propriile functii) |
</note> | </note> | ||
- | Declararea librariilor | + | Declararea bibliotecilor |
<code c> | <code c> | ||
#include <Wire.h> | #include <Wire.h> | ||
Line 104: | Line 104: | ||
Declararea variabilelor globale pentru miscarea servo-motoarelor - de aici pornesc | Declararea variabilelor globale pentru miscarea servo-motoarelor - de aici pornesc | ||
<code c> | <code c> | ||
- | int servoRightLeftPos = 45; | + | int servoRightLeftPos = 35; |
- | int servoUpDownPos = 90; | + | int servoUpDownPos = 76; |
</code> | </code> | ||
Line 122: | Line 122: | ||
</code> | </code> | ||
- | Setup - configuram lcd ul sa afiseze masajul de pe primul rand, configuram registri corespunzatori si pozitionam servo-motoarele in pozitia de start | + | **Setup** - configuram lcd ul sa afiseze masajul de pe primul rand, configuram registri corespunzatori si pozitionam servo-motoarele in pozitia de start |
<code c> | <code c> | ||
void setup() | void setup() | ||
Line 146: | Line 146: | ||
// set where the servo start | // set where the servo start | ||
- | servoRightLeftPos = 45; | + | servoRightLeftPos = 35; |
- | servoUpDownPos = 90; | + | servoUpDownPos = 76; |
setServoAngle(SERVO_RIGHT_LEFT_PIN, servoRightLeftPos); | setServoAngle(SERVO_RIGHT_LEFT_PIN, servoRightLeftPos); | ||
setServoAngle(SERVO_UP_DOWN_PIN, servoUpDownPos); | setServoAngle(SERVO_UP_DOWN_PIN, servoUpDownPos); | ||
Line 155: | Line 155: | ||
</code> | </code> | ||
- | Loop - citim ldr-urile si in functie de valorile obtinute calculam media celor de sus, de jos, dreapta, stanga si apoi diferenta dreapta-stanga, sus-jos si observam daca valoarea e mai mare decat toleranta, caz in care trebuie sa mutam pozitia ansamblului.\\ | + | **Loop** - citim ldr-urile si in functie de valorile obtinute calculam media celor de sus, de jos, dreapta, stanga si apoi diferenta dreapta-stanga, sus-jos si observam daca valoarea e mai mare decat toleranta, caz in care trebuie sa mutam pozitia ansamblului.\\ |
Am determinat experimental valorile intre care trebuie servo-motoarele mutate: | Am determinat experimental valorile intre care trebuie servo-motoarele mutate: | ||
- | - pt cel dreapta-stanga 0 -90 | + | * pt cel dreapta-stanga -10 - 60 |
- | - pt cel sus-jos 60-110 | + | * pt cel sus-jos 76 - 96 |
+ | In functie de pozitia soarelui sau absenta lui am afisat mesaje relevante pe lcd: | ||
+ | * Est jos -> dimineata | ||
+ | * Est sus -> zi | ||
+ | * Vest jos -> amiaza | ||
+ | * lipsa soare -> noapte | ||
<code c> | <code c> | ||
void loop() | void loop() | ||
Line 181: | Line 186: | ||
if (abs(diffrightleft) >= TOLERANCE) { | if (abs(diffrightleft) >= TOLERANCE) { | ||
if (diffrightleft < 0) { | if (diffrightleft < 0) { | ||
- | if (servoRightLeftPos < 90) { | + | if (servoRightLeftPos <= 60) { |
servoRightLeftPos++; | servoRightLeftPos++; | ||
setServoAngle(SERVO_RIGHT_LEFT_PIN, servoRightLeftPos); | setServoAngle(SERVO_RIGHT_LEFT_PIN, servoRightLeftPos); | ||
} | } | ||
} else if (diffrightleft > 0) { | } else if (diffrightleft > 0) { | ||
- | if (servoRightLeftPos > 0) { | + | if (servoRightLeftPos >= -10) { |
servoRightLeftPos--; | servoRightLeftPos--; | ||
setServoAngle(SERVO_RIGHT_LEFT_PIN, servoRightLeftPos); | setServoAngle(SERVO_RIGHT_LEFT_PIN, servoRightLeftPos); | ||
Line 196: | Line 201: | ||
if (abs(difftopbottom) >= TOLERANCE) { | if (abs(difftopbottom) >= TOLERANCE) { | ||
if (difftopbottom < 0) { | if (difftopbottom < 0) { | ||
- | if (servoUpDownPos < 110) { | + | if (servoUpDownPos <= 96) { |
- | servoUpDownPos++; | + | servoUpDownPos+=5; |
setServoAngle(SERVO_UP_DOWN_PIN, servoUpDownPos); | setServoAngle(SERVO_UP_DOWN_PIN, servoUpDownPos); | ||
} | } | ||
} else if (difftopbottom > 0) { | } else if (difftopbottom > 0) { | ||
- | if (servoUpDownPos > 60) { | + | if (servoUpDownPos >= 76) { |
- | servoUpDownPos--; | + | servoUpDownPos-=5; |
setServoAngle(SERVO_UP_DOWN_PIN, servoUpDownPos); | setServoAngle(SERVO_UP_DOWN_PIN, servoUpDownPos); | ||
} | } | ||
Line 272: | Line 277: | ||
===== Download ===== | ===== Download ===== | ||
- | + | {{:pm:prj2023:vstoica:andrada_solar_tracker.zip|}} | |
- | <note warning> | + | |
- | O arhivă (sau mai multe dacă este cazul) cu fişierele obţinute în urma realizării proiectului: surse, scheme, etc. Un fişier README, un ChangeLog, un script de compilare şi copiere automată pe uC crează întotdeauna o impresie bună ;-). | + | |
- | + | ||
- | Fişierele se încarcă pe wiki folosind facilitatea **Add Images or other files**. Namespace-ul în care se încarcă fişierele este de tipul **:pm:prj20??:c?** sau **:pm:prj20??:c?:nume_student** (dacă este cazul). **Exemplu:** Dumitru Alin, 331CC -> **:pm:prj2009:cc:dumitru_alin**. | + | |
- | </note> | + | |
===== Jurnal ===== | ===== Jurnal ===== | ||
Line 293: | Line 293: | ||
* **27.05** - documentatie finala | * **27.05** - documentatie finala | ||
</note> | </note> | ||
+ | |||
+ | {{ :pm:prj2023:vstoica:andrada_solar_tracker.jpg?400 |}}\\ | ||
+ | \\ | ||
+ | {{ :pm:prj2023:vstoica:andrada_circuit_rotit.jpg?400 |}} | ||
+ | |||
+ | Video functionare: | ||
+ | |||
+ | <html> | ||
+ | <iframe | ||
+ | src="https://www.youtube.com/embed/0ZkXvNzDzfs" | ||
+ | title="YouTube video player" | ||
+ | frameborder="0" | ||
+ | allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" | ||
+ | allowfullscreen | ||
+ | style="aspect-ratio: 16/9; width: 100%;" | ||
+ | ></iframe> | ||
+ | </html> | ||
+ | |||
===== Bibliografie/Resurse ===== | ===== Bibliografie/Resurse ===== |