This shows you the differences between two versions of the page.
pm:prj2024:vstoica:rardu_marian.leanca [2024/05/27 02:57] radu_marian.leanca [Software Design] |
pm:prj2024:vstoica:rardu_marian.leanca [2024/05/27 17:18] (current) radu_marian.leanca [Download] |
||
---|---|---|---|
Line 99: | Line 99: | ||
* bază BC547 -> rezistență 4k7Ω -> D13 - pentru a comanda pompa | * bază BC547 -> rezistență 4k7Ω -> D13 - pentru a comanda pompa | ||
* colector BC547 -> GND | * colector BC547 -> GND | ||
+ | |||
+ | {{:pm:prj2024:vstoica:electronics_sswp.jpg?300|}} | ||
+ | {{:pm:prj2024:vstoica:senzor_speaker_sswp.jpeg?300|}} | ||
+ | |||
+ | Atașez și câteva poze din slicer: | ||
+ | Ghiveciul exterior:\\ | ||
+ | {{:pm:prj2024:vstoica:outer_pot_sswp.png?300|}} | ||
+ | \\ | ||
+ | Ghiveciul interior:\\ | ||
+ | {{:pm:prj2024:vstoica:inner_1_sswp.png?200|}} {{:pm:prj2024:vstoica:inner_2_sswp.png?200|}} | ||
+ | \\ | ||
+ | Baza:\\ | ||
+ | {{:pm:prj2024:vstoica:base_sswp.png?300|}} | ||
===== Software Design ===== | ===== Software Design ===== | ||
Line 106: | Line 119: | ||
Biblioteci folosite: DFRobotDFPlayerMini.h, SoftwareSerial.h | Biblioteci folosite: DFRobotDFPlayerMini.h, SoftwareSerial.h | ||
- | - DFRobotDFPlayerMini.h a fost folosită pentru utilizarea modului MP3 Player | + | * DFRobotDFPlayerMini.h a fost folosită pentru utilizarea modului MP3 Player |
- | - SoftwareSerial.h a fost folosită pentru a putea comunica cu modulul MP3 Player | + | * SoftwareSerial.h a fost folosită pentru a putea comunica cu modulul MP3 Player |
Acesta este codul rezultat: | Acesta este codul rezultat: | ||
Line 161: | Line 174: | ||
myDFPlayer.volume(30); // Set volume value (0~30). | myDFPlayer.volume(30); // Set volume value (0~30). | ||
- | // Set pin modes | + | // Set pin modes using direct register manipulation |
- | pinMode(trigPin, OUTPUT); | + | DDRB |= (1 << DDB1); // pumpPin (PB1/Pin 9) |
- | pinMode(echoPin, INPUT); | + | DDRD |= (1 << DDD7); // waterSensorPower (PD7/Pin 7) |
- | pinMode(waterSensorPower, OUTPUT); | + | DDRD |= (1 << DDD6); // soilMoisturePower (PD6/Pin 6) |
- | pinMode(soilMoisturePower, OUTPUT); | + | DDRB |= (1 << DDB0); // trigPin (PB0/Pin 8) |
- | pinMode(pumpPin, OUTPUT); | + | DDRB &= ~(1 << DDB1); // echoPin (PB1/Pin 9) |
analogWrite(pumpPin, 0); | analogWrite(pumpPin, 0); | ||
} | } | ||
Line 217: | Line 230: | ||
void measureDistance() { | void measureDistance() { | ||
// Clear the trigPin | // Clear the trigPin | ||
- | digitalWrite(trigPin, LOW); | + | PORTB &= ~(1 << PORTB0); |
delayMicroseconds(2); | delayMicroseconds(2); | ||
// Set the trigPin high for 10 microseconds | // Set the trigPin high for 10 microseconds | ||
- | digitalWrite(trigPin, HIGH); | + | PORTB |= (1 << PORTB0); |
delayMicroseconds(10); | delayMicroseconds(10); | ||
- | digitalWrite(trigPin, LOW); | + | PORTB &= ~(1 << PORTB0); |
// Read the echoPin and calculate the duration of the pulse | // Read the echoPin and calculate the duration of the pulse | ||
Line 234: | Line 247: | ||
void measureWaterLevel() { | void measureWaterLevel() { | ||
// Power on the water level sensor | // Power on the water level sensor | ||
- | digitalWrite(waterSensorPower, HIGH); | + | PORTD |= (1 << PORTD7); |
delay(10); | delay(10); | ||
Line 240: | Line 253: | ||
// Power off the water level sensor | // Power off the water level sensor | ||
- | digitalWrite(waterSensorPower, LOW); | + | PORTD &= ~(1 << PORTD7); |
} | } | ||
void measureSoilMoisture() { | void measureSoilMoisture() { | ||
// Power on the soil moisture sensor | // Power on the soil moisture sensor | ||
- | digitalWrite(soilMoisturePower, HIGH); | + | PORTD |= (1 << PORTD6); |
delay(10); | delay(10); | ||
Line 251: | Line 264: | ||
// Power off the soil moisture sensor | // Power off the soil moisture sensor | ||
- | digitalWrite(soilMoisturePower, LOW); | + | PORTD &= ~(1 << PORTD6); |
} | } | ||
- | |||
</code> | </code> | ||
===== Rezultate Obţinute ===== | ===== Rezultate Obţinute ===== | ||
- | + | {{:pm:prj2024:vstoica:final_planta.jpg?300|}}\\ | |
- | <note tip> | + | Proiectul acoperă aproape tot ce mi-am propus, totul fiind funcțional mai puțin modulul WiFi, care s-a defectat cu o zi înainte de PM Fair și din păcate nu am găsit altul (fiind și duminică)m(. Am dat un mic fail și cu una din piesele printate 3D, dar am ciopârțit o cutie și am rezolvat.\\ |
- | Care au fost rezultatele obţinute în urma realizării proiectului vostru. | + | Am reușit însă să creez un prototip funcțional și care cu siguranță te face să râzi. |
- | </note> | + | Proiectul funcționează în felul următor: |
+ | * la o perioadă de timp se citește senzorul de sol, iar dacă umiditatea este sub un threshold stabilit empiric se pornește pompa pentru 5 secunde, interval, de asemenea, stabilit empiric | ||
+ | * tot la o perioadă de timp se citește și senzorul de nivel de apă, iar dacă nivelul este foarte scăzut și senzorul de proximitate simte o persoană aproape de ghiveci, se pornește un sunet amuzant, astfel reamintindu-i omului să umple rezervorul de apă | ||
===== Concluzii ===== | ===== Concluzii ===== | ||
+ | Per total, a fost un proiect foarte fun. Mi-ar fi plăcut să pot duce la bun sfârșit și integrarea cu WiFi (aveam niște planuri mari), dar ca și în viață, nu totul e posibil (nu până în PM Fair cel puținLOL). | ||
+ | \\ | ||
+ | Simt că am învățat multe de pe urma acestui proiect și că am descpoerit un nou hobby.\\ | ||
===== Download ===== | ===== Download ===== | ||
- | <note warning> | + | {{:pm:prj2024:vstoica:sswp_reg.zip|}} |
- | 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 ===== | + | |
- | + | ||
- | <note tip> | + | |
- | Puteți avea și o secțiune de jurnal în care să poată urmări asistentul de proiect progresul proiectului. | + | |
- | </note> | + | |
===== Bibliografie/Resurse ===== | ===== Bibliografie/Resurse ===== | ||
+ | * Resurse Hardware: | ||
+ | * [[https://www.thingiverse.com/thing:3537287|fișiere 3D]] | ||
- | <note> | + | * Resurse Software: |
- | Listă cu documente, datasheet-uri, resurse Internet folosite, eventual grupate pe **Resurse Software** şi **Resurse Hardware**. | + | * [[https://projecthub.arduino.cc/Isaac100/getting-started-with-the-hc-sr04-ultrasonic-sensor-7cabe1|Senzor ultrasunet]] |
- | </note> | + | * [[https://www.instructables.com/How-to-use-a-Water-Level-Sensor-Arduino-Tutorial/|Senzor nivel apă]] |
- | + | * [[https://www.dfrobot.com/product-599.html|Senzor sol]] | |
- | <html><a class="media mediafile mf_pdf" href="?do=export_pdf">Export to PDF</a></html> | + | * [[https://wiki.dfrobot.com/DFPlayer_Mini_SKU_DFR0299|DFPlayer Mini]] |