Outils pour utilisateurs

Outils du site


wiki:flossmanuals:capacitif_pante_son_video:accueil

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentes Révision précédente
Prochaine révision
Révision précédente
wiki:flossmanuals:capacitif_pante_son_video:accueil [2021/06/24 00:51]
justine
wiki:flossmanuals:capacitif_pante_son_video:accueil [2021/07/14 23:21]
justine
Ligne 1: Ligne 1:
-====== Plantes Sonores ====== +====== Plantes Sonores ====== 
-====== La plante interface ====== +====== Planta-Phonique====== 
-====== Planta-Phonique ======+===== Des plantes interfaces ===== 
 {{:wiki:flossmanuals:capacitif_pante_son_video:projet_plantaphonique_plan_de_travail_1.png|}} {{:wiki:flossmanuals:capacitif_pante_son_video:projet_plantaphonique_plan_de_travail_1.png|}}
 {{:wiki:flossmanuals:capacitif_pante_son_video:projet_plantaphonique-02.png|}} {{:wiki:flossmanuals:capacitif_pante_son_video:projet_plantaphonique-02.png|}}
Ligne 17: Ligne 18:
 Pour ce projet je me suis inspirée de Jean Thoby un pépiniériste qui voue une véritable passion pour le monde végétale. Jean Thoby avec l’aide d’ingénieurs, ont créer un instrument de musique. Par un système de boitier et de câbles (l’un fixé au sol et l’autre accroché à la plante) ils ont réussit à mesurer la résistance électrique afin de réaliser une traduction sonore de l’activité interne du vivant. Cette création renvoie l’illusion d’une forme de vie par un ornement sonore étrange. Cette partition végétale teintée de variations, de notes secondaires et de rythmes déstructurés retranscrit de manière métaphorique l’état de santé des plantes. Pour ce projet je me suis inspirée de Jean Thoby un pépiniériste qui voue une véritable passion pour le monde végétale. Jean Thoby avec l’aide d’ingénieurs, ont créer un instrument de musique. Par un système de boitier et de câbles (l’un fixé au sol et l’autre accroché à la plante) ils ont réussit à mesurer la résistance électrique afin de réaliser une traduction sonore de l’activité interne du vivant. Cette création renvoie l’illusion d’une forme de vie par un ornement sonore étrange. Cette partition végétale teintée de variations, de notes secondaires et de rythmes déstructurés retranscrit de manière métaphorique l’état de santé des plantes.
  
-===== Protocole pour plantes: =====+===== Protocole pour plantes: =====
 {{:wiki:flossmanuals:capacitif_pante_son_video:shema_dessin2.jpg?800|}} {{:wiki:flossmanuals:capacitif_pante_son_video:shema_dessin2.jpg?800|}}
  
 ===== Installation: ===== ===== Installation: =====
-{{:wiki:flossmanuals:capacitif_pante_son_video:shema_arduino.png?800|}}Le câblage sur le logiciel de simulation Arduino n'est pas exactement le même que celui sur les photos mais le principe est similaire. +{{:wiki:flossmanuals:capacitif_pante_son_video:shema_arduino.png?800|}} 
-Une fois les câbles bien branchés sur la TouchBoard, insérer les trois autres fils dans les plantes. Vérifiez bien que la terre est assez humides pour pourvoir être conductrice+Une fois les câbles bien branchés sur la BreadBoard, insérer les trois autres fils dans les plantes. Vérifiez bien que la terre est assez humide pour que les plantes puissent être conductrices
-{{:wiki:flossmanuals:capacitif_pante_son_video:cablage2.png?600|}}+{{:wiki:flossmanuals:capacitif_pante_son_video:branchement-03.png|}}
  
-===== Incrémentation: ===== +{{ :wiki:flossmanuals:capacitif_pante_son_video:vid_20210622_175714.mp4 |}}
-{{:wiki:flossmanuals:capacitif_pante_son_video:incrementation.png?600|}}+
  
-===== Code: ===== +===== À Télécharger : ===== 
-**1** => __plante_sonore_Arduino_3.ino__ +{{ :wiki:flossmanuals:capacitif_pante_son_video:test_7plantes_sonores.zip |}}
-<code> +
-//Import a library from the Arduino folder +
-#include <CapacitiveSensor.h> +
-//Select the two pins that will act as a capacitor +
-CapacitiveSensor   cs_2[] = {CapacitiveSensor(2, 4),// 10M resistor between pins 2 & 4, pin 2 is sensor pin, add a wire and or foil if desired +
-                             CapacitiveSensor(2, 6),// 10M resistor between pins 2 & 6, pin 6 is sensor pin, add a wire and or foi +
-                             CapacitiveSensor(2, 11)// 10M resistor between pins 2 & 11, pin 8 is sensor pin, add a wire and or foil +
-                             //CapacitiveSensor(2, 13)// 10M resistor between pins 2 & 11, pin 8 is sensor pin, add a wire and or foil +
-                            }+
-long capSensorVal[] = {0, 0, 0};+
  
-byte Ncapteurs = 3;+**Télécharger les librairies :** 
 +  * Vidéo  
 +  * Sound 
 +  * Serial
  
-//Insert the minimum value provided by the sensor to detect the touch +**Problèmes récurrents :**    
-int seuilDetection = 500; // seuil de détection sur la valeur donné par le capteur capacitif +  * Vérifier si c'est bien le bon port série. 
-const int ledPin 13;+  * Si vous utilisez un mac laissez charger le programme pendant plusieurs minutes. 
 +  * Attention aux vidéos et musiques trop lourdes. 
 +  * Et si le programme ne marche toujours pas, vérifiez l'état de la connectique : les fils ne sont peut-être plus conducteurs ou la résistance n'est peut-être pas la bonne ? 
 +===== Code: ===== 
 +**1** => **Processing :** __test_7plantes_sonores > Gestion_interactivite.pde__
  
-int plante[] = {0, 0, 0}; 
- 
-// port série 
-int inByte = 0; 
- 
-///////////////////// debug ////////////// 
-boolean debug1 = false, debug2 = false; 
-////////////////////////////////////////////SETUP //////////////////////////// 
-void setup() { 
-  // start serial port at 9600 bps: 
-  Serial.begin(9600); 
-  while (!Serial) { 
-    ; // wait for serial port to connect. Needed for native USB port only 
-  } 
- 
-  pinMode(ledPin, OUTPUT); 
-  // init des capteurs capacitifs 
-  cs_2[0].set_CS_AutocaL_Millis(0xFFFFFFFF);     // turn off autocalibrate on channel 1 - just as an example 
- 
-  establishContact();  // send a byte to establish contact until receiver responds 
-} 
- 
-void loop() { 
-  // if we get a valid byte, read analog ins: 
-  if (Serial.available() > 0) { 
-    // get incoming byte: 
-    inByte = Serial.read(); 
- 
-    long start = millis(); 
-    for (int i = 0; i < Ncapteurs; i++) { 
-      capSensorVal[i] =  cs_2[i].capacitiveSensor(30); 
-    } 
- 
-    if (debug1) { 
-      Serial.print(millis() - start);        // check on performance in milliseconds 
-      Serial.print("\t");                    // tab character for debug windown spacing 
- 
-      for (int i = 0; i < Ncapteurs; i++) { 
-        Serial.print(capSensorVal[i]);                  // print sensor output 1 
-        Serial.print("\t"); 
-      } 
-      Serial.println("");                // print sensor output 3 
-    } 
- 
- 
- 
-    // test des valeurs des capteurs 
-    for (int i = 0; i < Ncapteurs; i++) { 
-      plante[i] = testCapteur(capSensorVal[i], seuilDetection); 
-    } 
-    if (debug2) { 
-      for (int i = 0; i < Ncapteurs; i++) { 
-        Serial.print(plante[i]);                  // print sensor output 1 
-        Serial.print("\t"); 
-      } 
-      Serial.println("");                // print sensor output 3 
-    } 
-    else { 
-      // send sensor values: on envoie à Processing l'état de la plante - 0 : inactive; 255 : active 
-      for (int i = 0; i < Ncapteurs; i++) { 
-        Serial.write(plante[i]); 
-      } 
-    } 
-  } 
-} 
- 
-void establishContact() { 
-  while (Serial.available() <= 0) { 
-    Serial.print('A');   // send a capital A 
-    delay(300); 
-  } 
-} 
- 
-int testCapteur(long sensorVal, long seuilDetection) { 
-  // sensorVal : valeur du capteur 
-  // seuilDetection : seuil de détection 
- 
-  if (sensorVal > seuilDetection ) { 
-    //Turn on the led 
-    digitalWrite(ledPin, HIGH); 
-    // plante i activée 
-    return 255; 
-  } 
-  //Touch undetected 
-  else { 
-    //Turn off the led 
-    digitalWrite(ledPin, LOW); 
-    // plante i inactivée 
-    return 0; 
-  } 
- 
-} 
-</code> 
- 
-**2** => __Gestion_Interactivite__ 
 <code> <code>
-/** Plantes sonores -  +/** Plante sonore Justine Gendreau 
- *  Quand on touche la plante, cela lance une image, une vidéo, une annim, un son, etc... + *  Programme Muti */
- */ +
- */+
 /// librairies /// librairies
 import processing.sound.*; import processing.sound.*;
 import processing.video.*;  import processing.video.*; 
 import processing.serial.*; import processing.serial.*;
 +
  
  
Ligne 177: Ligne 78:
  
 // port serie // port serie
-int nPlantes = 3;+int nPlantes = 8;///////////////////// METTRE LE BON NOMBRE DE CAPTEURS /////////////// 
 int[] serialInArray = new int[nPlantes];    // Where we'll put what we receive int[] serialInArray = new int[nPlantes];    // Where we'll put what we receive
 int serialCount = 0;                 // A count of how many bytes we receive int serialCount = 0;                 // A count of how many bytes we receive
-int[] plante = {0, 0, 0};                 // Starting position of the ball+int[] plante;                 // valeur lue pour chaque plante via le port série et Arduino
 boolean firstContact = false;        // Whether we've heard from the microcontroller boolean firstContact = false;        // Whether we've heard from the microcontroller
  
Ligne 189: Ligne 90:
  
 void setup() { // initialisation des paramètres d'affichage & chargement des sons, vidéos, etc. void setup() { // initialisation des paramètres d'affichage & chargement des sons, vidéos, etc.
-  size(500500);+  size(1300860);
   noStroke();   noStroke();
   background(0);   background(0);
  
-  // initialisation des variables globales+  // initialisation des variables globale
   im = loadImage("images/chien.jpg");   im = loadImage("images/chien.jpg");
  
 +  // création et initialisation de tableau de valeur "plantes"
 +  plante = new int[nPlantes];
 +  for (int i=0; i<nPlantes; i++) {
 +    plante[i] = 0;
 +  }
  
   // son des plantes   // son des plantes
   nomSonPlante = new String[nPlantes];   nomSonPlante = new String[nPlantes];
-  nomSonPlante[0]= "sons/Chevre_2.mp3";  +  //for (int i = 0; i<nPlantes; i++) { 
-  nomSonPlante[1]= "sons/Armstrong.wav"; +  //  nomSonPlante[0] = "sons/inst"+(i+1) + ".mp3"; 
-  nomSonPlante[2]= "sons/beat.aiff";+  //} 
 +  nomSonPlante[0]= "sons/inst1.mp3";  
 +  nomSonPlante[1]= "sons/inst3.mp3"; 
 +  nomSonPlante[2]= "sons/silence.mp3"; 
 +  nomSonPlante[3]= "sons/inst4.mp3"; 
 +  nomSonPlante[4]= "sons/inst5.mp3"; 
 +  nomSonPlante[5]= "sons/inst6.mp3"; 
 +  nomSonPlante[6]= "sons/inst7.mp3"; 
 +  nomSonPlante[7]= "sons/inst8.mp3";
  
   // chargement des sons   // chargement des sons
Ligne 211: Ligne 125:
   // videos des plantes   // videos des plantes
   nomvideosPlante = new String[nPlantes];   nomvideosPlante = new String[nPlantes];
-  nomvideosPlante[0]= "videos/affiche.mp4";  +  nomvideosPlante[0]= "videos/noir.mp4";  
-  nomvideosPlante[1]= "videos/ArmstrongAlunissage.mp4"; +  nomvideosPlante[1]= "videos/noir.mp4"; 
-  nomvideosPlante[2]= "videos/transit.mov"; +  nomvideosPlante[2]= "videos/plante.mp4"; 
 +  nomvideosPlante[3]= "videos/noir.mp4"; 
 +  nomvideosPlante[4]= "videos/noir.mp4";  
 +  nomvideosPlante[5]= "videos/noir.mp4"; 
 +  nomvideosPlante[6]= "videos/noir.mp4"; 
 +  nomvideosPlante[7]= "videos/noir.mp4"; 
 +  
   video_active = new boolean[nPlantes];   video_active = new boolean[nPlantes];
   for (int i=0; i<nPlantes; i++) {   for (int i=0; i<nPlantes; i++) {
Ligne 239: Ligne 158:
  
   // print the values (for debugging purposes only):   // print the values (for debugging purposes only):
-  println("plante[0]= " +plante[0]  + "\t" + "plante[1]= " +plante[1]  + "\t" + "plante[2]= " +plante[2] + "\t" + "son[0].isPlaying()=" + son[0].isPlaying()  +  println("plante[0]=" +plante[0] + "  plante[1]=" +plante[1]  + "  plante[2]=" +plante[2]+ "  son[0].isPlaying()=" + son[0].isPlaying() 
-    + "\t" + "video[0]= " + video_active[0]  + "\t" + "video[1]= " + video_active[1]  + "\t" + "video[2]= " + video_active[2] );+    + "  plante[3]=" +plante[3]  // + "\t" +"plante[4]= " +plante[4]  + "\t" +"plante[5]= " +plante[5]  + "\t" +"plante[6]= " +plante[6]  + "\t" + "plante[7]= " +plante[7] + "\t"  
 +    + "  video[0]=" + video_active[0]+ " video[1]= " + video_active[1]  + "  video[2]= " + video_active[2] + "  video[3]= " + video_active[3]); 
 + 
 +  //printArray(plante); 
 +  //printArray(video_active);
  
   ///////////////////////// interactivités liées aux plantes   ///////////////////////// interactivités liées aux plantes
Ligne 250: Ligne 173:
   //// affichage de la vidéo si la vidéo i est active ////////////////////////////////////////   //// affichage de la vidéo si la vidéo i est active ////////////////////////////////////////
   boolean une_video_active=false;   boolean une_video_active=false;
-  for(int i=0;i<nPlantes;i++){+  for (int i=0; i<nPlantes; i++) {
     une_video_active = (une_video_active || video_active[i]);     une_video_active = (une_video_active || video_active[i]);
   }   }
Ligne 270: Ligne 193:
 </code> </code>
  
- +**2** => **Processing :** __ test_7plantes_sonores > test_7plantes_sonores.pde__
-**3** => __plante_sonore_Processing_3__+
 <code> <code>
 ///////////////////////////////// Plante ///////////////////////////////////////////////////// ///////////////////////////////// Plante /////////////////////////////////////////////////////
Ligne 328: Ligne 250:
 } }
 </code> </code>
- +**3** => **Processing :** __test_7plantes_sonores > SerialEvent.pde__
-**4** => __SerialEvent__+
 <code> <code>
 void serialEvent(Serial myPort) { void serialEvent(Serial myPort) {
Ligne 343: Ligne 264:
       firstContact = true;     // you've had first contact from the microcontroller       firstContact = true;     // you've had first contact from the microcontroller
       myPort.write('A');       // ask for more       myPort.write('A');       // ask for more
-    }  +    } 
-  }  +  } else {
-  else {+
     // Add the latest byte from the serial port to array:     // Add the latest byte from the serial port to array:
     serialInArray[serialCount] = inByte;     serialInArray[serialCount] = inByte;
Ligne 351: Ligne 271:
  
     // If we have 3 bytes:     // If we have 3 bytes:
-    if (serialCount > ) { +    if (serialCount > nPlantes-1 ) { 
-      plante[0] = serialInArray[0]; +      for (int i=0; i<nPlantes; i++) { 
-      plante[1] = serialInArray[1]; +        plante[i] = serialInArray[i]; 
-      plante[2] = serialInArray[2];+      } 
 +      //plante[0] = serialInArray[0]; 
 +      //plante[1] = serialInArray[1]; 
 +      //plante[2] = serialInArray[2]; 
 +      //plante[3] = serialInArray[3]; 
 +      //plante[4] = serialInArray[4]; 
 +      //plante[5] = serialInArray[5]; 
 +      //plante[6] = serialInArray[6]; 
 +      //plante[7] = serialInArray[7];
  
       // print the values (for debugging purposes only):       // print the values (for debugging purposes only):
Ligne 365: Ligne 293:
     }     }
   }   }
 +}
 +</code>
 +
 +
 +</code>
 +
 +**4** => **Arduino** : test_7plantes_sonores.ino.ino
 +<code>
 +
 +//Import a library from the Arduino folder
 +#include <CapacitiveSensor.h>
 +/////////////////////////////// METTRE LE BON NOMBRE DE CAPTEURS /////////
 +byte Ncapteurs = 8;
 +
 +//Select the two pins that will act as a capacitor
 +CapacitiveSensor   cs_2[] = {CapacitiveSensor(2, 3),// 10M resistor between pins 2 & 4, pin 2 is sensor pin, add a wire and or foil if desired
 +                             CapacitiveSensor(2, 4),// 10M resistor between pins 2 & 6, pin 6 is sensor pin, add a wire and or foi
 +                             CapacitiveSensor(2, 5),// 10M resistor between pins 2 & 11, pin 8 is sensor pin, add a wire and or foil
 +                             CapacitiveSensor(2, 6),// 10M resistor between pins 2 & 11, pin 8 is sensor pin, add a wire and or foil
 +                             CapacitiveSensor(2, 7),// 10M resistor between pins 2 & 11, pin 8 is sensor pin, add a wire and or foil
 +                             CapacitiveSensor(2, 8),// 10M resistor between pins 2 & 11, pin 8 is sensor pin, add a wire and or foil
 +                             CapacitiveSensor(2, 9),// 10M resistor between pins 2 & 11, pin 8 is sensor pin, add a wire and or foil
 +                             CapacitiveSensor(2, 10),// 10M resistor between pins 2 & 11, pin 8 is sensor pin, add a wire and or foil
 +                            };
 +long* capSensorVal ; // mémorise la valeur lue sur chaque capteurs
 +
 +//Insert the minimum value provided by the sensor to detect the touch
 +int seuilDetection = 500; // seuil de détection sur la valeur donné par le capteur capacitif
 +const int ledPin = 13;
 +
 +int* plante ;
 +
 +// port série
 +int inByte = 0;
 +
 +///////////////////// debug //////////////
 +boolean debug1 = false, debug2 = false;
 +////////////////////////////////////////////SETUP ////////////////////////////
 +void setup() {
 +  // start serial port at 9600 bps:
 +  Serial.begin(9600);
 +  while (!Serial) {
 +    ; // wait for serial port to connect. Needed for native USB port only
 +  }
 +
 +  // création des tableaux
 +  capSensorVal = malloc(Ncapteurs * sizeof(long));
 +  plante = malloc(Ncapteurs * sizeof(int));
 +  // initialisation des tableaux
 +  for (int i = 0; i < Ncapteurs; i++) {
 +    capSensorVal[i] =  0;
 +    plante[i] = 0;
 +  }
 +
 +  pinMode(ledPin, OUTPUT);
 +  // init des capteurs capacitifs
 +  cs_2[0].set_CS_AutocaL_Millis(0xFFFFFFFF);     // turn off autocalibrate on channel 1 - just as an example
 +
 +  establishContact();  // send a byte to establish contact until receiver responds
 +}
 +
 +void loop() {
 +  // if we get a valid byte, read analog ins:
 +  if (Serial.available() > 0) {
 +    // get incoming byte:
 +    inByte = Serial.read();
 +
 +    long start = millis();
 +    for (int i = 0; i < Ncapteurs; i++) {
 +      capSensorVal[i] =  cs_2[i].capacitiveSensor(30);
 +    }
 +
 +    if (debug1) {
 +      Serial.print(millis() - start);        // check on performance in milliseconds
 +      Serial.print("\t");                    // tab character for debug windown spacing
 +
 +      for (int i = 0; i < Ncapteurs; i++) {
 +        Serial.print(capSensorVal[i]);                  // print sensor output 1
 +        Serial.print("\t");
 +      }
 +      Serial.println("");                // print sensor output 3
 +    }
 +
 +
 +
 +    // test des valeurs des capteurs
 +    for (int i = 0; i < Ncapteurs; i++) {
 +      plante[i] = testCapteur(capSensorVal[i], seuilDetection);
 +    }
 +    if (debug2) {
 +      for (int i = 0; i < Ncapteurs; i++) {
 +        Serial.print(plante[i]);                  // print sensor output 1
 +        Serial.print("\t");
 +      }
 +      Serial.println("");                // print sensor output 3
 +    }
 +    else {
 +      // send sensor values: on envoie à Processing l'état de la plante - 0 : inactive; 255 : active
 +      for (int i = 0; i < Ncapteurs; i++) {
 +        Serial.write(plante[i]);
 +      }
 +    }
 +  }
 +}
 +
 +void establishContact() {
 +  while (Serial.available() <= 0) {
 +    Serial.print('A');   // send a capital A
 +    delay(300);
 +  }
 +}
 +
 +int testCapteur(long sensorVal, long seuilDetection) {
 +  // sensorVal : valeur du capteur
 +  // seuilDetection : seuil de détection
 +
 +  if (sensorVal > seuilDetection ) {
 +    //Turn on the led
 +    digitalWrite(ledPin, HIGH);
 +    // plante i activée
 +    return 255;
 +  }
 +  //Touch undetected
 +  else {
 +    //Turn off the led
 +    digitalWrite(ledPin, LOW);
 +    // plante i inactivée
 +    return 0;
 +  }
 +
 } }
 </code> </code>