105
edits
mNo edit summary |
No edit summary |
||
Line 74: | Line 74: | ||
<u>1rst System:</u> | <u>1rst System:</u> | ||
For the moving branch, it was set a system with an HC-SR04 Ultrasonic Distance Sensor controlling a 15 kg Digital Servo Motor, through an Arduino Nano and a connective board. | For the <u>moving branch</u>, it was set a system with an HC-SR04 Ultrasonic Distance Sensor controlling a 15 kg Digital Servo Motor, through an Arduino Nano and a connective board. | ||
When the spectator approaches | When the spectator approaches 60 cm of the branches, the servo motor starts to turn from 0 to 18 degrees, making the branches, attached to it, start to move. If the spectator approaches at a closer distance (40 cm), the servo motor turns from 0 to 58 degrees, making the branches move a little bit more. | ||
The Servo Motor received an extra supply of energy from an MB-102 3.3V/5V Power Module plugged into electricity and connected to the board of the 2nd System. | The Servo Motor received an extra supply of energy from an MB-102 3.3V/5V Power Module plugged into electricity and connected to the board of the 2nd System. | ||
Line 112: | Line 112: | ||
<u>2nd System:</u> | <u>2nd System:</u> | ||
The terrarium had a humidifier system inside. It was made with a Capacitive Soil Moisture Sensor connected to an Arduino Nano and a connective board. When the soil got drier (over value 400 read by that sensor, whose values are approximately this: wet is < 400, dry is > 400), a 5V Relay Module also connected to the board, activated a 5V Humidifier made with a piezoelectric. When the soil got humid again (under value 400) the humidifier stopped until the soil got dry again. The relay and humidifier received an extra supply of energy from an MB-102 3.3V/5V Power Module plugged into electricity. [[File:Imagen de WhatsApp 2025-02-22 a las 03.09.15 5fec5717.jpg|alt=Sketch 3, Lemon tree archive, Dania González Sanabria|thumb|1095x1095px|<small>Sketch 3, Terrarium, 2nd System, Lemon tree archive, Dania González Sanabria</small>]] | The <u>terrarium</u> had a humidifier system inside. It was made with a Capacitive Soil Moisture Sensor connected to an Arduino Nano and a connective board. When the soil got drier (over value 400 read by that sensor, whose values are approximately this: wet is < 400, dry is > 400), a 5V Relay Module also connected to the board, activated a 5V Humidifier made with a piezoelectric. When the soil got humid again (under value 400) the humidifier stopped until the soil got dry again. The relay and humidifier received an extra supply of energy from an MB-102 3.3V/5V Power Module plugged into electricity. [[File:Imagen de WhatsApp 2025-02-22 a las 03.09.15 5fec5717.jpg|alt=Sketch 3, Lemon tree archive, Dania González Sanabria|thumb|1095x1095px|<small>Sketch 3, Terrarium, 2nd System, Lemon tree archive, Dania González Sanabria</small>]] | ||
Line 211: | Line 211: | ||
<small><code>Servo myservo; </code></small> | <small><code>Servo myservo; </code></small> | ||
<small><code>float ang = 18; // | <small><code>float ang = 18; // Oscilation basic angle</code></small> | ||
<small><code>int distanciaPersona = | <small><code>int distanciaPersona = 60; // first umbral</code></small> | ||
<small><code>int distanciaCercana = | <small><code>int distanciaCercana = 40; // second umbral</code></small> | ||
<small><code>void setup() {</code></small> | <small><code>void setup() {</code></small> | ||
Line 247: | Line 247: | ||
<small><code>digitalWrite(TRIG_PIN, LOW);</code></small> | <small><code>digitalWrite(TRIG_PIN, LOW);</code></small> | ||
<small><code>// | <small><code>// Read time of reply of eco and calculate distance</code></small> | ||
<small><code>duration = pulseIn(ECHO_PIN, HIGH);</code></small> | <small><code>duration = pulseIn(ECHO_PIN, HIGH);</code></small> | ||
Line 259: | Line 259: | ||
<small><code>Serial.println(" cm");</code></small> | <small><code>Serial.println(" cm");</code></small> | ||
<small><code>// Event 2: if distance is less than 30 cm, | <small><code>// Event 2: if distance is less than 30 cm, move</code></small> | ||
<small><code>if (distance < distanciaCercana) {</code></small> | <small><code>if (distance < distanciaCercana) {</code></small> | ||
<small><code> int maxAngulo = ang + 40; // | <small><code> int maxAngulo = ang + 40; // Increase oscilation range</code></small> | ||
<small><code> if (maxAngulo > 180) maxAngulo = 180; // | <small><code> if (maxAngulo > 180) maxAngulo = 180; // Limit angle to 180°</code></small> | ||
<small><code> for (int pos = 0; pos <= maxAngulo; pos += 1) {</code></small> | <small><code> for (int pos = 0; pos <= maxAngulo; pos += 1) {</code></small> | ||
Line 285: | Line 285: | ||
<small><code>}</code></small> | <small><code>}</code></small> | ||
<small><code>// Evento 1: | <small><code>// Evento 1: if distancia is less than 65 cm but more or igual 30 cm</code></small> | ||
<small><code>else if (distance < distanciaPersona) {</code></small> | <small><code>else if (distance < distanciaPersona) {</code></small> | ||
Line 307: | Line 307: | ||
<small><code>}</code></small> | <small><code>}</code></small> | ||
<small><code>// | <small><code>// if no object, set the servo at 0°</code></small> | ||
<small><code>else {</code></small> | <small><code>else {</code></small> | ||
Line 315: | Line 315: | ||
<small><code>}</code></small> | <small><code>}</code></small> | ||
<small><code>delay(500); // | <small><code>delay(500); // Tiny delay before next event</code></small> | ||
<small><code>}</code></small> | <small><code>}</code></small> |
edits