ETML-PAPP-FSS
Published

HomeLife Nightstand

A night table with a weather station that displays the date and time.

IntermediateShowcase (no instructions)2,047
HomeLife Nightstand

Things used in this project

Hardware components

DS3231MPMB1 Peripheral Module
Maxim Integrated DS3231MPMB1 Peripheral Module
×1
DHT22 Temperature Sensor
DHT22 Temperature Sensor
×1
Standard LCD - 16x2 White on Blue
Adafruit Standard LCD - 16x2 White on Blue
×1
Arduino Mega 2560
Arduino Mega 2560
×1
Single Turn Potentiometer- 10k ohms
Single Turn Potentiometer- 10k ohms
×1
Resistor 10k ohm
Resistor 10k ohm
×1
Alimentation électrique, 60 W, P.SUP.AT5-B, HQ
×1

Software apps and online services

Arduino IDE
Arduino IDE
Arduino Web Editor
Arduino Web Editor
Fritzing

Hand tools and fabrication machines

colone drill.
Tap
hexagonal key
ripper
wood chisel

Story

Read more

Custom parts and enclosures

Bedside table legs (4x)

The four largest parts of the chassis

Fixing brackets (little) (8x)

The brackets are used to fix the chassis and the Enclosure .

Support

They connect the feet together to form the chassis

Fixing brackets (tall) (8x)

The brackets are used to fix the chassis and the Enclosure .

Code

Date and time weather station

C/C++
Upload this cod on your Arduino and... Yeah
#include <DHT_U.h>
#include <Adafruit_Sensor.h>
#include <DHT.h>
#include <DHT_U.h>
#include "DHT.h"
#define DHTPIN 8 // broche ou l'on a branche le capteur
#define DHTTYPE DHT22 // DHT 22 (AM2302)
#include <Wire.h>
#include <ds3231.h>
#include <LiquidCrystal.h>

 LiquidCrystal lcd(12,11,5,4,3,2);
 
 struct ts t; //dclaration variable t
 DHT dht(DHTPIN, DHTTYPE);//dclaration du capteur
void setup()
{
 Wire.begin();
 DS3231_init(DS3231_INTCN);
 Serial.begin(9600);
 lcd.begin(16,2);
 lcd.setCursor(3,0);
 byte degre[8] = {
   0b00011,
   0b00011,
   0b00000,
   0b00000,
   0b00000,
   0b00000,
   0b00000,
   0b00000
};

 byte pourcent[8] = {
   0b11000,
   0b11001,
   0b00010,
   0b00100,
   0b01000,
   0b10000,
   0b00011,
   0b00011,
 };
 lcd.createChar(0, degre);
 delay(2000);
 lcd.clear();
 lcd.print("Bonjour  ");
 delay(1000);
 lcd.clear();
 lcd.setCursor(3,0);
 lcd.print("Allez-vous");
 lcd.setCursor(4,1);
 lcd.print("bien?");
 delay(2000);
 lcd.clear();
 lcd.setCursor(0,0);
 lcd.print("loading");
 delay(500);
 lcd.clear();
 lcd.print("loading.");
 delay(500);
 lcd.clear();
 lcd.print("loading..");
 delay(500);
 lcd.clear();
 lcd.print("loading...");
 delay(500);
 lcd.clear();
 dht.begin();
}
void loop()
{
 DS3231_get(&t);
 delay(500);
 
 // La lecture du capteur prend 250ms
 // Les valeurs lues peuvet etre vieilles de jusqu'a 2 secondes (le capteur est lent)
 float h = dht.readHumidity();//on lit l'hygrometrie
 float q = dht.readTemperature();//on lit la temperature en celsius (par defaut)
 // pour lire en farenheit, il faut le paramre (isFahrenheit = true) :
 float f = dht.readTemperature(true);
 
 //On verifie si la lecture a echoue, si oui on quitte la boucle pour recommencer.
 if (isnan(h) || isnan(q) || isnan(f))
 {
   Serial.print("</Pas d'information DHT22>");
   return; 
 }
 
 // Calcul de l'indice de temperature en Farenheit
 float hif = dht.computeHeatIndex(f, h);
 // Calcul de l'indice de temperature en Celsius
 float hic = dht.computeHeatIndex(q, h, false);
 
 //Affichages :
 lcd.clear();
 lcd.setCursor(0,0);
 lcd.print("Humidite:");
 lcd.print(h);
 lcd.print("%\t");
 lcd.print(" ");
 lcd.setCursor(0,1);
 lcd.print("Temp. : ");
 lcd.print(q);
 lcd.write(byte(0));
 lcd.print("C");
 delay(5000);
 lcd.clear();
 lcd.setCursor(0,0);
 lcd.print("Date:  ");
 lcd.print(t.mday);
 lcd.print("/");
 lcd.print(t.mon);
 lcd.print("/");
 lcd.print(t.year);
 lcd.print("    ");
 lcd.setCursor(0,1);
 lcd.print("Heure:  ");
 lcd.print(t.hour);
 lcd.print(":");
 lcd.print(t.min);
 delay(5000);
 
 
 
}

Credits

Florian Siess

Posted by ETML-PAPP-FSS

Comments