This shows you the differences between two versions of the page.
pm:prj2022:agmocanu:solartracker [2022/05/12 15:19] bogdan_florin.cutur |
pm:prj2022:agmocanu:solartracker [2022/05/27 13:13] (current) bogdan_florin.cutur |
||
---|---|---|---|
Line 23: | Line 23: | ||
* resistors | * resistors | ||
* breadboard | * breadboard | ||
+ | |||
+ | {{:pm:prj2022:agmocanu:cutur_bogdan_el_diag_solar_tracker.png?800|}} | ||
===== Software Design ===== | ===== Software Design ===== | ||
+ | |||
+ | int topleft; | ||
+ | int topright; | ||
+ | int downleft; | ||
+ | int downright; | ||
+ | int waittime = 1; | ||
+ | |||
+ | void setup() { | ||
+ | pinMode(9, OUTPUT); | ||
+ | pinMode(10, OUTPUT); | ||
+ | TCCR1A = 0; | ||
+ | TCCR1A = (1 << COM1A1) | (1 << COM1B1) | (1 << WGM11); | ||
+ | TCCR1B = 0; | ||
+ | TCCR1B = (1 << WGM13) | (1 << WGM12) | (1 << CS11); | ||
+ | ICR1 = 40000; | ||
+ | OCR1A = 3000; | ||
+ | OCR1B = 3600; | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | topleft = analogRead(A0); | ||
+ | topright = analogRead(A1); | ||
+ | downleft = analogRead(A2); | ||
+ | downright = analogRead(A3); | ||
+ | |||
+ | if (topleft > topright) { | ||
+ | OCR1A = OCR1A + 1; | ||
+ | delay(waittime); | ||
+ | } | ||
+ | if (downleft > downright) { | ||
+ | OCR1A = OCR1A + 1; | ||
+ | delay(waittime); | ||
+ | } | ||
+ | if (topleft < topright) { | ||
+ | OCR1A = OCR1A - 1; | ||
+ | delay(waittime); | ||
+ | } | ||
+ | if (downleft < downright) { | ||
+ | OCR1A = OCR1A - 1; | ||
+ | delay(waittime); | ||
+ | } | ||
+ | if (OCR1A > 4000) { | ||
+ | OCR1A = 4000; | ||
+ | } | ||
+ | if (OCR1A < 2000) { | ||
+ | OCR1A = 2000; | ||
+ | } | ||
+ | if (topleft > downleft) { | ||
+ | OCR1B = OCR1B - 1; | ||
+ | delay(waittime); | ||
+ | } | ||
+ | if (topright > downright) { | ||
+ | OCR1B = OCR1B - 1; | ||
+ | delay(waittime); | ||
+ | } | ||
+ | if (topleft < downleft) { | ||
+ | OCR1B = OCR1B + 1; | ||
+ | delay(waittime); | ||
+ | } | ||
+ | if (topright < downright) { | ||
+ | OCR1B = OCR1B + 1; | ||
+ | delay(waittime); | ||
+ | } | ||
+ | if (OCR1B > 4200) { | ||
+ | OCR1B = 4200; | ||
+ | } | ||
+ | if (OCR1B < 2400) { | ||
+ | OCR1B = 2400; | ||
+ | } | ||
+ | } | ||
===== Rezultate Obţinute ===== | ===== Rezultate Obţinute ===== | ||
+ | |||
+ | Video with the end result: | ||
+ | |||
+ | https://drive.google.com/file/d/1BW08E6qgRL3nlCCXdpT7-novVfuvH9Ry/view?usp=sharing | ||
===== Concluzii ===== | ===== Concluzii ===== | ||
+ | The solar tracker manages to follow the light well in all directions limited by the maximum rotation angle of the servomotors. Due to imbalances in the construction of the frame the tracker overshoots its movement due to the inertia of the frame and that causes a slight wiggle. | ||
===== Download ===== | ===== Download ===== | ||
- | ===== Jurnal ===== | ||
- | |||
- | ===== Bibliografie/Resurse ===== | ||
<html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | <html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | ||