Voila 
//DS1307
#include "RTClib.h"
RTC_DS1307 rtc;
char daysOfTheWeek[7][12] = {"Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"};
//SI1145
#include <Wire.h>
#include "Adafruit_SI1145.h"
Adafruit_SI1145 uv = Adafruit_SI1145();
//SGP30
#include "Adafruit_SGP30.h"
Adafruit_SGP30 sgp;
uint32_t getAbsoluteHumidity(float temperature, float humidity) {
// approximation formula from Sensirion SGP30 Driver Integration chapter 3.15
const float absoluteHumidity = 216.7f * ((humidity / 100.0f) * 6.112f * exp((17.62f * temperature) / (243.12f + temperature)) / (273.15f + temperature)); // [g/m^3]
const uint32_t absoluteHumidityScaled = static_cast<uint32_t>(1000.0f * absoluteHumidity); // [mg/m^3]
return absoluteHumidityScaled;
}
//BME280
#include <Adafruit_Sensor.h>
#include <Adafruit_BME280.h>
#define SEALEVELPRESSURE_HPA (1013.25)
Adafruit_BME280 bme; // I2C
unsigned long delayTime;
//bluetooth
#include "BluetoothSerial.h"
#if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED)
#error Bluetooth is not enabled! Please run `make menuconfig` to and enable it
#endif
BluetoothSerial SerialBT;
//WIFI
#include <WiFi.h>
const char* ssid = "";
const char* password = "";
WiFiServer server(80);
String header;
// Current time
unsigned long currentTime = millis();
// Previous time
unsigned long previousTime = 0;
// Define timeout time in milliseconds (example: 2000ms = 2s)
const long timeoutTime = 2000;
void setup() {
//DS1307
Serial.begin(57600);
if (! rtc.begin()) {
Serial.println("Couldn't find RTC");
Serial.flush();
abort();
}
if (! rtc.isrunning()) {
Serial.println("RTC is NOT running, let's set the time!");
// When time needs to be set on a new device, or after a power loss, the
// following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
//Si1145
Serial.println("Adafruit SI1145 test");
if (! uv.begin()) {
Serial.println("Didn't find Si1145");
while (1);
}
Serial.println("OK!");
//SGP30
while (!Serial) { delay(10); } // Wait for serial console to open!
Serial.println("SGP30 test");
if (! sgp.begin()){
Serial.println("Sensor not found :(");
while (1);
}
Serial.print("Found SGP30 serial #");
Serial.print(sgp.serialnumber[0], HEX);
Serial.print(sgp.serialnumber[1], HEX);
Serial.println(sgp.serialnumber[2], HEX);
// If you have a baseline measurement from before you can assign it to start, to 'self-calibrate'
//sgp.setIAQBaseline(0x8E68, 0x8F41); // Will vary for each sensor!
//BME280
while(!Serial); // time to get serial running
Serial.println(F("BME280 test"));
unsigned status;
status = bme.begin();
if (!status) {
Serial.println("Could not find a valid BME280 sensor, check wiring, address, sensor ID!");
Serial.print("SensorID was: 0x"); Serial.println(bme.sensorID(),16);
Serial.print(" ID of 0x60 represents a BME 280.\n");
while (1) delay(10);
}
Serial.println("-- Default Test --");
Serial.println();
//bluetooth
SerialBT.begin("Control'R"); //Bluetooth device name
Serial.println("The device started, now you can pair it with bluetooth!");
//WIFI
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
// Print local IP address and start web server
Serial.println("");
Serial.println("WiFi connected.");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
server.begin();
}
int counter = 0;
void loop() {
//DS1307
DateTime now = rtc.now();
Serial.print(now.year(), DEC);
Serial.print('/');
Serial.print(now.month(), DEC);
Serial.print('/');
Serial.print(now.day(), DEC);
Serial.print(" (");
Serial.print(daysOfTheWeek[now.dayOfTheWeek()]);
Serial.print(") ");
Serial.print(now.hour(), DEC);
Serial.print(':');
Serial.print(now.minute(), DEC);
Serial.print(':');
Serial.print(now.second(), DEC);
Serial.println();
//Si1145
Serial.println("===================");
Serial.print("Lumière Visible : "); Serial.println(uv.readVisible());
float UVindex = uv.readUV();
// the index is multiplied by 100 so to get the
// integer index, divide by 100!
UVindex /= 100.0;
Serial.print("Rayon UV : "); Serial.println(UVindex);
Serial.println();
//SGP30
float temperature = bme.readTemperature(); // [°C]
float humidity = bme.readHumidity(); // [%RH]
sgp.setHumidity(getAbsoluteHumidity(temperature, humidity));
if (! sgp.IAQmeasure()) {
Serial.println("Measurement failed");
return;
}
Serial.print("Taux VOC : "); Serial.print(sgp.TVOC); Serial.println(" ppb\t");
Serial.print("Taux CO2 "); Serial.print(sgp.eCO2); Serial.println(" ppm");
if (! sgp.IAQmeasureRaw()) {
Serial.println("Raw Measurement failed");
return;
}
Serial.print("Taux Brut H2 "); Serial.print(sgp.rawH2); Serial.println(" \t");
Serial.print("Taux Brut Ethanol "); Serial.print(sgp.rawEthanol); Serial.println("");
Serial.println();
counter++;
if (counter == 30) {
counter = 0;
uint16_t TVOC_base, eCO2_base;
if (! sgp.getIAQBaseline(&eCO2_base, &TVOC_base)) {
Serial.println("Failed to get baseline readings");
return;
}
Serial.print("****Baseline values: eCO2: 0x"); Serial.print(eCO2_base, HEX);
Serial.print(" & TVOC: 0x"); Serial.println(TVOC_base, HEX);
}
//BME280
printValues();
delay(10000);
//bluetooth
if (Serial.available()) {
SerialBT.write(Serial.read());
}
if (SerialBT.available()) {
Serial.write(SerialBT.read());
}
delay(20);
//date
SerialBT.print(now.year(), DEC);
SerialBT.print('/');
SerialBT.print(now.month(), DEC);
SerialBT.print('/');
SerialBT.print(now.day(), DEC);
SerialBT.print(" (");
SerialBT.print(daysOfTheWeek[now.dayOfTheWeek()]);
SerialBT.print(") ");
SerialBT.print(now.hour(), DEC);
SerialBT.print(':');
SerialBT.print(now.minute(), DEC);
SerialBT.print(':');
SerialBT.print(now.second(), DEC);
SerialBT.println();
//lumière
SerialBT.println("===================");
SerialBT.print("Lumière Visible : ");
SerialBT.println(uv.readVisible());
SerialBT.print("Rayon UV : ");
SerialBT.println(UVindex);
//gaz
SerialBT.print("Taux VOC : "); SerialBT.print(sgp.TVOC); SerialBT.println(" ppb");
SerialBT.print("Taux CO2 "); SerialBT.print(sgp.eCO2); SerialBT.println(" ppm");
//Météo
SerialBT.print("Température = ");
SerialBT.print(bme.readTemperature());
SerialBT.println(" °C");
SerialBT.print("Pression = ");
SerialBT.print(bme.readPressure() / 100.0F);
SerialBT.println(" hPa");
SerialBT.print("Humidité = ");
SerialBT.print(bme.readHumidity());
SerialBT.println(" %");
SerialBT.println("===================");
SerialBT.println();
//WIFI
WiFiClient client = server.available(); // Listen for incoming clients
if (client) { // If a new client connects,
currentTime = millis();
previousTime = currentTime;
Serial.println("New Client."); // print a message out in the serial port
String currentLine = ""; // make a String to hold incoming data from the client
while (client.connected() && currentTime - previousTime <= timeoutTime) { // loop while the client's connected
currentTime = millis();
if (client.available()) { // if there's bytes to read from the client,
char c = client.read(); // read a byte, then
Serial.write(c); // print it out the serial monitor
header += c;
if (c == '\n') { // if the byte is a newline character
// if the current line is blank, you got two newline characters in a row.
// that's the end of the client HTTP request, so send a response:
if (currentLine.length() == 0) {
// HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
// and a content-type so the client knows what's coming, then a blank line:
client.println("HTTP/1.1 200 OK");
client.println("Content-type:text/html");
client.println("Connection: close");
client.println();
// Display the HTML web page
client.println("<!DOCTYPE html><html>");
client.println("<head><meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">");
client.println("<link rel=\"icon\" href=\"data:,\">");
// CSS to style the table
client.println("<style>body { text-align: center; font-family: \"Trebuchet MS\", Arial;}");
client.println("table { border-collapse: collapse; width:35%; margin-left:auto; margin-right:auto; }");
client.println("th { padding: 12px; background-color: #0043af; color: white; }");
client.println("tr { border: 1px solid #ddd; padding: 12px; }");
client.println("tr:hover { background-color: #bcbcbc; }");
client.println("td { border: none; padding: 12px; }");
client.println(".sensor { color:white; font-weight: bold; background-color: #bcbcbc; padding: 1px; }");
// Web Page Heading
client.println("</style></head><body><h1>Control'R</h1>");
client.print(now.year(), DEC);
client.print('/');
client.print(now.month(), DEC);
client.print('/');
client.print(now.day(), DEC);
client.print(" (");
client.print(daysOfTheWeek[now.dayOfTheWeek()]);
client.print(") ");
client.print(now.hour(), DEC);
client.print(':');
client.print(now.minute(), DEC);
client.print(':');
client.print(now.second(), DEC);
client.println();
client.println("<table><tr><th>MESURE</th><th>VALEUR</th></tr>");
client.println("<tr><td>Temp. Celsius</td><td><span class=\"sensor\">");
client.println(bme.readTemperature());
client.println(" *C</span></td></tr>");
client.println("<tr><td>Temp. Fahrenheit</td><td><span class=\"sensor\">");
client.println(1.8 * bme.readTemperature() + 32);
client.println(" *F</span></td></tr>");
client.println("<tr><td>Pression</td><td><span class=\"sensor\">");
client.println(bme.readPressure() / 100.0F);
client.println(" hPa</span></td></tr>");
client.println("<tr><td>Approx. Altitude</td><td><span class=\"sensor\">");
client.println(bme.readAltitude(SEALEVELPRESSURE_HPA));
client.println(" m</span></td></tr>");
client.println("<tr><td>Humidite</td><td><span class=\"sensor\">");
client.println(bme.readHumidity());
client.println(" %</span></td></tr>");
client.println("<tr><td>Lumiere</td><td><span class=\"sensor\">");
client.println(uv.readVisible());
client.println(" </span></td></tr>");
client.println("<tr><td>IR</td><td><span class=\"sensor\">");
client.println(uv.readIR());
client.println(" </span></td></tr>");
client.println("<tr><td>UV</td><td><span class=\"sensor\">");
client.println(UVindex);
client.println(" </span></td></tr>");
client.println("<tr><td>CO2</td><td><span class=\"sensor\">");
client.println(sgp.eCO2);
client.println(" ppm</span></td></tr>");
client.println("<tr><td>VOC</td><td><span class=\"sensor\">");
client.println(sgp.TVOC);
client.println(" ppb</span></td></tr>");
client.println("<tr><td>H2</td><td><span class=\"sensor\">");
client.println(sgp.rawH2);
client.println(" </span></td></tr>");
client.println("<tr><td>Ethanol</td><td><span class=\"sensor\">");
client.println(sgp.rawEthanol);
client.println(" </span></td></tr>");
client.println("</body></html>");
// The HTTP response ends with another blank line
client.println();
// Break out of the while loop
break;
} else { // if you got a newline, then clear currentLine
currentLine = "";
}
} else if (c != '\r') { // if you got anything else but a carriage return character,
currentLine += c; // add it to the end of the currentLine
}
}
}
// Clear the header variable
header = "";
// Close the connection
client.stop();
Serial.println("Client disconnected.");
Serial.println("");
}
}
void printValues() {
Serial.print("Température = ");
Serial.print(bme.readTemperature());
Serial.println(" °C");
Serial.print("Pression = ");
Serial.print(bme.readPressure() / 100.0F);
Serial.println(" hPa");
Serial.print("Humidité = ");
Serial.print(bme.readHumidity());
Serial.println(" %");
Serial.println("===================");
Serial.println();
}