Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pm:prj2024:iotelea:david.ghelesel [2024/05/26 03:57]
david.ghelesel
pm:prj2024:iotelea:david.ghelesel [2024/05/27 02:28] (current)
david.ghelesel
Line 14: Line 14:
 === Hardware Design === === Hardware Design ===
  
 +<note tip>
 Dispozitivul integrează diverse componente hardware: Dispozitivul integrează diverse componente hardware:
   * o placă Arduino UNO R3   * o placă Arduino UNO R3
Line 23: Line 24:
   * un buton   * un buton
   * un senzor ultrasonic HC-SR04 pentru măsurarea distanței.   * un senzor ultrasonic HC-SR04 pentru măsurarea distanței.
 +</​note>​
  
-{{:​pm:​prj2024:​iotelea:​screenshot_2024-05-13_at_17.40.58.png?​300|}} 
  
 +{{:​pm:​prj2024:​iotelea:​schema_electrica_pm_ghele.png|}}
  
-{{:​pm:​prj2024:​iotelea:​proiect_pm_hardware.png|}}+ 
 +{{:​pm:​prj2024:​iotelea:​proiect_pm_hardware_resized.png|}}
  
 === Software Design === === Software Design ===
Line 41: Line 44:
 **Functionalitatea:​ ** **Functionalitatea:​ **
  
-''#​include <Servo.h>+Codul citește starea unui buton conectat la pinul buttonPin și afișează starea acestuia în Serial Monitor. 
 +Senzorul cu ultrasunete este utilizat pentru a măsura distanța prin declanșarea unui impuls și calcularea duratei necesare pentru ca ecoul să se întoarcă. Distanța este apoi calculată pe baza vitezei sunetului folosind formula: distanță = durată × 0.034/2.
  
-Servo myServo; ​ // Create ​servo object to control ​servo motor+Măsurarea distanței este verificată,​ iar dacă distanțeste mai mare sau egală cu 10 cm, LED-ul verde se aprinde, iar LED-ul roșu se stinge. În caz contrar, dacă distanțeste prea mică, un mesaj este afișat în Serial Monitor, iar LED-ul roșu se aprinde.
  
-int buttonPin = 2;  // Define the button pin +Verific apoi dacă butonul este apăsat (buttonState == HIGH) și dacă distanța este mai mare sau egală cu 10 cm. Dacă ambele condiții sunt îndeplinite,​ se efectuează următoarele acțiuni:
-int buttonState = 0;  // Variable to store the button state+
  
-const int triggerPin = 3;  // Define the ultrasound sensor trigger pin +• Rotește motorul servo la 90 de grade pentru a activa catapulta.
-const int echoPin = 4;     // Define the ultrasound sensor echo pin+
  
-const int initialPosition = 0;  // Define the initial position of the servo +• Activează un buzzer ​pentru a emite un sunet la o frecvență de 1000 Hz timp de 0.5 secunde.
-int buzzerPin = 8;  // Define the buzzer ​pin+
  
-const int ledRed = 5; //Define the Red led pin +• Readuce motorul servo la poziția inițială (definită ca initialPosition).
-const int ledGreen = 6; //define the Green led pin+
  
-void setup() { 
-  Serial.begin(9600);​ 
-  myServo.attach(7); ​ // Attach the servo to digital pin 7 
-  pinMode(buttonPin,​ INPUT); ​ // Set the button pin as input 
-  pinMode(triggerPin,​ OUTPUT); ​ // Set the ultrasound sensor trigger pin as output 
-  pinMode(echoPin,​ INPUT); ​ // Set the ultrasound sensor echo pin as input 
-  pinMode(buzzerPin,​ OUTPUT); ​ // Set the buzzer pin as output 
-  pinMode(ledRed,​ INPUT); ​ // Set the button pin as input 
-  pinMode(ledGreen,​ INPUT); ​ // Set the button pin as input 
-} 
  
-void loop() { +=== Rezultate Obținute ===
-  buttonState ​digitalRead(buttonPin); ​ // Read the state of the button +
-  Serial.println(buttonState);​+
  
-  ​// Measure distance using the ultrasound sensor +[[https://youtu.be/DO3wXFz8eTw]]
-  long duration; +
-  int distance; +
-   +
-  digitalWrite(triggerPin,​ LOW); +
-  delayMicroseconds(2);​ +
-  digitalWrite(triggerPin,​ HIGH); +
-  delayMicroseconds(10);​ +
-  digitalWrite(triggerPin,​ LOW); +
-   +
-  duration = pulseIn(echoPin,​ HIGH); +
-  distance = duration * 0.034 2;+
  
-   ​Serial.print("​Distance"); +[[https://youtu.be/​Ff2ew-QNk9E]]
-   ​Serial.print(distance);​ +
-   ​Serial.println("​ cm");+
  
-   ​if(distance >10){ +=== Concluzii ===
-    digitalWrite(ledGreen,​ HIGH); +
-    digitalWrite(ledRed,​ LOW);} +
-    else{ +
-      digitalWrite(ledGreen,​ LOW); +
-    digitalWrite(ledRed,​ HIGH); +
-    Serial.println("​Distance is too short"​);​}+
  
-  if (buttonState == HIGH && distance >= 10) {  // Check if the button is pressed and distance is greater than or equal to 10 cm +Proiectul functioneaza dupa planificareluminarea LED-urilor ar putea sa fie mai perceptibila.
-    myServo.write(90); ​ // Rotate the servo to 90 degrees immediately +
-     +
-    // Emit sound on the buzzer +
-    tone(buzzerPin1000); ​ // You can adjust the frequency (here, 1000 Hz) +
-    delay(500); ​ // Wait for 0.5 seconds (adjust as needed) +
-    noTone(buzzerPin); ​ // Stop the sound +
-     +
-    myServo.write(initialPosition); ​ // Return the servo to the initial position +
-  } +
-}''​+
  
-=== Rezultate Obținute ​===+=== Download ​===
  
-TODO+{{:​pm:​prj2024:​iotelea:​ball_throwing_device.zip|}}
  
-=== Concluzii ​===+=== Jurnal ​===
  
-TODO+<note tip> 
 +06.05.2024 - creare pagina OCW
  
-=== Download ===+14.05.2024 - compunere schema electrica
  
-TODO+17.05.2024 - asamblare Hardware
  
-=== Jurnal ===+25.05.2024 - implementare Software
  
-TODO+26.05.2024 - prezentarea rezultatelor obtinute prin video 
 +</​note>​
  
 === Bibliografie / Resurse === === Bibliografie / Resurse ===
  
 https://​docs.arduino.cc/​ https://​docs.arduino.cc/​
 +
 +https://​projecthub.arduino.cc/​
 +
 +https://​howtomechatronics.com/​
 +
pm/prj2024/iotelea/david.ghelesel.1716685057.txt.gz · Last modified: 2024/05/26 03:57 by david.ghelesel
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0