System Requirements
To build the embedded device, the following requirements from DLO must be fulfilled:
Requirement ID# | Requirement | MoSCoW | Compliant |
---|---|---|---|
EMBRQ#01 | The embedded device acts as a client and sends measured sensor data to the application backend over http or https. | MUST | YES |
EMBRQ#02 | The embedded device also acts as a server and receives status messages from the application backend over http or https. | MUST | YES |
EMBRQ#03 | The embedded device contains at least two types of input sensors (e.g. LDR, buttons, joystick, capacitive touch, etc.). | MUST | YES |
EMBRQ#04 | The embedded device contains at least two types of visual and/or sensory outputs (e.g. LED, LED Matrix, 7-segment display, motor, servo, actuator, LCD-screen, buzzer, etc.). | MUST | YES |
EMBRQ#05 | The embedded device uses the WifiManager for configuration of SSID and password (PWD) for connecting to the network. | MUST | YES |
EMBRQ#01 — Proof of HTTPS API Access from Devices
Both devices can access the API via https://yanisdeplazes.loca.lt
using HTTPS requests.
They can fetch data using GET
and upload sensor readings using POST
.
GET: Fetch Devices
File: Client.cpp
— Line 165 Source
1 |
|
GET: Latest Reading for Device
File: Client.cpp
— Line 202 Source
1 |
|
POST: Register Device
File: Client.cpp
— Line 208 Source
1 2 3 4 5 6 7 |
|
POST: Send Reading + Sensor Data
File: Client.cpp
— Line 258 Source
1 2 3 4 5 6 7 8 9 10 11 |
|
Used Libraries
WiFiClientSecure
for HTTPSArduinoJson
for JSON handling
All traffic to and from the device is encrypted and uses HTTPS.
EMBRQ#02
The ESP32 device hosts a HTTPS server using a self-signed certificate.
It exposes the /index
route to get the current index of what device is currently displayed for a fallback.
GET: /index Endpoint
File: server.cpp
— Line ~45 Source
1 2 3 4 5 6 7 |
|
HTTPS Server Setup
File: server.cpp
— Line ~63 Source
1 2 3 4 5 6 7 |
|
Used Libraries
httpd_ssl
from ESP-IDF for TLS web serveresp_tls
for certificate handling- Custom
cert.h
andkey.h
headers for in-memory PEM cert and key
NGINX Settings
The system uses NGINX's Push Stream Module to broadcast the current index when it changes. The subscribed client (IPad or Browser) can receive real-time updates over the WebSocket-like connection.
File: nginx.conf
— Line ~51 Source
1 2 3 4 5 6 7 8 9 |
|
EMBRQ#03
EMBRQ#03 — Sensor Data Collection
The reader device integrates 4 types of sensors (DHT11, BMP180, BH1750, analog water sensor) to measure environmental data and upload it to the backend API via HTTPS. Each sensor is initialized and polled in the main loop, with results printed to the serial monitor and sent as a single payload to the API.
Loop
File: sensors.ino
— Lines ~119 Source
1 2 3 4 5 6 7 |
|
Reading Functions
File: sensors.ino
— Lines ~134 Source
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
|
Used Libraries
DHT
for temperature and humidity (DHT11)Adafruit_BMP085
for temperature and pressure (BMP180)BH1750
for ambient light (lux)Wire
(I2C) for communication
EMBRQ#04
Both devices have output components (3 in total). They allow the for visually or audibly feedback from weather data.
- LED (Visualize when Setup is done)
- WS2812B Ledstrip (Visualize Temperature)
- Mini MP3 DFPlayer Player (Plays sound depending on weather)
LED
File: sensors.ino
— Lines ~111 Source
1 |
|
WS2812B Ledstrip
File: LEDManager.cpp
— Lines ~50 Source
1 2 3 4 |
|
File: LEDManager.cpp
— Lines ~86 Source
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Mini MP3 DFPlayer Player
File: DFPlayerManager.cpp
— Lines ~60 Source
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
File: DFPlayerManager.cpp
— Lines ~L117 Source
1 2 3 4 5 6 7 8 |
|
Libraries Used
- DFRobotDFPlayerMini
- FastLED
EMBRQ#05
Both devices use the WiFiManager library for the network setup. If no credentials are stored, it launches a portal for configuration:
- No hardcoded credentials
- Portal fallback
- Auto-reconnect to known networks
- Reboots if config times out
File: installation: WiFiSetup.cpp
— Lines ~21 Source
File: sensors: WiFiSetup.cpp
— Lines ~21 Source
1 2 3 4 5 6 7 8 9 10 11 12 13 |
|
Libraries Used
- WiFiManager