This shows you the differences between two versions of the page.
pm:prj2023:vstoica:andradacojocaru [2023/05/27 18:36] andrada.cojocaru [Software Design] |
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 | + | **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 | + | **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: | ||
+ | * pt cel dreapta-stanga -10 - 60 | ||
+ | * 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> | ||
- | </code> | ||
void loop() | void loop() | ||
{ | { | ||
Line 179: | 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 194: | 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 220: | Line 227: | ||
} | } | ||
- | // display to the lcd | + | // display to the lcd the day time |
lcd.setCursor(0, 1); | lcd.setCursor(0, 1); | ||
lcd.print(" "); | lcd.print(" "); | ||
Line 239: | Line 246: | ||
delay(100); | delay(100); | ||
} | } | ||
+ | </code> | ||
Line 260: | Line 268: | ||
Proiectul a fost unul cat se poate de interesant, ce m-a facut sa ma adaptez in diverse situatii. \\ | Proiectul a fost unul cat se poate de interesant, ce m-a facut sa ma adaptez in diverse situatii. \\ | ||
\\ | \\ | ||
- | Initial mi-am dorit sa integrez o analiza de date a valorilor obtinute de panoul solar de-a lungul zilei, insa am avut dificultati cu cardul sd (ce afisa caractere random) si a trebuit sa renunt la idee pentru ca nu m-as fi incadrat in timp, insa am incercat sa compensez prin afisarea pe display a momentului zilei in functie de pozitia soarelui. \\ | + | Initial mi-am dorit sa integrez o analiza de date a valorilor obtinute de panoul solar de-a lungul zilei, insa am avut dificultati cu cardul sd (ce afisa caractere random) si a trebuit sa renunt la idee pentru ca nu m-as fi incadrat in timp, insa am incercat sa compensez prin afisarea pe display a momentului zilei in functie de pozitia soarelui.\\ |
+ | \\ | ||
+ | O alta problema intampinata a fost pozitionarea ansamblului panou solar - fotorezistoare ce initial a fost pozitionat prea jos, astfel ca servo-motorul sus-jos avea probleme in deplasare blocandu-se in partea de jos.\\ | ||
\\ | \\ | ||
Pe viitor as vrea sa continui proiectul prin studiul valorilor obtinute de acest timp de ansamblu comparativ cu varianta fixa si sa gandesc o varianta si mai eficienta. De asemenea, mi-ar placea sa conectez niste acumulatori pentru a putea folosi in mod practic.\\ | Pe viitor as vrea sa continui proiectul prin studiul valorilor obtinute de acest timp de ansamblu comparativ cu varianta fixa si sa gandesc o varianta si mai eficienta. De asemenea, mi-ar placea sa conectez niste acumulatori pentru a putea folosi in mod practic.\\ | ||
Line 267: | 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 288: | 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 ===== |