Operácie

Sonic: Rozdiel medzi revíziami

Zo stránky SensorWiki

Balogh (diskusia | príspevky)
dBez shrnutí editace
Balogh (diskusia | príspevky)
 
(9 medziľahlých úprav od rovnakého používateľa nie je zobrazených.)
Riadok 1: Riadok 1:
Študijné materiály na workshop E-design
= Študijné materiály na workshop E-design =




* [https://lastminuteengineers.com/arduino-nano-pinout/ Arduino Nano Pinout]
* Kresliaca tabuľa: https://excalidraw.com/
* [https://lastminuteengineers.com/light-emitting-diode-led/ Dióda LED]
* [https://www.circuitgeeks.com/arduino-buzzer-tutorial/ Arduino a bzučiak]
* [https://lastminuteengineers.com/arduino-sr04-ultrasonic-sensor-tutorial/ Ultrazvukový senzor HC SR-04]




Ultrazvukový senzor BEZ použitia špeciálnej knižnice
== 1. Návrh ==


To use the HC-SR04 ultrasonic sensor with Arduino without libraries, send a 10µs HIGH pulse to the Trig pin, then measure the resulting Echo pin pulse duration using pulseIn(). Calculate distance in cm by dividing duration by 58.2 or \(0.0343\div 2\). 
Parkovací senzor - video: https://www.youtube.com/watch?v=fifh8SuIZKU


Wiring: 
Komponenty:
  VCC: 5V
  GND: GND
Trig: Digital Pin 9 (or any digital I/O)
Echo: Digital Pin 10 (or any digital I/O) 
 
 
Code Example:
 
<source lang="arduino" style="background: #9dd1e1;">
 
const int trigPin = 9;
const int echoPin = 10;


* [https://lastminuteengineers.com/arduino-nano-pinout/ Arduino Nano Pinout]
* [https://lastminuteengineers.com/light-emitting-diode-led/ Dióda LED]
* [https://www.circuitgeeks.com/arduino-buzzer-tutorial/ Arduino a bzučiak]
* [https://lastminuteengineers.com/arduino-sr04-ultrasonic-sensor-tutorial/ Ultrazvukový senzor HC SR-04]<br><br>
* https://www.tme.eu/ - hľadáme vhodný DC/DC menič


/* Arduino code  */
== 2. Schéma zapojenia ==


* KiCAD softvér: https://www.kicad.org/  (+ Fabrication Toolkit AddOn, KiCad Library for Arduino Modules)
* KiCAD cheatsheet https://forum.kicad.info/t/kicad-v8-cheatsheet/51774
* Ťahák k dnešnému workshopu ToDo


void setup() {
== 3. Plošný spoj ==
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  Serial.begin(9600);
}


void loop() {
== 4. Výroba / Fabrication ==
  // Clear trigPin
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
 
  // Sets the trigPin on HIGH state for 10 micro seconds
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
 
  // Reads the echoPin, returns sound wave travel time in microseconds
  long duration = pulseIn(echoPin, HIGH);
 
  // Calculating the distance (speed of sound is ~343m/s or 0.0343 cm/us)
  float distanceCm = duration * 0.0343 / 2;
 
  // Print to Serial Monitor
  Serial.print("Distance: ");
  Serial.print(distanceCm);
  Serial.println(" cm");
 
  delay(100); // Small delay to avoid interference
}


* [https://jlcpcb.com/ JLC PCB] - výroba plošného spoja
* Predaj komponentov
** Techfun.SK
** GME.SK
** RLX.SK
** Elecom.SK
** Drotik-Elektro.SK


</source>
== 5. Oživenie zariadenia ==


== 6. Softvér ==


Key Principles: 
Pozri -> [[Parkovací senzor so stavebnicou Sonic]]
* Trigger Pulse: A 10-microsecond high pulse is required to initiate the sensor's 8-cycle ultrasonic burst,
* Echo Pulse: The echo pin goes high for the same amount of time it takes for the sound to travel to the object and back,
* Calculation: \(\text{Distance}=\frac{\text{Duration}\times \text{Speed\ of\ Sound}}{2}\).
* Range: The sensor measures distances from 2cm up to 400cm

Aktuálna revízia z 09:09, 29. január 2026

Študijné materiály na workshop E-design


1. Návrh

Parkovací senzor - video: https://www.youtube.com/watch?v=fifh8SuIZKU

Komponenty:

2. Schéma zapojenia

3. Plošný spoj

4. Výroba / Fabrication

  • JLC PCB - výroba plošného spoja
  • Predaj komponentov
    • Techfun.SK
    • GME.SK
    • RLX.SK
    • Elecom.SK
    • Drotik-Elektro.SK

5. Oživenie zariadenia

6. Softvér

Pozri -> Parkovací senzor so stavebnicou Sonic