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
projets:e_fabrik_2018 [05/04/2018 16:04]
Mathieu Hery
projets:e_fabrik_2018 [20/05/2019 19:08] (Version actuelle)
Mathieu Hery
Ligne 1: Ligne 1:
-====== Projets E-Fabrik' ​======+====== Projets E-Fabrik ​2018 ======
  
 ==== Résumé ==== ==== Résumé ====
Ligne 21: Ligne 21:
 ==== David : Horloge à couleur ==== ==== David : Horloge à couleur ====
  
-Un objet/​horloge qui indique les moments de la journée avec une couleur ​plutôt qu'en affichant l'​heure+Un objet/​horloge qui indique les moments de la journée avec une couleur ​:
  
-Pour garder une arduino à l'​heure ​[[https://​learn.adafruit.com/​adafruit-data-logger-shield/​using-the-real-time-clock]] +  *6h - 12h Jaune 
-[[https://​www.reddit.com/​r/​arduino/​comments/​7x9fvb/​best_rtc_chip/​|Reddit thread on RTC chips]]+  *12h - 14h Vert 
 +  *14h 17h : Bleu 
 +  *17h 20h : Rouge 
 +  *20h - 00h Blanc
  
 === Apprentis === === Apprentis ===
Ligne 31: Ligne 34:
   * Sara   * Sara
  
-==== René Joystick/​souris pour contrôler l'​ordinateur ====+{{projets:oeuf_horloge.png?​200}} 
 +{{projets:​horloge_couleur.jpg?​200}} 
 +{{projets:​horloge_couleur_cablage.png?​400}}
  
-Adapter un joystick à fixer sur la chaise de René pour lui servir de souris pour contrôler l'​ordinateur+=== Besoins ===
  
-=== Apprentis ​===+  * 1 carte Arduino Uno 
 +  * 1 module DS3231 
 +  * 1 ledstrip type Pololu ou Adafruit avec au moins 16 leds 
 +  * 1 imprimante 3D 
 +  * 1 alimentation 5V avec de la connectique à souder 
 + 
 +=== Arduino === 
 +// 
 +Attention, si besoin de réinitialiser l'​heure dans le chip DS3231 il faut impérativement utiliser l'​heure d'​été pour que le code fonctionne correctement.//​ 
 + 
 +++++ Code Arduino | 
 +<code c> 
 +/*  Color Clock 
 +    E-Fabrik'​ 2018 - Pop [lab] 
 + 
 +    A clock-like object changes color according to which part of the day it is. 
 + 
 +    ######## 
 +    WIRING : 
 +    ######## 
 +    Plug a DS3231 chip on 5V/GND 
 +    SDA > A4 
 +    SCL > A5 
 + 
 +    Use DS3231 lib examples to set the time. 
 +    Warning : Time must be set using summer-time (no daylight saving) for this code to work properly. 
 + 
 +    Ledstrips on 5V/GND 
 +    DI > pin 8 
 + 
 +    Simple switch on 5V/GND 
 +    reading > pin 2 
 +    --> HIGH : Summer time, no daylight saving 
 +    --> LOW : Winter time, daylight saving (-1h) 
 + 
 +    Last update : 24/05/2018 - mh8 
 +*/ 
 + 
 +//libs 
 +#include <​DS3231.h>​ 
 +#include <​Wire.h>​ 
 +#include <​Adafruit_NeoPixel.h>​ 
 + 
 +//​constants 
 +#define SWITCH 2 
 +#define DATA_PIN 8 
 + 
 +//​variables 
 +DS3231 Clock; 
 +bool Century = false; 
 +bool h12; 
 +bool PM; 
 +byte ADay, AHour, AMinute, ASecond, ABits; 
 +bool ADy, A12h, Apm; 
 + 
 +Adafruit_NeoPixel ledstrip = Adafruit_NeoPixel(4,​ DATA_PIN, NEO_GRB + NEO_KHZ800);​ 
 + 
 +uint32_t color = (0, 0, 0); 
 + 
 +void setup() { 
 +  //Start I2C interface with DS3231 
 +  Wire.begin();​ 
 + 
 +  pinMode(SWITCH,​ INPUT); 
 + 
 +  //​Initialize ledstrip 
 +  ledstrip.begin();​ 
 +  ledstrip.show();​ 
 +  ledstrip.setBrightness(100);​ 
 + 
 +  //Start serial interface 
 +  Serial.begin(9600);​ 
 +
 + 
 +void loop() { 
 +  // Read & show date and time from DS3231 (RTC) 
 +  Serial.print("​Date : "); 
 +  Serial.print(Clock.getDate(),​ DEC); 
 +  Serial.print("/"​);​ 
 +  Serial.print(Clock.getMonth(Century),​ DEC); 
 +  Serial.print("/"​);​ 
 +  Serial.print("​20"​);​ 
 +  Serial.print(Clock.getYear(),​ DEC); 
 +  Serial.print("​ - Time : "); 
 +  Serial.print(Clock.getHour(h12,​ PM), DEC); 
 +  Serial.print(':'​);​ 
 +  Serial.print(Clock.getMinute(),​ DEC); 
 +  Serial.print(':'​);​ 
 +  Serial.print(Clock.getSecond(),​ DEC); 
 + 
 +  int buttonState = digitalRead(SWITCH);​ 
 +  int hour; 
 + 
 +  if (buttonState == 1) { 
 +    //​Summertime > Do nothing to time 
 +    hour = Clock.getHour(h12,​ PM); 
 +  } 
 + 
 +  if (buttonState == 0) { 
 +    //​Wintertime > Remove 1 hour from time read 
 +    if (Clock.getHour(h12,​ PM) == 0) { 
 +      //Exception when midnight 
 +    hour = 23; 
 +  } 
 +  else { 
 +    hour = Clock.getHour(h12,​ PM) - 1; 
 +    } 
 +  } 
 + 
 +  Serial.print("​ - hour var : " ); 
 +  Serial.print(hour);​ 
 + 
 + 
 + 
 +  if (hour >= 6 && hour < 12) { 
 +    color = ledstrip.Color(255,​ 255, 0); 
 +    lightLeds();​ 
 +  } 
 + 
 + 
 +  else if (hour >= 12 && hour < 14) { 
 +    color = ledstrip.Color(0,​ 255, 0); 
 +    lightLeds();​ 
 +  } 
 + 
 +  else if (hour >= 14 && hour < 17) { 
 +    color = ledstrip.Color(0,​ 0, 255); 
 +    lightLeds();​ 
 +  } 
 + 
 +  else if (hour >= 17 && hour < 20) { 
 +    color = ledstrip.Color(255,​ 0, 0); 
 +    lightLeds();​ 
 +  } 
 + 
 +  else if (hour >= 20) { 
 +    color = ledstrip.Color(255,​ 255, 255); 
 +    lightLeds();​ 
 +  } 
 + 
 +  else { 
 +    color = ledstrip.Color(0,​ 0, 0); 
 +    lightLeds();​  
 +  } 
 + 
 + 
 +  Serial.print('​\n'​);​ 
 + 
 +
 + 
 +void lightLeds() { 
 +    for (uint8_t i = 0; i < ledstrip.numPixels();​ i++) { 
 +    ledstrip.setPixelColor(i,​ color); 
 +    ledstrip.show();​ 
 +  } 
 +
 + 
 + 
 + 
 +</​code>​ 
 +++++ 
 + 
 +=== Fichiers ​===
  
-  * Abel (du MAS Glasberg)+  *[[http://​poplab.maisonpop.fr/​ressources/​3D/​oeuf_OK.123dx|Oeuf,​ fichier 123 Design]] 
 +  *[[http://​poplab.maisonpop.fr/​ressources/​3D/​oeuf_OK.stl|Oeuf,​ fichier STL]] 
 +  *[[http://​poplab.maisonpop.fr/​ressources/​3D/​socle.123dx|Socle,​ fichier 123 Design]] 
 +  *[[http://​poplab.maisonpop.fr/​ressources/​3D/​socle.stl|Socle,​ fichier STL]]