projets:2019:stagefevrierubo
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédenteProchaine révisionLes deux révisions suivantes | ||
projets:2019:stagefevrierubo [2019/02/12 07:54] – créée christian.jacolot | projets:2019:stagefevrierubo [2019/02/20 08:27] – christian.jacolot | ||
---|---|---|---|
Ligne 28: | Ligne 28: | ||
- | ===== État du stock ===== | + | ===== État du stock et matériel pour le stage ===== |
- | A vérifier en fonction des projets: | + | Stock à vérifier en fonction des projets. |
+ | Voici une première liste de matériel à apporter avec nous pour le stage: | ||
^ Intitulé ^ Quantité dans le stock ^ A commander/ | ^ Intitulé ^ Quantité dans le stock ^ A commander/ | ||
Ligne 36: | Ligne 37: | ||
| Arduino nano (avec câble USB) | | | | | Arduino nano (avec câble USB) | | | | ||
| Câbles élec | | | | | Câbles élec | | | | ||
- | | Batterie USB | | | | + | | écran pour le vidéo-projecteur |
+ | | vidéo-projecteur | | ||
+ | | 2 rallonges | | ||
+ | | 4 multiprise | | ||
+ | | 12 PCs: (j'en ai déjà 5 de prêt, il m'en reste 2/3 à préparer) | | ||
+ | | alimentations PC | | ||
+ | | souris PC | | ||
+ | | 12 cartes arduinos (avec cordons USB) | | ||
+ | | 12 DHT 11 | | ||
+ | | 12 relais | | ||
+ | | 12 transistors | | ||
+ | | 12 servo moteurs | | ||
+ | | 12 LDR | | ||
+ | | 12 ventilateurs | | ||
+ | | cartes de support pour les éléments | | ||
+ | | fils de connexion | | ||
+ | | 3/4 fers à souder | | ||
+ | | 4 tapis pour fer à souder | | ||
+ | | 4 support fer à souder | | ||
+ | | étain | | ||
+ | | fils | | ||
+ | | en option (afficheurs LCD, module bluetooth) | ||
Ligne 84: | Ligne 106: | ||
Nous remercions Yves et Matthieu pour accueillir le stage dans les locaux de l'UBO Open Factory. | Nous remercions Yves et Matthieu pour accueillir le stage dans les locaux de l'UBO Open Factory. | ||
+ | |||
+ | === Préparation des PC === | ||
+ | |||
+ | Installation de xubuntu 18.04 sur les PC, iso sur clé USB. | ||
+ | |||
+ | Mise à jour et installation des logiciels/ | ||
+ | < | ||
+ | $ sudo apt update | ||
+ | $ sudo apt upgrade | ||
+ | $ sudo apt install git mercurial build-essential arduino-core arduino-mk gcc-avr avr-libc openjdk-8-jdk | ||
+ | $ sudo apt install squeak-vm squeak-plugins-scratch | ||
+ | $ sudo apt install nodejs npm | ||
+ | $ id | ||
+ | $ sudo usermod -a -G dialout $USER | ||
+ | $ more /etc/group | ||
+ | # télécharger arduino sur arduino.cc / linux 32 bits | ||
+ | $ cd Téléchargements/ | ||
+ | $ tar xf arduino-1.8.8-linux32.tar.xz | ||
+ | $ cd arduino-1.8.8/ | ||
+ | $ ./ | ||
+ | $ cd | ||
+ | # démarrer arduino IDE | ||
+ | # menu Outils / Gérer les bibliothèques | ||
+ | # installer: circuit playground, unified sensor, DHT sensor library | ||
+ | $ sudo npm install -g --unsafe-perm node-red | ||
+ | $ node-red | ||
+ | # navigateur web sur localhost: | ||
+ | # installer via palette: node-red-node-serialport et node-red-dashboard | ||
+ | $ sudo apt install logisim openssh-server | ||
+ | $ sudo apt install gcc-avr avr-libc flashplugin-installer algobox blender python3-dev python3-setuptools python3-numpy | ||
+ | $ sudo apt install python3-opengl ffmpeg libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsmpeg-dev libsdl1.2-dev libportmidi-dev libswscale-dev libavformat-dev libavcodec-dev libtiff5-dev libx11-6 libx11-dev fluid-soundfont-gm timgm6mb-soundfont xfonts-base xfonts-100dpi xfonts-75dpi xfonts-cyrillic fonts-freefont-ttf libfreetype6-dev | ||
+ | $ java -version | ||
+ | $ javac -version | ||
+ | $ sudo update-alternatives --config java | ||
+ | # choisir java 8 | ||
+ | $ java -version | ||
+ | $ sudo add-apt-repository ppa: | ||
+ | $ sudo apt update | ||
+ | $ sudo apt install openscad | ||
+ | $ sudo apt install fritzing fritzing-parts gimp | ||
+ | |||
+ | </ | ||
+ | |||
+ | |||
+ | === Présentation === | ||
+ | |||
+ | == Documents == | ||
+ | |||
+ | Fichier de présentation | ||
+ | {{ : | ||
+ | |||
+ | |||
+ | === Code === | ||
+ | |||
+ | Code Arduino pour piloter le relai tout en récupérant la température et l' | ||
+ | < | ||
+ | |||
+ | int relayPin = 3; // relay pin -- Digital 3 | ||
+ | int relayState = HIGH; | ||
+ | |||
+ | int incomingByte = 0; // for incoming serial data | ||
+ | |||
+ | unsigned long previousMillis = 0; | ||
+ | |||
+ | long checkDHT = 2000; | ||
+ | |||
+ | void setup() { | ||
+ | Serial.begin(9600); | ||
+ | pinMode(relayPin, | ||
+ | digitalWrite(relayPin, | ||
+ | previousMillis = millis(); | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | // send data only when you receive data: | ||
+ | if (Serial.available() > 0) { | ||
+ | // read the incoming byte: | ||
+ | incomingByte = Serial.read(); | ||
+ | // Serial.print(" | ||
+ | // Serial.println(incomingByte, | ||
+ | if (incomingByte == 49) { // ASCII: 1 => 49 | ||
+ | relayState = HIGH; | ||
+ | } else { | ||
+ | relayState = LOW; | ||
+ | } | ||
+ | } | ||
+ | unsigned long currentMillis = millis(); | ||
+ | if (currentMillis - previousMillis >= checkDHT) { | ||
+ | previousMillis = currentMillis; | ||
+ | Serial.print(" | ||
+ | Serial.print(random(20, | ||
+ | Serial.print(", | ||
+ | Serial.print(random(0, | ||
+ | Serial.println(" | ||
+ | } | ||
+ | // set the relay: | ||
+ | digitalWrite(relayPin, | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Nodered flow: | ||
+ | {{ : | ||
+ | |||
+ | |||
+ | Avec servo moteur | ||
+ | < | ||
+ | #include < | ||
+ | #include < | ||
+ | |||
+ | VarSpeedServo myservo; | ||
+ | |||
+ | int pos = 0; // variable to store the servo position | ||
+ | int positionServo = 0; | ||
+ | int speedServo = 100; | ||
+ | |||
+ | StaticJsonBuffer< | ||
+ | String strJSON; | ||
+ | |||
+ | void setup() { | ||
+ | myservo.attach(9); | ||
+ | Serial.begin(9600); | ||
+ | myservo.write(positionServo, | ||
+ | } | ||
+ | |||
+ | void loop() { | ||
+ | if(Serial.available() > 0) { | ||
+ | strJSON = Serial.readStringUntil(' | ||
+ | JsonObject& | ||
+ | |||
+ | if (!root.success()) { | ||
+ | Serial.println(" | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | // Fetch values. | ||
+ | // | ||
+ | // Most of the time, you can rely on the implicit casts. | ||
+ | // In other case, you can do root[" | ||
+ | if(root.containsKey(" | ||
+ | positionServo = root[" | ||
+ | speedServo = root[" | ||
+ | |||
+ | // Print values. | ||
+ | // Serial.println(positionServo); | ||
+ | // Serial.println(speedServo); | ||
+ | // myservo.write(positionServo, | ||
+ | } else { | ||
+ | Serial.println(" | ||
+ | } | ||
+ | } | ||
+ | myservo.write(positionServo, | ||
+ | } | ||
+ | </ | ||
projets/2019/stagefevrierubo.txt · Dernière modification : 2024/04/16 22:26 de 127.0.0.1