Fabrication industrielle
Internet des objets industriel | Matériaux industriels | Entretien et réparation d'équipement | Programmation industrielle |
home  MfgRobots >> Fabrication industrielle >  >> Manufacturing Technology >> Processus de fabrication

Station Météo Compacte : Arduino Nano & ESP8266 avec Capteur BMP280 et Affichage OLED/Nokia LCD

Composants et Fournitures

Arduino Nano R3 ×1
Capteur Pression Barométrique BMP280 I2C (MyOctopus) ×1
Écran LCD Nokia 5110 ×1
NodeMCU 1.0 (ESP-12E) ×1
Écran OLED Graphique 128×64 ×1

Outils Nécessaires

À Propos du Projet

Ce dispositif intègre deux modules indépendants dans un même boîtier :

Module 1 : Baromètre Arduino (BMP280 / BMP180)

Mesure la pression atmosphérique en temps réel, ainsi que les différences à -1h et -3h, utiles pour les prévisions météo à court terme. Le code est adapté de shelvin.de ; il faut entrer l'offset entre pression absolue et relative pour l'altitude dans la ligne druck_offset=. Les résultats (pression, différences 1h/3h, température interne) s'affichent sur l'écran Nokia 5110.

Station Météo Compacte : Arduino Nano & ESP8266 avec Capteur BMP280 et Affichage OLED/Nokia LCD

Module 2 : Station Connectée ESP8266 (OpenWeatherMap)

Le NodeMCU (ESP8266) se connecte en Wi-Fi à openweathermap.org pour récupérer une prévision sur 3 jours et l'afficher sur l'écran OLED 0,96". Il faut insérer une clé API (obtenue sur OpenWeatherMap) dans le code. Instructions détaillées pour bibliothèques et installation : Guide de démarrage ESP8266 Weather Station.

Le schéma complet du dispositif est présenté ci-dessous.

Code Arduino (Module Baromètre Nokia 5110)

// Luftdruck Ausgabe aktuell // Différence pression 1h et 3h (EEPROM) // Température
// Bauteile: LCD Nokia 5110, BMP180, Arduino Uno
// Matthias Busse Version 1.0 vom 21.9.2014

#include <Wire.h>
#include <avr/sleep.h>
#include <EEPROM.h>

// Variables EEPROM
int eepromAdresse=0, eepromMax=1023;
int eepromOldAdr, eepromDif1=60, eepromDif3=180; // 60/180 minutes

// Variables BMP180
#define I2C_ADDRESS 0x77
const unsigned char oversampling_setting = 3;
const unsigned char pressure_waittime[4] = { 5, 8, 14, 26 };
int ac1, ac2, ac3, b1, b2, mb, mc, md;
unsigned int ac4, ac5, ac6;
int temp = 20, temp_mittel=200, test=0;
long druck = 1013, druck_mittel=101300;
float t, temp_offset=0.0, d, dAlt, dDiff, druck_offset=2.0;
int zeitabgl=0, mitteln=5;
char tstring[5], dstring[7];

// Power Down
volatile int sleepcounter = 0;

// Table ASCII pour Nokia 5110 (police 5x7)
static const byte ASCII[][5] = { ... };

#define RST 12, CE 11, DC 10, DIN 9, CLK 8

void setup() {
  // Init EEPROM à zéro
  for(int i=0; i < eepromMax; i+=4) eepromWriteLong(0,i);
  
  // Configuration Power Down (Watchdog, ADC off, Comparateur off, Buffers off)
  watchdogOn();
  ADCSRA &= B01111111;
  ACSR = B10000000;
  DIDR0 |= B00111111;
  
  Wire.begin();
  bmp180_get_cal_data();
  bmp180_read_temperature_and_pressure(&temp_mittel, &druck_mittel);
  
  // Init Nokia 5110
  pinMode(RST, OUTPUT); pinMode(CE, OUTPUT); pinMode(DC, OUTPUT); pinMode(DIN, OUTPUT); pinMode(CLK, OUTPUT);
  digitalWrite(RST, LOW); digitalWrite(RST, HIGH);
  LcdWriteCmd(0x21); LcdWriteCmd(0xB8); LcdWriteCmd(0x04); LcdWriteCmd(0x14); LcdWriteCmd(0x20); LcdWriteCmd(0x0C);
  LcdClearScreen();
}

void loop() {
  bmp180_read_temperature_and_pressure(&temp, &druck);
  temp_mittel = ((temp_mittel * (mitteln-1)) + temp) / mitteln;
  druck_mittel = ((druck_mittel * (mitteln-1)) + druck) / mitteln;
  t = ((float)temp_mittel/10.0) + temp_offset;
  d = ((float)druck_mittel/100.0) + druck_offset;
  
  // Affichage pression actuelle
  LcdClearLine(0); LcdXY(12,0); LcdWriteString(dtostrf(d,7,2,dstring)); LcdXY(60,0); LcdWriteString("hPa");
  
  // Sauvegarde pression dans EEPROM (×100 pour 2 décimales)
  eepromWriteLong(d*100, eepromAdresse);
  
  // Différence 1h
  eepromOldAdr = eepromAdresse - (eepromDif1*4);
  if(eepromOldAdr < 0) eepromOldAdr = eepromMax + 1 + eepromOldAdr;
  dAlt = (float)eepromReadLong(eepromOldAdr)/100.0;
  dDiff = d - dAlt;
  LcdClearLine(2); LcdXY(8,2); LcdWriteString("1h:");
  if(dAlt > 800) { LcdXY(27,2); if(dDiff < 0) LcdWriteString("-"); else LcdWriteString("+"); if(dDiff < 0) dDiff*=-1; LcdXY(34,2); LcdWriteString(dtostrf(dDiff,4,2,dstring)); }
  LcdXY(60,2); LcdWriteString("hPa");
  
  // Différence 3h
  eepromOldAdr = eepromAdresse - (eepromDif3*4);
  if(eepromOldAdr < 0) eepromOldAdr = eepromMax + 1 + eepromOldAdr;
  dAlt = (float)eepromReadLong(eepromOldAdr)/100.0;
  dDiff = d - dAlt;
  LcdClearLine(3); LcdXY(8,3); LcdWriteString("3h:");
  if(dAlt > 800) { LcdXY(27,3); if(dDiff < 0) LcdWriteString("-"); else LcdWriteString("+"); if(dDiff < 0) dDiff*=-1; LcdXY(34,3); LcdWriteString(dtostrf(dDiff,4,2,dstring)); }
  LcdXY(60,3); LcdWriteString("hPa");
  
  // Température
  LcdClearLine(5); LcdXY(8,5); LcdWriteString("Temp. "); LcdXY(43,5); LcdWriteString(dtostrf(t,4,1,tstring)); LcdXY(73,5); LcdWriteString("C");
  
  eepromAdresse += 4; if(eepromAdresse > eepromMax) eepromAdresse=0;
  pwrDown(54); // Sleep 54s (total ~60s par cycle)
}

// Fonctions EEPROM, LCD, BMP180, Sleep, Watchdog...
// (Code complet dans la source originale)

Schéma de Câblage

Station Météo Compacte : Arduino Nano & ESP8266 avec Capteur BMP280 et Affichage OLED/Nokia LCD

Processus de fabrication

  1. Le Kazoo : Du Mirliton Ancestral au Jouet Plastique Moderne — Histoire, Fabrication et Avenir
  2. Éliminer les fils de liaison : Comment BreadShield connecte Arduino directement aux breadboards
  3. Giftduino : Boîte cadeau interactive Arduino pour makers et éducateurs
  4. Afficher Température, Humidité et Pression BME280 sur Écran Tactile Nextion
  5. Enregistreur de données Arduino haute performance pour ballon météo
  6. Station Météo Arduino Portable à 10$ – Nano, DHT22, BMP180 et LCD
  7. eDOT : Horloge Arduino précise et station météo avec télécommande IR intégrée
  8. Station météo IoT temps réel – Arduino, ESP8266, DHT11 & ThingSpeak
  9. Surveillance Pression IoT Temps Réel : MKR GSM, Arduino Cloud et Google Sheets