Passerelle.Infini 2025 : MOUMOUNAN
Sommaire
[masquer]résumé du projet
Création d'un objet distributeur de câlins à distance dans l'espace public
membres du projet
Claire Denieul - Aude Mouillot - Catherine Huve - Mélissa Rosingana
Bibliographie et webographie sur le projet
Mettre ici des exemples trouvés sur web de projets qui ressemblent et des technologies qui s'en rapprochent ou qui servent d'inspiration.
- calinothérapie
https://www.24heures.ch/les-bienfaits-de-la-calinotherapie-expliques-par-une-experte-803631900339
pistes explorée, abandonnées ou fertiles
prototype qu'on souhaite réaliser
code
1
2 /////////////////////////
3 // POCL Poke //
4 /////////////////////////
5 /*
6 * Un POCL imaginé et réalisé au Hackathon POCL à l'édulab Rennes 2 les 9 et 10 décembre 2021.
7 *
8 * Difficultés :
9 * Configurez le logiciel Arduino pour gérer la carte D1 mini (ESP8266).
10 * Intégrer les biobliothèues requises par le projet :
11 ** #include <MQTT.h> -> pour gérer le protocole de communication, c'est la bibliothèque MQTT de Joël Gähwiler : https://github.com/256dpi/arduino-mqtt
12 ** #include <Adafruit_NeoPixel.h> -> pour gérer les rubans de led
13 ** #include <WiFiManager.h> -> Bibliothèque WiFiManager pour configurer automatiquement le réseau wifi et le mot de passe.
14 *
15 * BROCHAGE
16 _________________
17 / D1 mini \
18 - |[ ]RST TX[ ]| -
19 - |[ ]A0 -GPIO RX[ ]| -
20 |[ ]D0-16 5-D1[ ]| -
21 |[ ]D5-14 4-D2[ ]| -
22 Bouton - |[X]D6-12 0-D3[X]| - ruban de leds
23 - |[ ]D7-13 2-D4[ ]| LED_BUILTIN
24 - |[ ]D8-15 GND[X]| - GND (Boutons, ruban de leds)
25 - |[ ]3V3 . 5V[X]| - ruban de Led
26 | +---+ |
27 |_______|USB|_______|
28
29 Matériel :
30 - des fils dupont.
31 - un ruban de led RGB WS28B12
32 - D1 mini (Wemos, LOLIN,...)
33 - bouton poussoir
34 - une alimentation 5V
35 */
36 /*
37 * Un travail d'équipe de :
38 * Alma Oskouei
39 * Gaëlle Bescond
40 * Tony Vanpoucke
41 * Wing-Anh Luy
42 * Antony Le Goïc-Auffret
43 ___
44 / ___ \
45 |_| | |
46 /_/
47 _ ___ _
48 |_| |___|_| |_
49 ___|_ _|
50 |___| |_|
51 Les petits Débrouillards - décembre 2021 CC-By-Sa http://creativecommons.org/licenses/by-nc-sa/3.0/
52 // Programme inspiré de celui par Joël Gähwiler
53 // https://github.com/256dpi/arduino-mqtt
54 */
55 #include <ESP8266WiFi.h>
56 #include <MQTT.h> // Bibliothèque MQTT par Joël Gaehwiler
57 #include <Adafruit_NeoPixel.h> // Bibliothèque NeoPixel d'Adafruit
58 #include <WiFiManager.h> // Bibliothèque WiFiManager pour configurer automatiquement le réseau wifi et le mot de passe.
59
60 WiFiClient net; //on crée l'objet WiFiClient "Net"
61 MQTTClient client;
62 #define BROKER_IP "debrouillards.ddns.net" //IP du serveur sur lequel est installé le Broker MQTT
63
64 unsigned long lastMillis = 0;
65
66 //=============élément pour le ruban de led et le bouton===============
67
68 // Broche de connexion du ruban de LED
69 #define PIN D3 //
70
71 const int brocheBouton = 12; //GPIO de la broche D6
72
73 const int vib = D4;
74
75 // Nombre de Led RDGB dans votre ruban
76 #define NUMPIXELS 13
77
78 // on configurer un riban nommé "pixels"
79 Adafruit_NeoPixel pixels(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
80
81 #define T 1 // temps pour gérer le fade du ruban
82 //==============================================================
83
84 void connect() {
85 Serial.print("Vérification de la connexion Wifi...");
86 while (WiFi.status() != WL_CONNECTED) {
87 Serial.print(".");
88 delay(1000);
89 }
90
91 Serial.print("\nconnexion au serveur MQTT en cours...");
92 //connection au serveur MQTT : identifiant, User, mot de passe
93 while (!client.connect("Antony", "poclpokou", "pokou")) {
94 Serial.print(".");
95 delay(1000);
96 }
97
98 Serial.println("\nconnecté à MQTT !");
99
100 // on s'abonne au sujet (topic) "/mou"
101 client.subscribe("/mou"); // Attention à la casse !! La casse c'est maj ou minuscule
102 Serial.println("Abonné à /mou");
103 // client.unsubscribe("/mou");// Pour se désinscrire
104 }
105
106 void messageReceived(String &topic, String &payload) {
107 digitalWrite(LED_BUILTIN, HIGH);
108 fade();
109 Serial.println("incoming: " + topic + " - " + payload);
110 if (payload == "calin"){
111 Serial.println("clic !");
112 digitalWrite(LED_BUILTIN, LOW);
113 delay(100);
114 digitalWrite(LED_BUILTIN, HIGH);
115 }
116 }
117
118 void fade() {
119 for (int sig=0; sig<3; sig++){
120 for (int b=0; b<255; b++){
121 pixels.setBrightness(b);
122
123 for(int i=0; i<NUMPIXELS; i++) {
124 pixels.setPixelColor(i, pixels.Color(250, 150, b));
125 }
126 pixels.show(); // On allume les rubans
127 digitalWrite(vib, HIGH);
128 delay(T);
129 }
130
131 for (int b=255; b>1; b--){ //boucle de gestion de la brillance
132 pixels.setBrightness(b);
133
134 // n'oubliez pas que le premier pixel porte le Numéro 0
135 for(int i=0; i<NUMPIXELS; i++) { // Pour chaque pixel...
136
137 // pixels.Color() prends les valeurs RGB de 0,0,0 jusqu'à 255,255,255
138 pixels.setPixelColor(i, pixels.Color(b, 50, 255));
139 }
140 pixels.show(); // on affiche les pixels
141 digitalWrite(vib, LOW);
142 delay(T);
143 }
144 }
145 }
146
147 void setup() {
148 Serial.begin(115200);
149
150 WiFi.mode(WIFI_STA); // la carte D1 mini est mise en mode STATION
151 WiFiManager MonReseauWifi; // on crée l'objet "MonReseauWifi"
152
153 bool res;
154 res = MonReseauWifi.autoConnect("Wifi POCL Pokou"); // le POCL diffuse un réseau wifi en accès libre nommé "Wifi POCL Pokou"
155
156 if(!res) {
157 Serial.println("La connexion n'a pas fonctionnée...");
158 }
159 else {
160 Serial.println("Vous êtes connecté au Wifi... :-)");
161 }
162
163 pixels.begin(); //on initialise le ruban "pixels"
164 pinMode(brocheBouton,INPUT_PULLUP);
165
166 pinMode(LED_BUILTIN, OUTPUT);
167 digitalWrite(LED_BUILTIN, HIGH);
168 pinMode(vib, OUTPUT);
169 digitalWrite(vib, LOW);
170
171 // on se connecte au client
172 client.begin(BROKER_IP, 1883, net); // (IP, port, Client Wfi défini plus haut)
173 client.onMessage(messageReceived);
174
175 connect();
176 }
177
178 void loop() {
179 pixels.clear(); // Set all pixel colors to 'off'
180 pixels.show();
181 digitalWrite(vib, LOW);
182
183 client.loop();
184 delay(10); // <- fixes some issues with WiFi stability
185
186 if (!client.connected()) {
187 connect();
188 }
189
190 // publish a message roughly every second.
191
192 if ( digitalRead(brocheBouton) == LOW ){
193 Serial.println("Appuis Bouton");
194 client.publish("/mou", "calin");
195 delay(250);
196 }
197 }