A temperatur, humidity and reaction monitoring system with configurable temperature, humidity and alerts. Control the values with the Terrarium-Box and with the included WebApplication which can be used on Mobile and Desktop.
This project is part of the IoT Engineering course.
Arduino/ESP8266_DTH11_rgbLED_Device.ino
Arduino/ESP8266_Ultrasonic_redLED_Device.ino
TerrariumWebApp.html (JavaScript)
- The actuator device consists of a ESP8266, Grove adapter, Chainable RGB LED , rotary angle sensor, DHT11 sensor and a display.
- Stack the ESP8266 on top of the Grove adapter.
- Connect the Chainable RGB to LED to D2, rotary angle sensor to A0, DHT11 sensor to pin 13 (see Note!) and display to D5 of the Grove adapter.
Note: the connect the DTH11 sensor with the ESP8266 you need to redirect pin 16 and pin 15 using the blue / green jumper cable to Grove connector A2.
Special Thanks to Mr.Amberg (@tamberg) for his help to archieve this fix
- The actuator device consists of a ESP8266, Grove adapter, LED, rotary angle sensor, Ultrasonic Ranger and a display.
- Stack the ESP8266 on top of the Grove adapter.
- Connect the LED to D2 (see Note!), rotary angle sensor to A0, ultrasoni ranger to D3 and display to I2C_1 of the Grove adapter.
Note: connect the LED adapter only after the reset and when the ESP8266 Wi-Fi connection is establishd.
-
Set Wi-Fi credentials
const char *ssid = "MY_SSID"; const char *password = "MY_PASSWORD";
-
Set Firebase credentials
//FirebaseESP8266.h must be included before ESP8266WiFi.h #include <FirebaseArduino.h> #define FIREBASE_HOST "?????????????.firebaseio.com" #define FIREBASE_AUTH "AUTH KEY"
HINT: ESP8266 Core SDK must be at least 2.4.1.
- Install Arduino json library: Install version 5.13.1 (and not the possible latest !!!) Watch install video
- Install Firebase library: Download latest stable build HERE > unzip in "Documents\Arduino\libraries" NOTE, There is a bug in "v0.3 Bi-directional streaming support" > update fingerprint
- Open file FirebaseHttpClient.h and replace fingerprint: 6F D0 9A 52 C0 E9 E4 CD A0 D3 02 A4 B7 A1 92 38 2D CA 2F 26 CLICK HERE FOR INFO
- Create Firebase Project
- Create a * Realtime Database *
- Edit Project Rules: Database(Realtime Database) > rules:
{
/* Visit https://firebase.google.com/docs/database/security to learn more about security rules. */
"rules": {
".read": true,
".write": true
}
}
- In the HEAD:
<!-- The core Firebase JS SDK is always required and must be listed first -->
<script src="https://www.gstatic.com/firebasejs/7.6.1/firebase-app.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
<script src="https://www.gstatic.com/firebasejs/7.6.1/firebase-database.js"></script>
- To initialize Firebase in your WebApp, you need to provide your App's Firebase project configuration.
const firebaseConfig = {
apiKey: "api-key",
authDomain: "project-id.firebaseapp.com",
databaseURL: "https://project-id.firebaseio.com",
projectId: "project-id",
storageBucket: "project-id.appspot.com",
messagingSenderId: "sender-id",
appId: "app-id",
measurementId: "G-measurement-id",
};
- To GET and SET Data from/to Firebase-Realtime-Database
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
// handl the recieved Data
const gotData = data => {
const {
alarm,
checkDistance,
desiredHumidity,
desiredTemp,
measuredHumidity,
measuredTemp,
reactionAlarm,
connection
} = data.val();
// ...
}
// error Handling
const errData = err => {
console.log("errData: " + err)
}
// referenc to the Firebase-Dabase
const ref = firebase.database().ref();
// get Data from Firebase-Database when Value changes
ref.on("value", gotData, error);
// update Value to the Firebase-Database (so the ESP8266 can get it)
const setValueToDatabase = (attribute, value) => {
const obj = {
[attribute]: parseInt(value, 10)
}
ref.update(obj);
}
Docs/Terrarium_Presentation.pdf
- Measures temperature, humidity and movements
- Shows temperature and humidity on the display
- Desired temperature and humidity can be set
- Warms or cools the terrarium (shown with chainable LED)
- Receive an alarm if the animal has not moved for a certain period
- Motionlessness alarm can be set
- Firebase API to read from the Realtime-Database
curl 'https://[PROJECT_ID].firebaseio.com/users/username/name.json’
- Firebase API to write to the Realtime-Database
curl -X POST -d '{"temp" : "23", "humi" : "33"}' \ 'https://[PROJECT_ID].firebaseio.com/message_list.json'
-
Sensor device
- Use case: Temperature, humidity and movements are measured
-
Actuator device
- Use case: The display shows the current temperature and humidity
- Web browser
- Use case: The temperature and humidity are displayed
- Web browser
- Use case: Set the desired values
- Actuator Device
- Use case: The LED lamps light up either red or blue, depending on the warmer or colder temperatures
- Web Browser
- Use case: The time for the alarm when the animal is no longer moving is set
- Actuator Device
- Use case: If the animal does not move for the set period, the red LED lamp lights up